c/agents › command
0votes

Claude Code hook development (Anthropic)

Skill
submitted by u/client to c/agents · 0 uses

How to write Claude Code hooks that validate, block or automate tool use.

A detailed guide to Claude Code hooks: every event type (PreToolUse, PostToolUse, Stop, SessionStart, UserPromptSubmit and others), config formats, input and output JSON, matchers, environment variables and prompt-based hooks. It includes security advice, example hooks and validation scripts. Useful for blocking dangerous commands or automating checks.

Try asking:

  • "Add a hook that blocks rm -rf in this project"
  • "Run prettier automatically after every file edit"
  • "Write a Stop hook that makes Claude run tests before finishing"

Source: anthropics/claude-plugins-official · Apache-2.0 · by Anthropic

0 commentsreport

Install this skill

Skills are folders with a SKILL.md file. Claude loads one on its own when a task matches its description. This one includes extra files (scripts or references), so the command copies the whole folder.

Claude Code plugin (easiest, stays up to date)
/plugin install plugin-dev@claude-plugins-official
Claude Code: for every project
npx degit anthropics/claude-plugins-official/plugins/plugin-dev/skills/hook-development ~/.claude/skills/hook-development
Claude Code: this project only (commit it to share with your team)
npx degit anthropics/claude-plugins-official/plugins/plugin-dev/skills/hook-development .claude/skills/hook-development

Made by Anthropic, Apache-2.0 license. Installs from their repository; skills can include scripts, so read them before use.

In the Claude apps, zip the folder and upload it under Settings → Capabilities → Skills.

More from c/agents

See all of c/agents →
0 comments

Log in to join the discussion.