Rules, skills, hooks, and subagents all change agent behavior.
They do it at different times and with different failure costs.
Putting every behavior into one instruction file creates context bloat. Turning every preference into a hook creates brittle automation. Spawning a subagent for a deterministic check spends reasoning where a command would be clearer.
Use the cheapest control that can reliably do the job.
Kill the default approach
Default: place all guidance in CLAUDE.md or AGENTS.md, then add more prose when the agent drifts.
What breaks first:
- always-loaded context grows
- workflows are copied between sessions
- critical checks remain optional
- parallel agents duplicate the same work
- nobody knows which layer owns a behavior
By the end you will have
- A rules-versus-skills-versus-hooks decision table
- A subagent boundary test
- A promotion path from observation to enforcement
- A paste-ready control map
- Failure checks for each layer
Rules provide persistent context
Use a rule when the agent should know something before most matching tasks.
Examples:
- use pnpm
- generated files are outputs
- mutations require authentication
- preserve unrelated working-tree changes
- run the package-specific test command
Cursor describes rules as persistent, reusable context included for agent work. It supports project rules, user rules, and AGENTS.md. Cursor: Rules
Rules work best when they are:
- stable
- short
- scoped
- actionable
- cheaper than rediscovery
A rule should not contain a full release procedure. That belongs in a skill.
Skills package repeated workflows
Use a skill when the task has a recognizable trigger, ordered steps, supporting references, and a verification contract.
Examples:
- prepare and verify a pull request
- run a database migration review
- audit a landing-page funnel
- generate and validate an article package
- investigate a production incident
A useful skill answers:
WHEN does this run?
WHAT steps must happen?
WHAT is out of scope?
HOW is completion verified?Codex presents skills as reusable workflows the agent can keep available for repeated jobs. OpenAI Codex use cases
Do not promote a workflow after one use. Run it manually until the steps and green commands are known.
Hooks enforce event-bound behavior
Use a hook when an action at a defined lifecycle point must trigger a deterministic command or policy check.
Examples:
- scan a command before execution
- run formatting after file edits
- block secrets before commit
- require tests before a session can stop
- record a deployment receipt after success
Hooks should be small and fail clearly.
Do not hide broad business logic inside a lifecycle callback. A hook that silently changes many files or starts an unbounded loop becomes hard to inspect and recover.
For safety-sensitive operations, combine hooks with sandbox and permission boundaries. Anthropic’s Claude Code CLI exposes allowed tools, disallowed tools, permission modes, and turn limits; these controls are stronger than a reminder inside prose. Anthropic: Claude Code CLI reference
Subagents isolate reasoning or execution
Use a subagent when the job benefits from separate context, parallel execution, or a bounded specialist result.
Good uses:
- inspect a distinct package
- challenge a security assumption
- research an independent source set
- attempt an alternative implementation in an isolated worktree
- compress a large investigation into a small handoff
Poor uses:
- run one known command
- reformat a file
- repeat the parent’s analysis
- make a decision without explicit authority
- hide context overflow
Use this test:
Does the subtask have:
1. a separate artifact or evidence set?
2. a clear output contract?
3. a bounded completion condition?
4. a useful result even if the parent continues independently?If not, keep the work local.
Magnet: Agent Control Map
AGENT CONTROL MAP
RULE
Use when: stable guidance should be present before matching work.
Example: package manager, directory boundary, approval policy.
Verify: can a fresh session follow it without extra explanation?
SKILL
Use when: a repeated job has steps, references, and checks.
Example: PR review, migration, incident response.
Verify: trigger matches and all completion checks run.
HOOK
Use when: a lifecycle event must run a deterministic action.
Example: secret scan before commit.
Verify: event fires, failure blocks correctly, output is inspectable.
SUBAGENT
Use when: separate context or parallel reasoning improves the result.
Example: independent security review.
Verify: result follows a bounded output contract and is joined explicitly.
CODE OR POLICY
Use when: the behavior is a strict invariant.
Example: dependency boundary, RLS, permission denial.
Verify: the invalid state is mechanically rejected.You should see: every repeated behavior has one primary owner instead of being copied across rules, skills, hooks, and prompts.
Promote behavior through the layers
Do not start with maximum machinery.
Use this path:
observation
-> repeated manual procedure
-> rule or skill
-> hook or deterministic checkExample:
- An agent commits a generated file once. Record the observation.
- The problem repeats and the correct recovery is known. Add a scoped rule.
- Regeneration becomes a repeated workflow. Package it as a skill.
- Direct edits are always invalid. Add a check that blocks them.
Each promotion reduces ambiguity.
FAQ
Are rules and skills interchangeable?
No. Rules provide persistent or scoped context. Skills package a repeated job with steps, references, and verification.
When should a hook block the agent?
Block when the event violates a deterministic safety or quality contract, such as exposing a secret or stopping before required tests finish.
Do subagents improve every difficult task?
No. They help when context separation, parallel work, or an independent reasoning path produces a bounded result that the parent can join.
Failure modes
| Layer | Common failure | Repair |
|---|---|---|
| Rule | Too much always-loaded prose | Narrow scope and point to canonical files |
| Skill | Aspirational workflow with fake checks | Prove commands manually before packaging |
| Hook | Hidden side effects or endless retries | Keep it deterministic, bounded, and logged |
| Subagent | Duplicate analysis with no join contract | Give it separate evidence and a strict output |
| Code/policy | Overly broad enforcement | Test valid exceptions and recovery paths |
When not to use each layer
- Do not use a rule for a one-off task state.
- Do not use a skill for a procedure you have never run.
- Do not use a hook when a normal test command is enough.
- Do not use a subagent when one local tool call answers the question.
- Do not use prose when permissions or types can reject the unsafe state.
The control plane should become smaller as behavior becomes more reliable.
Your next action: fill the Agent Control Map for five existing instructions and move each one to its cheapest reliable owner.
Continue with AGENTS.md guide, Claude Code skills for beginners, and multi-agent review loops.