Workflow

Hooks, Subagents, Skills or CLAUDE.md: Which One for Which Job

Published Updated 4 min readBy Vibe Coding Intel editorial

Compiled from official docs and public sources, checked .

The short answer: use a hook when something must happen every single time, a subagent when a side task would flood your conversation, a skill when you keep pasting the same procedure or reference, and CLAUDE.md for short rules that apply to everything. The line people miss is guarantee versus request: Anthropic’s docs describe hooks as deterministic, while instructions in CLAUDE.md or a skill are things Claude interprets, so “never edit .env” belongs in a hook if it truly must hold.

The decision table

Compiled from Anthropic’s documentation, checked 29 September 2026.

AttributeCLAUDE.mdSkillSubagentHook
What it isStanding instructionsInstructions or a workflow in a SKILL.mdAn isolated worker with its own contextA command, HTTP call, prompt or agent run on a lifecycle event
Where it livesProject root, and nested folders.claude/skills/<name>/SKILL.md (project) or ~/.claude/skills/<name>/SKILL.md (personal).claude/agents/ (project) or ~/.claude/agents/ (user)A hooks block in .claude/settings.json or ~/.claude/settings.json
Guaranteed to run?No, advisoryNo, Claude interprets itNo, Claude decides to delegate (or you name it)Yes, fires on its event
Context costFull file, every requestDescription each session; body only when usedIts own window; only a summary returnsNone, unless the hook prints output
Invoked byAutomatically/name, or Claude matches the descriptionNamed in the prompt, an @-mention, or claude --agent nameThe event itself
Best forBuild commands, conventionsRepeatable playbooks, referenceBig searches, parallel work, reviewsFormatting, blocking, logging, notifications

Job by job

The jobUseWhy, per the docs
Run Prettier or ESLint after every editHook on PostToolUse with an Edit|Write matcherIt must run every time, and it needs no thinking
Block writes to a folder such as migrationsHook on PreToolUseThat event “can block” the tool call; a rule in prose is only a request
Get a desktop notification when Claude needs inputHook on NotificationDocs give macOS, Linux and Windows commands
Re-inject key facts after context compactionHook on SessionStart with a compact matcherText the hook prints lands in Claude’s context
Stop Claude ending a turn until tests passHook on StopRuns your check as a script and can block finishing
“Always use pnpm, run tests before committing”CLAUDE.mdShort, universal, worth the every-request cost
A release or deploy checklist you trigger by handSkill with disable-model-invocation: trueLoads only when you type /name, and Claude cannot fire it on its own
An API style guide Claude needs sometimesSkillCosts almost nothing until used
Read forty files to answer one questionSubagentWork stays out of your main context
Independent review of a diffSubagentFresh context, so it is not biased by the reasoning that wrote the code

Details worth knowing before you build one

Hooks. Events include SessionStart, PreToolUse, PostToolUse, PostToolUseFailure, SubagentStop and Stop. Most hooks are type: "command"; http, prompt and agent types also exist, with agent hooks flagged experimental. When several hooks match one event they all run, so one hook denying an action does not stop side effects in another. Claude can write hooks for you if you describe them, and /hooks lists what is configured.

Subagents. Only name and description are required in the frontmatter; tools, model, skills, permissionMode, maxTurns and isolation: worktree are optional. Claude Code ships built-in Explore, Plan and general-purpose agents. Subagents can spawn their own down to a default depth of three layers.

Skills. Custom commands have been merged into skills: .claude/commands/deploy.md and .claude/skills/deploy/SKILL.md both create /deploy. If a skill exists at more than one level, enterprise beats personal and personal beats project. Skills in personal folders are not read by cloud sessions or routines.

Build them in order of pain. Anthropic’s advice is to add each extension when a trigger appears, not up front: a repeated mistake goes into CLAUDE.md, a repeated prompt becomes a skill, a noisy side task becomes a subagent, and a “must always” becomes a hook.

The setup steps for the tool itself are in how to use Claude Code; writing the CLAUDE.md side well is in CLAUDE.md best practices; and Cursor’s counterpart to standing instructions is Cursor rules. The connection layer is covered in Claude Code MCP servers.

Method

Researched from Anthropic’s Claude Code documentation on 29 September 2026. We have not built and timed these setups, so nothing here measures how reliably Claude follows a skill or delegates to a subagent. Version details change quickly; the docs are the reference. Re-checked every 60 days.

Common questions

Should a rule go in CLAUDE.md or a hook?

If Claude ignoring it once is acceptable, CLAUDE.md. If it must hold every time, a hook.

Do hooks use up my context window?

Not by default. A hook costs nothing unless it prints output that gets added to the conversation.

Can a skill run in isolation like a subagent?

Yes: Anthropic’s extension docs say a skill can run in an isolated context with context: fork, and a subagent can preload skills.

Sources

Update log

  1. New page. File locations, event names, frontmatter fields and context costs read on Anthropic's hooks, subagents, skills and extension docs.