Claude Code Skills vs Subagents vs Slash Commands: Which When?
When to use Claude Code skills, slash commands, subagents or plan mode: scope rules, SKILL.md frontmatter, a comparison table and a decision flow.
Claude Code gives you several ways to package repeatable work: slash commands, skills, subagents, and plan mode. They overlap, and Domain 3 questions often hinge on picking the right one. Here is what each does, where it lives, and a decision path for exam day.
Custom slash commands and skills: project vs personal scope
A custom slash command is a Markdown file whose body becomes the prompt when you type /name. A skill is a directory with a SKILL.md file that can also hold supporting files, and Claude can load it automatically when its description matches the task.
Scope is decided by where the file lives:
| Scope | Commands | Skills | Who gets it |
|---|---|---|---|
| Project | .claude/commands/ | .claude/skills/<name>/SKILL.md | Everyone who clones the repo (version-controlled) |
| Personal | ~/.claude/commands/ | ~/.claude/skills/<name>/SKILL.md | Only you, in every project |
A shared team /review command goes in the project's .claude/commands/ and gets committed. A personal variant goes in ~/.claude/skills/ under a different name so teammates are unaffected.
Current docs say custom commands have been merged into skills: .claude/commands/deploy.md and .claude/skills/deploy/SKILL.md both create /deploy. The exam guide treats them as two related features, which still works as a model.
SKILL.md frontmatter the exam cares about
---
name: analyze-deps
description: Map dependencies of a module and summarize risky imports
argument-hint: "<module-path>"
context: fork
allowed-tools: Read, Grep, Glob
---
Analyze the dependencies of $ARGUMENTS and return a short summary...
context: forkruns the skill in an isolated subagent context, so long output (codebase analysis, brainstormed alternatives) stays out of the main conversation. Only the result comes back.allowed-toolslimits or pre-approves which tools the skill uses while it runs, for example read-only tools for an analysis skill.argument-hintshows the expected parameters when someone invokes the skill without arguments.
Skills vs CLAUDE.md: CLAUDE.md is always loaded and holds universal standards; a skill loads on demand for one workflow. See CLAUDE.md hierarchy and rules.
Subagents: isolated context, explicit handoff
A subagent runs in its own context window with its own system prompt and tools. It does not see the coordinator's history or share memory with other subagents. Whatever it needs goes in its prompt. That drives several exam answers:
- Pass findings explicitly. A synthesis subagent needs earlier search results and document analysis in full in its prompt. Keeping content separate from metadata (source URL, page) preserves attribution.
- The coordinator needs the Task tool. Subagents are spawned through the Task tool, so a coordinator's
allowedToolsmust include"Task". Claude Code has since renamed itAgent, withTaskkept as an alias; the exam says Task. - Parallelism happens in one response. The coordinator emits several Task calls in a single turn, not one per turn.
- Give goals, not scripts. State the goal and quality bar; let each subagent decide how.
Subagent definitions live in .claude/agents/ (project) or ~/.claude/agents/ (personal), with a description, system prompt and tool restrictions for each type.
Plan mode vs direct execution, and the Explore subagent
Plan mode lets Claude read and investigate the codebase and propose a plan before it edits anything. Use it when the task involves:
- many files (a library migration touching 45+ files),
- architectural decisions (restructuring a service),
- several valid approaches with different trade-offs.
Use direct execution for small, clear changes: a single-file fix with a stack trace, or one added validation check. The two combine well: plan the migration, agree on the approach, then execute directly.
The built-in Explore subagent is read-only and built for discovery. Send a heavy search phase to Explore; it returns a summary, so the main context doesn't fill with file dumps. See managing long context.
Which one when: comparison table and decision flow
| Need | Use | Why |
|---|---|---|
| Team-wide repeatable prompt | Project slash command or skill | Committed, everyone gets it |
| Personal shortcut | ~/.claude/skills/ | Doesn't affect teammates |
| Verbose analysis you don't want in main context | Skill with context: fork, or a subagent | Isolated context, summary returned |
| Independent parallel research | Subagents via Task, all in one response | Separate contexts, concurrent |
| Large or architectural change | Plan mode, then direct execution | Explore and design before editing |
| Well-scoped fix | Direct execution | Planning adds nothing |
| Rules for every task | CLAUDE.md | Always loaded |
flowchart TD
A[New task] --> B{Rule that applies to every task?}
B -- Yes --> C[CLAUDE.md]
B -- No --> D{Repeatable workflow?}
D -- Yes --> E{Shared with team?}
E -- Yes --> F[Project command or skill in .claude/]
E -- No --> G[Personal skill in ~/.claude/]
D -- No --> H{Multi-file or architectural?}
H -- Yes --> I[Plan mode, then execute]
H -- No --> J{Verbose discovery or parallel work?}
J -- Yes --> K[Explore or other subagents]
J -- No --> L[Direct execution]
Try it
A coordinator agent spawns a synthesis subagent after two research subagents finish. The synthesis output keeps saying "no sources were provided," even though the research subagents returned detailed findings. What is the most likely fix?
A. Give the synthesis subagent the same allowedTools as the research subagents.
B. Include the research subagents' complete findings directly in the synthesis subagent's prompt.
C. Run all three subagents in the same turn so they share memory.
D. Enable context: fork on the coordinator so the subagent inherits its context.
Answer: B. Subagents do not inherit the coordinator's context. If the synthesis step needs the findings, the coordinator has to pass them in the prompt.
- A changes what the subagent can do, not what it knows. Tools don't carry earlier results.
- C confuses parallel execution with shared state. Subagents launched together are still isolated.
- D misapplies a skill frontmatter option.
context: forkisolates a skill from the main conversation; it is not a way to share coordinator context with a subagent.
Key takeaways
- Project scope (
.claude/) is shared through version control; personal scope (~/.claude/) is yours alone. context: fork,allowed-toolsandargument-hintare the SKILL.md options to know.- Subagents start with a clean context. Pass everything they need in the prompt, and allow the Task tool on the coordinator.
- Plan mode for large, multi-file or architectural work; direct execution for a clear, small fix.
- Use the Explore subagent to keep verbose discovery out of the main conversation.
Frequently asked questions
A mode where Claude investigates the codebase and proposes a plan without editing files. You review the plan, then let it execute. It fits large or ambiguous changes.
A skill is a packaged prompt or workflow, invoked by you or loaded by Claude when relevant. A subagent is a separate Claude instance with its own context and tools. A skill with context: fork runs inside a subagent, which is where the two meet.
Related reading: the agentic loop and workflow vs agent and when an agent should escalate to a human. Review the Domain 3 lessons to lock in these choices.