Skip to content

Claude Code hooks vs skills: what each does and when to use it

By the Toolbay team · Checked against the sources below on

Use a hook when something must happen every time, like formatting each edited file or blocking edits to .env: Claude Code runs it whether or not the model remembers. Use a skill when the agent needs to know how to do a job: it is guidance the model loads when a task matches. Many good setups pair the two.

Hooks and skills compared (Claude Code docs, checked 2026-11-24)
HookSkill
What it isA shell command run at a fixed eventA folder with SKILL.md instructions
Who decides it runsClaude Code, every time the event firesThe model, when the task matches the description (or you, with /skill-name)
Can it block an actionYes: exit code 2 on PreToolUse blocks the tool callNo; it can only advise
Where it lives.claude/settings.json, ~/.claude/settings.json, a plugin's hooks/hooks.json, or skill frontmatter.claude/skills/ or ~/.claude/skills/
Context costNone unless it prints feedbackName and description always; full text when used
Works in other agentsClaude Code's own formatOpen standard: Cursor, Codex and others read SKILL.md

Choose a hook when

  • A rule must never be broken: protected files, a formatter, a lint step.
  • You want a check before Claude stops: a Stop hook that exits with code 2 keeps Claude working and sends your message back.
  • You want a side effect: a desktop notification when Claude needs input.

Choose a skill when

  • The task needs judgement and steps: a code review checklist, a release process, a migration recipe.
  • The same know-how should work in Cursor and Codex too.
  • It is long, and you do not want it in context for every task.

Use both

A skill can declare hooks in its frontmatter; they register when the skill is invoked and keep running for the rest of the session. Plugins can ship skills and a hooks/hooks.json together, so one install sets up the teaching and the enforcement.

When a skill or vault helps, and when it does not

Helps

  • A skill teaches a procedure the agent does not know; a bundled hook makes sure the critical step happens.
  • A packaged pair saves writing the scripts yourself.

Does not help

  • If you only need enforcement, a hook alone is simpler than any skill.
  • Review hooks before enabling them: they run commands with your permissions.