
Create Hook
Scaffold and test git hooks (pre-commit, post-edit) matched to TypeScript, Prettier, ESLint, and package scripts in an agent-driven repo.
Overview
Create-hook is an agent skill most often used in Build (also Ship testing/review) that analyzes your stack and creates tested git hooks for format, lint, type-check, tests, builds, and secret prevention.
Install
npx skills add https://github.com/neolabhq/context-engineering-kit --skill create-hookWhat is this skill?
- Four-step workflow: analyze environment, suggest hooks, configure via targeted questions, test and validate
- Auto-detects tsconfig, Prettier, ESLint, package.json scripts, and existing git hooks
- Suggests PostToolUse type-check/format/lint and PreToolUse gates for errors and secrets
- Maps common scripts: test → pre-commit, build → pre-commit validation
- Security-oriented suggestions: block commits with secrets and scan on file changes
- 4-step workflow: analyze, suggest, configure, test and validate
Adoption & trust: 511 installs on skills.sh; 1.1k GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You want git and agent hooks that match your real toolchain but do not know which events to use or how to test them.
Who is it for?
Solo devs on TypeScript/JavaScript repos using Claude Code hooks or git hooks who need opinionated, tested automation.
Skip if: Repos without git, teams that forbid local hooks, or projects needing only CI configuration with no local hook strategy.
When should I use this skill?
You run /create-hook with an optional hook type or desired behavior to add or refine git/agent hooks.
What do I get? / Deliverables
You get working hook scripts with validation steps so edits and commits respect type-check, lint, format, test, build, and basic security rules.
- Hook script(s) for git or Claude tool events
- Validation notes from testing the hook behavior
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Create-hook lands on Build/agent-tooling because it extends how Claude and similar agents interact with your repo—but the hooks it creates primarily guard quality at Ship time. Hook creation is agent-tooling: wiring automation around tool use (PostToolUse/PreToolUse) and bash/git events, not shipping a user-facing feature.
Where it fits
Stand up PostToolUse formatting and lint fixes right after the agent edits TS files.
Add a pre-commit hook that runs npm test before you merge agent-generated changes.
Configure a bash/git hook to reject commits that match common secret patterns.
How it compares
Interactive hook generator with stack detection—not a static pre-commit config cookbook or a hosted CI product.
Common Questions / FAQ
Who is create-hook for?
Indie builders and agent users who want git or Claude hooks aligned to ESLint, Prettier, TypeScript, tests, and build scripts.
When should I use create-hook?
In Build while setting up agent-tooling hooks; in Ship when adding pre-commit test/build gates or secret-scan blocks before you rely on automated commits.
Is create-hook safe to install?
Hooks can run shell commands and block git operations—review the Security Audits panel on this page and inspect generated scripts before enabling them.
SKILL.md
READMESKILL.md - Create Hook
# Create Hook Command Analyze the project, suggest practical hooks, and create them with proper testing. ## Your Task (/create-hook) 1. **Analyze environment** - Detect tooling and existing hooks 2. **Suggest hooks** - Based on your project configuration 3. **Configure hook** - Ask targeted questions and create the script 4. **Test & validate** - Ensure the hook works correctly ## Your Workflow ### 1. Environment Analysis & Suggestions Automatically detect the project tooling and suggest relevant hooks: **When TypeScript is detected (`tsconfig.json`):** - PostToolUse hook: "Type-check files after editing" - PreToolUse hook: "Block edits with type errors" **When Prettier is detected (`.prettierrc`, `prettier.config.js`):** - PostToolUse hook: "Auto-format files after editing" - PreToolUse hook: "Require formatted code" **When ESLint is detected (`.eslintrc.*`):** - PostToolUse hook: "Lint and auto-fix after editing" - PreToolUse hook: "Block commits with linting errors" **When package.json has scripts:** - `test` script → "Run tests before commits" - `build` script → "Validate build before commits" **When a git repository is detected:** - PreToolUse/Bash hook: "Prevent commits with secrets" - PostToolUse hook: "Security scan on file changes" **Decision Tree:** ``` Project has TypeScript? → Suggest type checking hooks Project has formatter? → Suggest formatting hooks Project has tests? → Suggest test validation hooks Security sensitive? → Suggest security hooks + Scan for additional patterns and suggest custom hooks based on: - Custom scripts in package.json - Unique file patterns or extensions - Development workflow indicators - Project-specific tooling configurations ``` ### 2. Hook Configuration Start by asking: **"What should this hook do?"** and offer relevant suggestions from your analysis. Then understand the context from the user's description and **only ask about details you're unsure about**: 1. **Trigger timing**: When should it run? - `PreToolUse`: Before file operations (can block) - `PostToolUse`: After file operations (feedback/fixes) - `UserPromptSubmit`: Before processing requests - Other event types as needed 2. **Tool matcher**: Which tools should trigger it? (`Write`, `Edit`, `Bash`, `*` etc) 3. **Scope**: `global`, `project`, or `project-local` 4. **Response approach**: - **Exit codes only**: Simple (exit 0 = success, exit 2 = block in PreToolUse) - **JSON response**: Advanced control (blocking, context, decisions) - Guide based on complexity: simple pass/fail → exit codes, rich feedback → JSON 5. **Blocking behavior** (if relevant): "Should this stop operations when issues are found?" - PreToolUse: Can block operations (security, validation) - PostToolUse: Usually provide feedback only 6. **Claude integration** (CRITICAL): "Should Claude Code automatically see and fix issues this hook detects?" - If YES: Use `additionalContext` for error communication - If NO: Use `suppressOutput: true` for silent operation 7. **Context pollution**: "Should successful operations be silent to avoid noise?" - Recommend YES for formatting, routine checks - Recommend NO for security alerts, critical errors 8. **File filtering**: "What file types should this hook process?" ### 3. Hook Creation You should: - **Create hooks directory**: `~/.claude/hooks/` or `.claude/hooks/` based on scope - **Generate script**: Create hook script with: - Proper shebang and executable permissions - Project-specific commands (use detected config paths) - Comments explaining the hook's purpose - **Update settings**: Add hook configuration to appropriate settings.json - **Use absolute paths**: Avoid relative paths to scripts and executables. Use `$CLAUDE_PROJEC