Claude Code Hooks vs Skills: Enforce or Instruct
A hook runs because an event happened. A skill runs because the workflow needs it. Put hard enforcement in hooks and repeatable judgment in skills.
The answer
Use a hook for a rule that must run automatically at a known event.
Use a skill for a repeatable procedure that needs instructions, context, or judgment.
If failure would make the result unsafe, do not rely on the agent remembering a skill. Put the mechanical guard in a hook.
Hooks enforce events
Claude Code hooks attach commands or handlers to lifecycle events. The official hooks guide documents events before and after tool calls, prompts, and session actions.
Use a hook for actions such as:
- block a write to a protected path;
- format a changed file after a write;
- record tool use in an audit log;
- reject a dangerous command before execution;
- run a fixed check when a task ends.
A hook does not need the model to remember a sentence. The event activates the hook.
This makes hooks suitable for deterministic controls. Keep each hook fast, narrow, and explicit about failure.
Skills guide workflows
Claude Code skills package reusable instructions and supporting files. The official skills documentation explains how Claude discovers and invokes them.
Use a skill for work such as:
- review a change against a project rubric;
- prepare a release with several conditional checks;
- diagnose a failure using a known evidence order;
- create an artifact from a standard template.
These tasks need judgment. A command alone cannot decide which evidence matters or which branch to follow.
Use this decision table
| Requirement | Choose | Reason |
|---|---|---|
| Must run at a tool event | Hook | The lifecycle event activates it |
| Needs judgment across steps | Skill | The skill supplies procedure and context |
| Must block one unsafe action | Hook | Enforcement should not depend on recall |
| Must create a standard deliverable | Skill | The output contract belongs with the workflow |
| Needs both | Hook plus skill | The skill guides; the hook guards |
Claude Code’s features overview draws the same functional boundary: hooks provide deterministic lifecycle control, while skills provide reusable expertise.
Do not turn every rule into a hook
Hooks can make a session slow or brittle when they contain too much policy.
A hook should answer one event-level question. For example: “May this command run?” or “Did this file pass formatting?”
A skill can hold the larger reasoning process. For example: “Which release checks apply to this change?”
Do not place a full editorial guide inside a command hook. Do not place a non-negotiable deletion guard only inside prose.
A combined example
Consider a deployment workflow.
- The skill checks the branch, tests, migration risk, and release notes.
- A pre-tool hook blocks deployment from an unapproved branch.
- A post-tool hook records the deployment result.
- The skill produces the final release report.
The skill owns the procedure. The hooks own fixed control points.
The default choice
Start with a skill for a new workflow. It is easier to inspect and refine as the procedure changes.
Add a hook only when you can name the exact lifecycle event and the exact automatic response. This keeps enforcement small and predictable.
For repository instruction scope, read AGENTS.md vs CLAUDE.md. For external capabilities, read MCP vs skills. The existing Claude Code hooks cost guide covers a separate token-use decision.
Need OpenClaw fixed live?
Remote rescue sessions for gateway, auth, tunnel, VPS, and model access problems.
See Rescue Session