# create-hook

The skill scans your project and suggests hooks for your stack: type checks, formatting, linting, tests. Then it writes the script and tests it.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 1200 installs · ★ 1787
- Author: NeoLabHQ
- License: GPL-3.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/NeoLabHQ/context-engineering-kit/tree/HEAD/skills/create-hook/SKILL.md
- Updated: 2026-08-26
- HTML: https://affpapa.org/en/nevibecode/skills/create-hook

## What it does

Four steps. First the skill looks at your configs: `tsconfig.json`, `.prettierrc`, `.eslintrc.*`, scripts in `package.json`. Then it suggests hooks that fit what it found — a type check after an edit, or blocking a commit with lint errors.

Next come the questions: when should it run (`PreToolUse`, `PostToolUse`, `UserPromptSubmit`), which tools to match (`Write`, `Edit`, `Bash`, `*`), and the scope (`global`, `project`, `project-local`). The script lands in `~/.claude/hooks/` or `.claude/hooks/`, and the settings go into `settings.json`. Use absolute paths via `$CLAUDE_PROJECT_DIR` — relative ones break as soon as the hook runs from another directory.

Inside the script, JSON comes from stdin, not argv. Claude reads `additionalContext` and `systemMessage`; `suppressOutput: true` keeps successful runs quiet. Blocking in `PreToolUse` means `exit 2`. After creating the hook, the skill offers to run both paths: the one that should pass and the one that should stop.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add NeoLabHQ/context-engineering-kit --skill create-hook -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/create-hook/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/create-hook/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add NeoLabHQ/context-engineering-kit --skill create-hook -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/create-hook/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add NeoLabHQ/context-engineering-kit --skill create-hook -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/create-hook/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install NeoLabHQ/context-engineering-kit create-hook
```

2. **Manually: put the files in place**
- File: `.github/skills/create-hook/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add NeoLabHQ/context-engineering-kit --skill create-hook -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/NeoLabHQ/context-engineering-kit --path skills/create-hook
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/create-hook/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add NeoLabHQ/context-engineering-kit --skill create-hook -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/NeoLabHQ/context-engineering-kit/tree/HEAD/skills/create-hook/SKILL.md

## When to use it
- type-check files right after an edit
- block commits that fail linting
- auto-format code on save
- catch secrets and keys before a commit
- run tests before committing

## Example prompts
- create a hook that type-checks .ts files after editing
- I need a PreToolUse hook that blocks commits with secrets
- make a prettier auto-format hook and test it

## Similar
- [eslint-prettier-config](https://affpapa.org/en/nevibecode/skills/eslint-prettier-config.md) — skill · 1100 installs
- [setup](https://affpapa.org/en/nevibecode/skills/tartinerlabs-setup.md) — skill · 375 installs
- [dx-code-analyzer-custom-rule-create](https://affpapa.org/en/nevibecode/skills/dx-code-analyzer-custom-rule-create.md) — skill · 4800 installs
- [block-no-verify-hook](https://affpapa.org/en/nevibecode/skills/block-no-verify-hook.md) — skill · 6500 installs
- [spatie-javascript](https://affpapa.org/en/nevibecode/skills/spatie-javascript.md) — skill · 518 installs
- [ultracite](https://affpapa.org/en/nevibecode/skills/secondsky-ultracite.md) — skill · 415 installs

From the same set: [neolabhq/context-engineering-kit](https://affpapa.org/en/nevibecode/by/neolabhq/context-engineering-kit.md) — 64 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
