hook-creator_skill

This skill helps you generate and configure hooks to automate Claude Code events, improving workflow automation and reliability.
  • Python

4

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill basher83/agent-auditor --skill hook-creator

  • SKILL.md4.4 KB

Overview

This skill helps create hooks.json configurations and supporting scripts to automate event-driven behavior in Claude Code plugins. It guides selection of events, matcher filters, hook types (command, validation, notification), and best practices for portable, safe hooks. Use it to implement auto-formatting, test runs, session messages, and other automation tied to plugin lifecycle events.

How this skill works

The skill asks about the desired automatic action, the triggering event, and any tool filters, then generates a hooks/hooks.json entry plus optional script files in scripts/. It produces command, validation, or notification hook stubs that use ${CLAUDE_PLUGIN_ROOT} for plugin-relative paths and includes error handling notes. The result is a ready-to-install hook configuration with clear instructions to make scripts executable.

When to use it

  • You want to auto-run scripts on events like SessionStart, PostToolUse, or UserPromptSubmit.
  • You need hooks.json examples or help composing matcher expressions for specific tools.
  • You want to run formatters, tests, or checks automatically after edits.
  • You need session initialization or cleanup actions wired into plugin lifecycle.
  • You want to validate project state before or after tool use.

Best practices

  • Pick the most specific event that matches your goal to avoid unnecessary runs (e.g., PostToolUse with matcher for file edits).
  • Use matchers to scope hooks to particular tool names or actions (pipe-separated regex-like filters).
  • Reference paths with ${CLAUDE_PLUGIN_ROOT} so hooks remain portable across environments.
  • Keep command scripts idempotent and add robust error handling and logging.
  • Make command scripts executable (chmod +x) and test hooks locally before relying on them in workflows.

Example use cases

  • Auto-format modified code after Edit/Write tool actions using a PostToolUse command hook and scripts/format-code.sh.
  • Run targeted test suites when test files change using PostToolUse plus a matcher for test-related writes and scripts/run-tests.sh.
  • Show a welcome or initialization message on SessionStart using a simple command hook that echoes a message.
  • Validate PR or file contents on UserPromptSubmit or PreToolUse using a validation hook that inspects files and returns structured results.

FAQ

Common events include PreToolUse, PostToolUse, UserPromptSubmit, Notification, Stop, SubagentStop, SessionStart, SessionEnd, and PreCompact.

How do I scope a hook to only run after certain tool uses?

Add a matcher field with tool names separated by | (pipe). For example "matcher": "Write|Edit" will run the hook only for those tool actions.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational