B5.3Bloom · ENot started

Route rule (CLAUDE.md / reference / skill / slash / hook)

Reading depth

What you'll learn

Pick by invocation model and trust: always-on advice → CLAUDE.md; on-demand by user → slash or skill; deterministic enforcement → hook; on-demand reference → reference/.

  • Decision axes: invocation frequency, trust requirement, instructions vs capability.
  • CLAUDE.md = always-on advice. reference/ = on-demand context. Skill = user-invoked instructions. Slash = user-invoked one-shot. Hook = harness-enforced.
  • Hard rules and automation → hook. Always-on advice → CLAUDE.md. On-demand workflow → slash or skill.

Claude Code offers many places to put rules and behaviour: CLAUDE.md, files in `reference/`, Skills, slash commands, and hooks. Picking the right one is one of the most-tested judgement skills in Domain 2 because each mechanism has a *different invocation model and trust level*. Putting a rule in the wrong place produces a predictable failure: the rule silently doesn't apply, or it applies too aggressively, or it can be ignored when it shouldn't be.

The decision axes are: (1) **how often does the rule need to apply?** Always (every turn) → CLAUDE.md. On demand (when the user invokes) → slash command or skill. On a specific event (before tool, after task, on session start) → hook. (2) **how much do you trust the model to follow it?** Soft (advice; OK if the model interprets) → CLAUDE.md or memory. Hard (must execute regardless of model decision) → hook (only the harness can guarantee). (3) **does it carry instructions or capabilities?** Instructions only → skill or CLAUDE.md. Capability → tool / MCP server.

The mechanisms in one line each: **CLAUDE.md** = always-on project memory, advisory, model interprets. **`reference/`** = on-demand context the model can `@`-include when relevant; not loaded by default. **Skill** = user-invoked named instruction-bundle, packaged for distribution and discoverability. **Slash command** = user-invoked one-shot prompt expansion (per-project or personal). **Hook** = harness-executed lifecycle action, deterministic, model can't override.

Common miswires: putting an automation rule ('every time you finish a task, run lint') in CLAUDE.md instead of a Stop hook (model can interpret/forget; the rule isn't enforced). Putting a guardrail ('never run rm -rf') as a CLAUDE.md instruction (model can be argued out of it; it must be a PreToolUse hook). Putting an always-on style guide in a Skill (skills don't auto-load; it should be CLAUDE.md). Putting a one-off team workflow as a hook (heavy machinery for what should be a slash command).

Key points

  • Decision axes: invocation frequency, trust requirement, instructions vs capability.
  • CLAUDE.md = always-on advice. reference/ = on-demand context. Skill = user-invoked instructions. Slash = user-invoked one-shot. Hook = harness-enforced.
  • Hard rules and automation → hook. Always-on advice → CLAUDE.md. On-demand workflow → slash or skill.
  • Instructions are not the same as capabilities. Capabilities go in tools / MCP.

Examples

'Always reject any rm -rf shell command'

Hard rule, must execute regardless of model decision = hook (PreToolUse). CLAUDE.md is wrong because the model can be argued out of it. Skill is wrong because skills are user-invoked, not always-on.

'After every finished task, run npm run lint and report'

Automation, per-task granularity = hook (Stop). CLAUDE.md is wrong (advisory). Slash command is wrong (requires user to invoke each time). The user's words 'after every task' = harness, not model.

'Project style guide for all code suggestions'

Always-on advice the model interprets = CLAUDE.md. Skill is wrong (skills don't auto-load). Hook is wrong (not enforced behaviour, just guidance).

'Weekly release-notes workflow team can invoke'

User-invoked, multi-step, parameterised = slash command (or Skill if you want discoverability + assets). Hook is wrong (no event trigger). CLAUDE.md is wrong (not always-on).

Pitfalls

  • Putting hard rules in CLAUDE.md. The model interprets; it can't be relied on for enforcement.
  • Putting always-on rules in a Skill. Skills don't auto-load; the rule won't apply silently.
  • Putting per-task automation in CLAUDE.md or memory. Both are advisory; only the harness can guarantee execution.
  • Reaching for a hook for an on-demand workflow. Hooks fire on events; on-demand work is what slash commands and skills are for.

Source notes: 00-academy-basics/notes/03-claude-code-101.md

Ask Claude

Build a prompt with this lesson + your question, copy it, and open the Claude Project in a new tab.