D3 · Claude Code › Cluster 7 · Subagents

7.5 · Subagents vs Skills vs Commands

When to reach for each

CONCEPT Three ways to package behaviour — one axis separates them

Subagents, skills, and slash commands all extend Claude Code, but they differ on two questions: who invokes it and which context window it runs in.

MechanismInvoked byRuns inAdds
SubagentClaude (auto-delegate) or you (explicit)Its own isolated context windowContext isolation + tool restriction + optionally a different model
SkillClaude (model-invoked)The same (main) context windowReusable prompts / workflows / instructions in-context
Slash commandYou (typed /name)The same (main) context windowA user-triggered, reusable prompt
🔑 The distinguishing feature of a subagent is context isolation — plus the ability to restrict tools and pick a different model. Skills and commands run in the same context as your conversation.

CONCEPT Choosing between them

The official guidance is direct: consider a Skill instead of a subagent when you want reusable prompts or workflows that run in the main conversation context rather than in an isolated subagent context. So:

Rule of thumb: need a clean context window and/or tool & model control → subagent. Need a model-invoked capability that shares context → skill. Need a user-triggered prompt → command.

DIAGRAM A decision path

flowchart TD Q1{"Do you want the work in a
SEPARATE context window?
(or restrict tools / model)"} Q1 -->|"yes"| SUB["🟢 Subagent
isolated context + tool/model control"] Q1 -->|"no — keep shared context"| Q2{"Who should trigger it?"} Q2 -->|"Claude, on its own"| SKILL["🔵 Skill
model-invoked, same context"] Q2 -->|"You, by typing /name"| CMD["🟣 Slash command
user-invoked prompt, same context"] classDef ok fill:#d4edda,stroke:#28a745,color:#155724; classDef skill fill:#e7f1ff,stroke:#4a90d9,color:#1a3a5a; classDef cmd fill:#efe3fb,stroke:#9b59b6,color:#5b2a86; class SUB ok; class SKILL skill; class CMD cmd;

CODE Same idea, three packagings

A "code review" capability, expressed each way — note where each lives and who fires it.

# SUBAGENT — .claude/agents/code-reviewer.md
# Claude delegates when the task matches; runs in its OWN context.
---
name: code-reviewer
description: Expert code reviewer. Use proactively after code changes.
tools: Read, Grep, Glob
---
You are a senior code reviewer...

# SKILL — model-invoked, runs in the MAIN context (shares your conversation)
# SLASH COMMAND — you type /review to fire a reusable prompt in the MAIN context
⚠️ Same wording ("review my code") can trigger different mechanisms. The material difference is where it runs: a subagent isolates it; a skill and a command keep it in your conversation.

TRADE-OFFS Isolated subagent vs. in-context skill/command

✅ Subagent (isolated)

  • Keeps verbose work out of the main window
  • Can restrict tools and pin a different model
  • Independent permissions per agent

⚠️ Skill / command (shared context)

  • Full shared context — no re-explaining the situation
  • Lower latency; no fresh-start context gathering
  • But verbose output lands in your main conversation

EXAM TRAPS

Trap: "Skills and subagents are the same thing." → A skill is model-invoked and runs in the same context; a subagent runs in an isolated context window and adds tool restriction and optional model choice. Different context is the key distinction.
Trap: "Slash commands and subagents are interchangeable." → A slash command is a user-invoked prompt that runs in the main context. A subagent is delegated (auto or explicit) and runs in its own context.
Trap: "Use a subagent for any reusable prompt." → If you just want a reusable prompt or workflow in the main conversation context, the docs point you to a Skill instead. Subagents are for isolation / tool / model control.
Trap: "Only subagents can restrict tools or change the model." → That combination — context isolation + tool restriction + optionally a different model — is exactly what a subagent adds over a skill or command. That's the reason to pick one.

PRACTICE

Q1 · What is the defining difference between a subagent and a skill?

A subagent runs in its own isolated context window (and can restrict tools / use a different model); a skill is model-invoked and runs in the same context as the main conversation.

Q2 · You want a reusable workflow that stays in the main conversation. Which mechanism?

A Skill — the docs specifically recommend a skill over a subagent when you want reusable prompts/workflows in the main context rather than isolated subagent context.

Q3 · What does a subagent add over a slash command?

Context isolation (its own window), tool restriction, and optionally a different model. A slash command is a user-invoked prompt that runs in the main context with no isolation.