3.2 Custom Slash Commands & Skills
3.2.1 The On-Demand Layer
Lesson 3.1 gave you the always-on layer: CLAUDE.md, loaded every session. But not everything should be always-on. Some things are workflows you run occasionally — a code-review checklist, a brainstorming routine, a deploy sequence. Loading those into every session would waste context on instructions you only need now and then. Task Statement 3.2 is about the ON-DEMAND layer: custom slash commands and skills, which package a workflow you invoke when you want it.
The mental model: CLAUDE.md is the standing rules posted on the office wall — always visible. A skill is a recipe card in a drawer — you pull it out exactly when you're cooking that dish, and it's not cluttering the wall the rest of the time. Both store instructions, but one is always in context and one loads only when invoked.
A useful simplification up front: in Claude Code, custom slash commands and skills have been MERGED into one framework. A file at .claude/commands/deploy.md and a skill at .claude/skills/deploy/SKILL.md both give you a /deploy command. So when this lesson says 'skill,' the same scoping and invocation ideas apply to commands too. Let's cover where they live, how to configure them, and when to choose a skill over CLAUDE.md.
CLAUDE.md is the always-on wall poster; a skill is a recipe card you pull out on demand. Use each for what it's suited to — universal standards vs occasional workflows.
The one idea to hold onto
Skills (and custom commands, now merged with them) package task-specific workflows that load ON DEMAND when invoked — unlike CLAUDE.md, which is always-on. Use skills for occasional procedures so they don't clutter every session's context.
3.2.2 Where They Live: Project vs User Scope
Just like CLAUDE.md, commands and skills are scoped by WHERE you put them — and it's the same project-vs-user split from Lesson 3.1, so the intuition carries straight over.
PROJECT scope: a command in .claude/commands/ or a skill in .claude/skills/ lives in the repository, so it's shared with the whole team via version control. This is where a team-wide /review command belongs — commit it, and every developer gets it on clone or pull. USER scope: the same things in ~/.claude/commands/ or ~/.claude/skills/ are personal to you, available across all your projects but not shared with teammates. This is where your personal /brainstorm skill belongs.
The exam's most direct 3.2 question is exactly this: you want a /review command available to every developer when they clone or pull the repo — where do you put it? Answer: .claude/commands/ in the project (version-controlled, shared). Not ~/.claude/commands/ (that's personal), not CLAUDE.md (that's for instructions/context, not command definitions), and definitely not a fictional '.claude/config.json with a commands array' — that doesn't exist. Same scoping logic as CLAUDE.md: project = team, user = personal.
| Scope | Location | Use for |
|---|---|---|
| Project | `.claude/commands/` or `.claude/skills/` | Team-wide commands (e.g. /review) — committed to git |
| User | `~/.claude/commands/` or `~/.claude/skills/` | Personal commands (e.g. /brainstorm) — across your projects |
Project scope shares commands/skills with the team via version control; user scope keeps them personal. The team /review goes in .claude/commands/.
3.2.2 — Key Concept
Project-scoped commands/skills (.claude/commands/ or .claude/skills/) are shared with the team via version control; user-scoped (~/.claude/...) are personal. A team-wide command like /review goes in the PROJECT directory — not user scope, CLAUDE.md, or a nonexistent config.json.
3.2.3 Configuring a Skill: The Three Frontmatter Options
A skill is a SKILL.md file, and the top of that file holds frontmatter — configuration that shapes how the skill runs. The exam highlights three options, each solving a specific problem.
context: fork runs the skill in an ISOLATED subagent context (recall Domain 1's subagents). Why? Because some skills produce a lot of verbose output — a codebase-analysis skill might read dozens of files, or a brainstorming skill might generate pages of alternatives. Without isolation, all that noise pollutes your main conversation. With context: fork, the skill does its messy work in a separate context and returns only the result — keeping your main session clean. It's the same context-isolation benefit subagents gave you, now available to a skill.
allowed-tools is a SECURITY boundary: it restricts which tools the skill may use while it runs. A brainstorming skill should probably be read-only — give it Read but not Write or Bash, and it cannot accidentally modify or delete anything. argument-hint solves a usability problem: if a skill needs parameters and you invoke it without them, the hint prompts you for what's required, so you're not left guessing what the command expects.
| Frontmatter option | Problem it solves | Example |
|---|---|---|
| context: fork | Verbose skill output pollutes the main context | A codebase-analysis or brainstorm skill runs isolated |
| allowed-tools | A skill could take unsafe actions | Read-only brainstorm skill: Read but no Write/Bash |
| argument-hint | User invokes without required params | Prompt for the parameter the skill needs |
Three frontmatter levers: context: fork isolates verbose output, allowed-tools sets a security boundary, argument-hint prompts for parameters.
3.2.3 — Key Concept
Three key skill frontmatter options: context: fork (run in an isolated subagent so verbose output doesn't pollute the main context), allowed-tools (restrict the skill's tools — a security boundary), and argument-hint (prompt for required parameters when invoked without them).
3.2.4 Skill or CLAUDE.md? Making the Right Choice
The most important judgment in this lesson — and a recurring exam theme — is choosing between a skill and CLAUDE.md. They're not interchangeable, and the deciding question is simple: is this ALWAYS relevant, or only relevant for a specific task?
CLAUDE.md is for ALWAYS-LOADED universal standards — the conventions and facts that should apply to everything Claude does in the project ('we use 2-space indentation', 'API handlers live in src/api'). A skill is for ON-DEMAND task workflows — a procedure Claude should follow only when doing that particular task (a deploy sequence, a review checklist). Put a multi-step task procedure in CLAUDE.md and you waste context on it every session even when you're not doing that task; put always-on reference in a skill and Claude won't have it when it's needed because the skill isn't invoked.
How does a skill get invoked? Two ways: you type its command (/review), OR Claude auto-invokes it when your request matches the skill's description (this is why a good description matters, echoing the tool-description lesson 2.1). For a personal twist that doesn't disturb teammates, create a personal VARIANT of a skill in ~/.claude/skills/ with a DIFFERENT name — your customization lives alongside, without overriding the shared one.
3.2.4 — Key Concept
Choose by relevance: CLAUDE.md for always-loaded universal standards; a skill for on-demand task workflows. Don't put task procedures in CLAUDE.md (wastes context every session) or always-on reference in a skill (won't be loaded unless invoked).
3.2.5 The Exam Traps
The 3.2 traps test scope (project vs user), the skill-vs-CLAUDE.md choice, and the frontmatter options. Keep the project/user split and the always-on/on-demand distinction crisp.
- •Wrong scope for a team command. ✗ Putting a team /review in ~/.claude/commands/ (personal). ✓ .claude/commands/ in the project, committed to git.
- •Skills as always-on guidance. ✗ Using a skill for universal standards Claude needs every session. ✓ That's CLAUDE.md; skills load on demand.
- •Task procedures in CLAUDE.md. ✗ Putting a multi-step deploy procedure in CLAUDE.md (wastes context). ✓ Make it a skill, invoked when deploying.
- •Not isolating verbose skills. ✗ A codebase-analysis skill dumping output into the main context. ✓ Use context: fork to run it isolated.
3.2.5 — Exam Trap
✗ Team command in user scope (~/.claude). ✗ A skill used as always-on guidance. ✗ A task procedure parked in CLAUDE.md. ✗ A verbose skill without context: fork. ✗ A fictional '.claude/config.json with a commands array.' ✓ Team commands in .claude/commands/, skills for on-demand workflows, context: fork to isolate verbose output.
3.2.6 Put It Together: Build a Team Command and a Personal Skill
You now understand the on-demand layer: where commands/skills live, the three frontmatter options, and when to choose a skill over CLAUDE.md. The exercise builds one of each and exercises the frontmatter that the exam highlights.
3.2.6 — Build Exercise (30 min)
(1) Create a team /review command in .claude/commands/ that runs your review checklist; commit it and confirm a fresh clone gets it. (2) Create a personal /brainstorm skill in ~/.claude/skills/ with context: fork (so its exploration stays out of the main context), allowed-tools restricted to read-only, and an argument-hint. (3) Verify the brainstorm skill can't modify files (allowed-tools boundary) and that invoking it without args prompts you (argument-hint). (4) Take a multi-step procedure you'd been tempted to put in CLAUDE.md and convert it to a skill; note the context you save every session.
CLAUDE.md (always-on) and skills (on-demand) are two of the three configuration layers. The third — conditional, path-based loading — is the next lesson, 3.3: rules that load only when Claude touches certain files.
Where this shows up on the exam
3.2 questions ask where to put a team command (→ .claude/commands/), when to use a skill vs CLAUDE.md (on-demand vs always-on), or which frontmatter solves a problem (context: fork for verbose output, allowed-tools for safety, argument-hint for params).
Key Takeaways
- ✓Skills (and custom commands, now merged into one framework) package task-specific workflows that load ON DEMAND when invoked — unlike CLAUDE.md, which is always-on.
- ✓Both .claude/commands/deploy.md and .claude/skills/deploy/SKILL.md create a /deploy command; scoping and invocation ideas apply to both.
- ✓Project scope (.claude/commands/ or .claude/skills/) shares with the team via version control; user scope (~/.claude/...) is personal — a team /review goes in the project directory.
- ✓Three key skill frontmatter options: context: fork (run isolated so verbose output doesn't pollute the main context), allowed-tools (restrict tools — a security boundary), argument-hint (prompt for required params).
- ✓Choose by relevance: CLAUDE.md for always-loaded universal standards; a skill for on-demand task workflows — don't swap them (wastes context, or the instructions aren't loaded when needed).
- ✓Skills are invoked by typing the command OR auto-invoked when a request matches the skill's description (so a good description matters, echoing tool design 2.1).
- ✓For personal tweaks without affecting teammates, create a personal skill VARIANT in ~/.claude/skills/ with a different name.
Check Your Understanding
Test what you learned in this lesson.
Q1.You want a /review slash command that runs your team's review checklist, available to every developer when they clone or pull the repo. Where should the command file go?
Q2.A skill performs verbose codebase analysis that would clutter the main conversation with file dumps. Which frontmatter option keeps that noise out of the main context?
Q3.Which belongs in a skill rather than in CLAUDE.md?
Q4.You want to restrict a brainstorming skill so it can read files but never modify or delete them. Which frontmatter option enforces this?
Practice This Lesson