create-hook
Skill5 starsChanged 5 months agoMITView on GitHub
Author a new Claude Code hook for this repository end to end by scaffolding it with pnpm new, writing the hook script and its settings.json wiring, documenting activation in HOOK.md, then regenerating the registry. Use when creating, scaffolding, or reviewing a hook in this repo.
9 other projects use a version of this.
Adopted by
Most recently taken up by
- microsoft/vscodetheir own version, first seen Nov 12, 2026
- pahlevikun/levistacktheir own version, first seen Oct 4, 2026
- JameMy0001/antigravity-skills-hubtheir own version, first seen Oct 2, 2026
- leishifu666/skillstheir own version, first seen Sep 29, 2026
- zhuangwenhui/CodingSkillstheir own version, first seen Jun 14, 2026
- Iteam-company/claude-code-boilerplatestheir own version, first seen May 19, 2026
Used with
Projects with it also use create-rule.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
32103210Skillcreate-rule
Create Cursor rules for persistent AI guidance. Use when you want to create a rule, add coding standards, set up project conventions, configure file-specific patterns, create RULE.md files, or asks about .cursor/rules/ or AGENTS.md.
Also in 4 projects that use this
Other versions9 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 9
- microsoft/vscode★ 196ksame name
- NeoLabHQ/context-engineering-kit★ 1.7ksame name
- am-will/codex-skills★ 1ksame name
- zhuangwenhui/CodingSkills★ 83same name
- Iteam-company/claude-code-boilerplates★ 2same name
- JameMy0001/antigravity-skills-hub★ 1same name
- leishifu666/skills★ 1same name
- PandelisZ/skills★ 1same name
- pahlevikun/levistack★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository89 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- site/llms-full.txtllms.txt
- site/llms.txtllms.txt
- improveSkill
- academic-writingSkill
- benchmark-reportingSkill
- bibtex-managerSkill
- citation-graphSkill
- citation-verifierSkill
- design-science-methodologySkill
- docx-thesisSkill
- experiment-reproducibilitySkill
- latex-toolkitSkill
- literature-searchSkill
- lit-review-synthesisSkill
- paper-readerSkill
- proofread-academicSkill
- research-figuresSkill
- research-methodologySkill
- research-questionSkill
- statistics-advisorSkill
- supervisor-updateSkill
- systematic-reviewSkill
- thesis-proposalSkill
- coolify-image-appSkill
- coolify-vps-baselineSkill
- deploy-verificationSkill
- express-prisma-coolify-imageSkill
- ghcr-coolify-pipelineSkill
- live-domain-cutoverSkill
- nextjs-coolify-imageSkill
- proxy-client-addressSkill
- vps-ops-toolkitSkill
- adr-writingSkill
- openapi-specSkill
- readme-writingSkill
- technical-writingSkill
- adversarial-reviewerSkill
- api-design-reviewSkill
- code-review-responseSkill
- create-agentSkill
- create-commandSkill
- create-skillSkill
- db-migration-safetySkill
- dependency-upgradeSkill
- dockerfile-best-practicesSkill
- error-handling-patternsSkill
- executing-plansSkill
- explain-codebaseSkill
- fix-ciSkill
- github-actions-pipelineSkill
- grill-with-docsSkill
- incident-postmortemSkill
- logging-and-observabilitySkill
- parallel-agentsSkill
- performance-optimizationSkill
- refactoring-recipesSkill
- solid-principlesSkill
- systematic-debuggingSkill
- test-driven-developmentSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.
0
Common
Most of the 9 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
Zero or pinned dependencies: Prefer the language's standard library so the script runs anywhere it lands.
- Very specific: line 20
Never hand-write
registry.jsonor the README catalog: Run pnpm gen. - Very specific: line 41
Add the script alongside HOOK.md (for example <name>.mjs or <name>.sh).
“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Create a hook: a script Claude Code runs on a lifecycle event (before a tool, after a prompt, on stop, and so on). Make it do one deterministic thing, fail safe, and ship with documentation a user can paste into settings.json. Then regenerate the derived files and validate.
Source layout is hooks/<category>/<name>/HOOK.md plus the script. Hooks are folder-layout: the whole folder installs to .claude/hooks/<name>/, so the script and any helpers ride along. The category is the folder; registry.json and the README catalog are generated by pnpm gen. Never hand-edit generated files.
Hooks differ from skills, agents, and commands in one critical way: they are configuration, not a loadable file. The shadcn installer copies the script and HOOK.md but cannot edit a user's settings.json. So HOOK.md must document the exact settings block to add, and the hook is inert until the user adds it.
Hard rules: never break these
- Fail safe and non-blocking by default. Unless the hook's job is to block, swallow its own errors and exit
0so it can never interrupt or break a tool call or session. Exit2only when blocking is the intended behavior for that event. HOOK.mdmust document activation. Include the precisesettings.jsonblock, the event, the matcher, and the command line. Without it the hook does nothing after install.- Be safe with data. Hooks see tool inputs and outputs. Redact secret-looking fields and truncate large payloads before logging or sending anything.
- Zero or pinned dependencies. Prefer the language's standard library so the script runs anywhere it lands. State the runtime requirement.
nameis globally unique and equals the folder name, kebab-case.- Never hand-write
registry.jsonor the README catalog. Runpnpm gen. - No AI/co-author mentions anywhere in the hook or its output.
Step 1: Define the hook
- The one thing it does, in a sentence.
- The event it fires on and whether it needs a matcher (for example
PreToolUsematched toBash). Event list, matcher support, and the input/exit-code contract: reference/events.md. - Blocking or observing. Does it just record/notify (exit
0), or veto an action (exit2on the right event)?
Step 2: Scaffold it
From the repo root:
pnpm new --type hook --category <category> --name <name> --description "<what it does>"Current hook categories: academic, automation, context, observability, security, workflow (run ls hooks for the live list). Reuse one or add a new folder if justified. The scaffolder creates the folder and a HOOK.md stub and regenerates the registry; you then add the script.
Step 3: Write the hook script
Add the script alongside HOOK.md (for example <name>.mjs or <name>.sh). Contract, in brief (full detail in reference/events.md):
- The event payload arrives as JSON on stdin (
hook_event_name,tool_name,tool_input,cwd, and event-specific fields). - Exit
0= success. For most events stdout is logged; forUserPromptSubmit/SessionStartstdout is injected as context. - Exit
2= blocking error: stderr is fed back and the action is prevented (where the event supports it). - For finer control, exit
0and print a JSON object to stdout (continue,decision,hookSpecificOutput,systemMessage). - Reference the script path with
${CLAUDE_PROJECT_DIR}so it resolves regardless of working directory.
Step 4: Write HOOK.md
HOOK.md is the manifest and the documentation. Cover:
- Frontmatter
name+description(the description is the catalog/registry text). - What the hook does, its safety properties (non-blocking, redaction), and its runtime requirement.
- A Files table (script +
HOOK.md). - An Activate it section with the exact
settings.jsonblock to paste, calling out that the installer cannot do this step. Use${CLAUDE_PROJECT_DIR}in the command path. See the existingtool-call-loggerhook for the established shape.
Step 5: Regenerate and validate
pnpm gen
pnpm validateFix the source files if validation complains; never patch generated output.
Step 6: Review against the bar
- The hook does its one job and, unless it's meant to block, can never break a tool call (errors swallowed, exits
0). HOOK.mddocuments the exactsettings.jsonblock, event, and matcher.- Secret-looking data is redacted; large payloads truncated.
pnpm validatepasses and the README catalog shows the new row.
Report the hook's path, category, the event it targets, and the validation result. Leave committing to the user.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

