claudecodeguide.dev
Mental model

The seven primitives of Claude Code

Skill, Hook, Rule, Guardrail, Workflow, Agent, MCP. The docs use these terms inconsistently. Plugins ship them in bundles. Nobody quite tells you when to reach for which one. Here is the cleanest way to think about it.

The two axes that organize everything

Forget the names for a second. There are only two questions that matter.

  1. 1. Who pulls the trigger? You by typing or implying. Claude by reasoning. Or the harness automatically with no opt-out.
  2. 2. How strong is the enforcement? Advisory (Claude tries) or absolute (the harness blocks).

That is it. Every primitive falls somewhere on those two axes. Once you see them, the names stop blurring together.

The seven primitives

01

Rule

A statement of intent Claude tries to follow.

What it is
A statement in CLAUDE.md, a memory file, or a doc Claude reads. Claude tries to comply.
When it fires
Every time Claude generates text or makes a decision.
Strength
Soft. Claude can drift, especially under context pressure.
Example
"Never use em dashes in any output." Claude reads it, aims to comply, sometimes slips.
02

Hook

A shell script that fires automatically and cannot be argued with.

What it is
A script registered in .claude/settings.json that fires on tool call events (PreToolUse, PostToolUse, SessionStart, Stop). Returns exit code 2 to block.
When it fires
Automatically, on the matching tool call. The harness runs it. Claude cannot talk past it.
Strength
Absolute. If the hook blocks, the action does not happen.
Example
A pre-commit hook that blocks git clone outside designated folders. Claude tries to clone into the wrong place; the hook says no; the clone never executes.
03

Guardrail

A rule plus a hook working together.

What it is
Not a separate primitive. A useful word for the combination of a rule (states the policy) and a hook (enforces it).
When it fires
Both. The rule on every reasoning step, the hook on every matching tool call.
Strength
Combined. Rule guides intent, hook catches drift.
Example
"Don't write narrative content into the rules folder" lives in your project doc (rule). A Write/Edit hook blocks it at the file path level (hook). Together: a guardrail.
04

Skill

A self-contained, named procedure invoked on demand.

What it is
A self-contained capability with a SKILL.md file. Lives in ~/.claude/skills/, .claude/skills/, or as part of a plugin.
When it fires
Three ways: you type /skill-name, you describe a task whose words match the skill's description, or Claude infers it applies.
Strength
Mid. Triggered when relevant, skipped when not.
Example
A meeting-prep skill that pulls calendar events, attendee history, and recent emails into a brief. You say "prep me for my 3pm" and the skill fires.
05

Workflow

A multi-step orchestration that chains skills and agents.

What it is
A procedure that sequences multiple skills, agents, and tool calls toward a single outcome. Often itself implemented as a skill.
When it fires
Same as a skill (you invoke or Claude infers), but the body dispatches to other primitives.
Strength
Same as skill, with leverage from composition.
Example
A discovery-process workflow that orchestrates problem framing, then customer interviews, then synthesis, then experiment design. You invoke once; it sequences the rest.
06

Agent (subagent)

A delegated worker with its own context window.

What it is
A separate Claude instance with its own isolated context window, spawned by the main Claude. Returns a final summary; the main Claude never sees intermediate work.
When it fires
The main Claude calls the Agent tool with a prompt and a subagent_type. You ask for something heavy and Claude decides to delegate.
Strength
Token-efficient. Without subagents, heavy tasks blow your context. With them, your main thread stays light.
Example
Reviewing 30 files for cleanup candidates. Spawn an Explore subagent, get back a 200-word punch list. The 30 files never enter your main context.
07

MCP server

An external service exposed to Claude as tools.

What it is
A separate process that exposes external tools and data to Claude via the Model Context Protocol. Tools come prefixed with mcp__<server>__<tool>.
When it fires
Claude calls an MCP-prefixed tool. The MCP server translates the call into the external service's API and returns the result.
Strength
Adds entire external systems as tools without modifying Claude itself.
Example
mcp__plugin_linear_linear__list_issues lets Claude pull Linear tickets directly. Claude doesn't speak Linear's API; the MCP server does.

The decision rule (memorize this)

QuestionReach for
"I want Claude to remember a preference"Rule
"I want Claude to literally not do X"Hook
"I want both: state the policy and enforce it"Guardrail
"I want a named, repeatable procedure"Skill
"I want to chain multiple skills or agents"Workflow
"I want heavy work to not blow context"Agent (subagent)
"I want Claude to talk to Jira / Slack / Linear / etc."MCP server

The triggers cheat sheet

PrimitiveWho pulls the trigger?Can Claude opt out?
RuleClaude (every reasoning step)Yes (drifts under pressure)
HookHarness (every matching tool call)No
GuardrailBothNo (the hook half)
SkillYou or Claude (by name match)Yes
WorkflowYou or ClaudeYes
AgentClaude (delegates)Yes
MCP serverClaude (calls the tool)Yes

The kitchen analogy

Stop thinking about Claude Code as software for a second. Think of your workspace as a kitchen.

  • RulesRecipes pinned to the fridge.
  • HooksThe smoke detector. Doesn't matter how much you wave a towel; if the alarm goes, dinner stops.
  • GuardrailsRecipes pinned next to a smoke detector calibrated for that exact dish.
  • SkillsKitchen tools you grab when needed: a whisk, a chef's knife, a thermometer.
  • WorkflowsThe cooking sequence: prep, sear, deglaze, plate. Several tools used in order.
  • AgentsSous chefs you can hand a sub-task to so you can keep working on the main dish.
  • MCP serversThe supply lines: the butcher, the produce supplier, the wine importer. Claude doesn't grow tomatoes; the MCP delivers them.

The kitchen runs because all seven do their job, and you (the owner) don't have to do any of them yourself.

Where most people get this wrong

Mistake 1

Using a rule when you need a hook

"I told Claude not to push to main without my approval." That's a rule. Claude will follow it 95% of the time. The 5% it doesn't, you lose work. If the cost of failure is high, write a hook.

Mistake 2

Using a skill when you need a workflow

A skill that does five different things is a workflow pretending to be a skill. Split it. One skill per atomic capability. Compose them in a workflow.

Mistake 3

Doing in the main thread what an agent should do

If your task touches more than three files, or requires research, or is going to read 20 different things to find one answer, spawn an agent. The token economy of a long Claude Code session is decided more by subagent discipline than by anything else.

The takeaway

You don't need to memorize every flag and every config option. You need to know which of seven primitives fits the job, and the kitchen analogy gives you a fast mental model for that.

When in doubt, ask the one question: who do I want pulling the trigger, and how strongly do I want it enforced? The right primitive falls out.

Ready to try it?

See what each primitive looks like in production, or browse the full capability catalog.