3.2 Custom Slash Commands and Skills
What You Need to Know
Section titled “What You Need to Know”A skill is a named, reusable set of instructions that Claude Code loads on demand. It is a Markdown file that tells Claude how to perform one specific workflow. It can have supporting files and optional YAML frontmatter: a block of settings between --- lines at the top. You run a skill by typing its name as a slash command (/deploy). Claude also loads it itself when a request matches its description. CLAUDE.md is different: it loads in every session, while a skill’s instructions enter the conversation only when the skill runs.
This lesson uses one made-up example throughout: a care home whose two developers maintain the app carers use to log medication rounds. They want a shared /meds-check skill for the checks before they release a medication change. One developer also runs long exploratory analyses of the rota code, for herself alone.
The Unified Skills System
Section titled “The Unified Skills System”Custom commands and skills have been merged into one unified system, the Skills system. Two locations create slash commands that behave the same way. Their file structures differ.
.claude/commands/deploy.mdcreates/deploy. It is a flat Markdown file, and the filename becomes the command name..claude/skills/deploy/SKILL.mdalso creates/deploy. It is one directory for each skill. The directory has the name of the command.SKILL.mdis the required entrypoint inside it.
Because SKILL.md is the required entrypoint, a flat file placed directly inside .claude/skills/ does not create a command. The .claude/skills/ path is the canonical location. .claude/commands/ still works for backward compatibility. Both paths produce the same /command, so existing .claude/commands/ files continue to work unchanged. A command file accepts the same YAML frontmatter as a skill except name and paths. The skills path is recommended because it adds three features the .claude/commands/ path lacks.
- a supporting-files directory alongside the
SKILL.md - automatic discovery, so Claude can load a skill when it matches your intent
- precedence when a skill and a command share the same name: the skill wins
So the care home puts /meds-check in .claude/skills/meds-check/SKILL.md. The skill’s checklist sits beside that file as a supporting file. If a .claude/commands/meds-check.md remains, the skill wins.
Two Scoping Levels
Section titled “Two Scoping Levels”Project scope means .claude/skills/ (canonical) or .claude/commands/ (alias) inside your repository. Both are version-controlled and shared via git. Every developer who clones or pulls the repository gets these commands automatically, so a committed skill is shared with everyone who works there. Use project scope for team-wide workflows.
User scope means ~/.claude/skills/ (canonical) or ~/.claude/commands/ (alias). These are personal, not version-controlled and not shared. A skill saved under the home directory loads in every project. Use user scope for individual productivity workflows that other team members do not need.
The care home puts /meds-check in the project path, so both developers have it. The rota analysis is personal, so its owner puts it under ~/.claude/skills/.
A project command can also be one flat file in .claude/commands/. This file gives the care home team a /review command:
<!-- .claude/commands/review.md — creates /review -->Review the staged changes against our team checklist:1. Check error handling patterns2. Verify test coverage for new functions3. Confirm API naming conventions4. Flag any hardcoded credentials or secretsSkills Frontmatter: Optional Configuration
Section titled “Skills Frontmatter: Optional Configuration”The objective names three frontmatter options: context: fork, allowed-tools and argument-hint. .claude/skills/ is the canonical location for configured skills.
context: fork
context: fork runs the skill in an isolated sub-agent context. The verbose output stays contained in the fork, and the main conversation stays free of that output. Without it, skill output enters the main conversation and consumes context window tokens. For verbose skills, this extra output degrades the quality of later responses. This setting suits three kinds of task.
- codebase analysis, which produces extensive file listings and code excerpts
- brainstorming, which generates many alternatives and evaluations
- any task that produces noisy, exploratory output
The care home’s rota analysis is codebase analysis, so its skill uses context: fork. If its owner names it /analyse-feature, the frontmatter is at the top of ~/.claude/skills/analyse-feature/SKILL.md:
---description: "Analyse a feature area of the codebase and report structure, patterns and risks"context: forkallowed-tools: - Read - Grep - Globargument-hint: "Provide a feature description or area of the codebase to analyse"---The description line is not one of the three the objective names. Omit it from a real skill and Claude has nothing to match your request against. The skill then runs only when you type /analyse-feature yourself.
allowed-tools
allowed-tools pre-approves the listed tools, so Claude can use them without a permission prompt while the skill is active. It does not restrict which tools are available. Every other tool remains callable. Your normal permission settings still govern any tool that is not listed. Use allowed-tools to let a trusted workflow run without stopping to ask on each call. The rota analysis that reads code is such a workflow.
---allowed-tools: - Read - Grep - Glob---To remove tools that Claude can use while a skill runs, list them in disallowed-tools or add deny rules in your permission settings. These two methods are the actual security boundary.
argument-hint
argument-hint is a hint shown during autocomplete to indicate the arguments the skill expects. It improves the developer experience: the inputs are explicit, so nobody has to remember them. It is a label, not an interactive prompt. When you invoke the skill with no arguments, it does not stop and ask for them. For /meds-check, the hint could name the module path.
---argument-hint: "Specify the module path to analyse (e.g., src/api/auth)"---Skills vs CLAUDE.md
Section titled “Skills vs CLAUDE.md”Skills are on-demand, task-specific workflows. Their descriptions are always in context, so Claude knows that they exist. But the full body of a skill loads only when the skill is invoked. A skill is invoked explicitly (/skill-name) or automatically. Claude automatically selects and loads skills whose description matches the user’s intent, or skills with a paths field when you work on matching files. Skills with disable-model-invocation: true require explicit user invocation. CLAUDE.md holds always-loaded, universal standards. They apply to every session, with no invocation step.
So do not put task-specific procedures in CLAUDE.md, where they would load in every session. Do not put always-on reference material in skills, where it would be absent until the skill is invoked. API naming conventions for every code generation task belong in CLAUDE.md (or .claude/rules/). A multi-step workflow that analyses the codebase and that you run occasionally belongs in a skill. Conventions for one file type, such as test files, fit path-scoped .claude/rules/ best: they load as always-on context alongside matching files. So the care home’s naming conventions belong in CLAUDE.md.
Personal Skill Customisation
Section titled “Personal Skill Customisation”Create personal variants in ~/.claude/skills/ (or ~/.claude/commands/) with different names, so teammates are not affected. A personal skill with its own name does not override or conflict with the team version. A care home developer who wants a more verbose /meds-check creates /deep-meds-check there.
Where to Place Custom Commands: Quick Reference
Section titled “Where to Place Custom Commands: Quick Reference”| Need | Canonical location | Also works | Scoping |
|---|---|---|---|
| Team-wide command | .claude/skills/<name>/SKILL.md |
.claude/commands/<name>.md |
Project (shared via git) |
| Team-wide command with frontmatter config | .claude/skills/<name>/SKILL.md |
.claude/commands/<name>.md |
Project (shared via git) |
| Personal command | ~/.claude/skills/<name>/SKILL.md |
~/.claude/commands/<name>.md |
User (not shared) |
| Universal standards | .claude/CLAUDE.md or root CLAUDE.md |
None | Project (always loaded) |
| Personal preferences | ~/.claude/CLAUDE.md |
None | User (not shared) |
In the exam
Section titled “In the exam”The core distinction here is on-demand workflow versus persistent configuration. The exam tests the split between skills and CLAUDE.md directly. Conventions for every edit belong in CLAUDE.md or .claude/rules/. For verbose output that clutters the main conversation, the answer is context: fork.
The exam guide (v1.0) names three frontmatter options, and a question will test those three. description is not on the guide’s list. For two of the three options, the right answer follows the guide, not the current product.
allowed-tools: the guide describes it as restricting the skill’s tool access. If a question asks what the field does, answer “restricts”.argument-hint: the guide describes it as prompting developers for required parameters when they invoke the skill without arguments. That is the expected exam answer.
On the exam, answer with the guide’s wording for both fields. The build exercise below uses current Claude Code behaviour.
Exam Traps
Section titled “Exam Traps”Sources
Section titled “Sources”- Claude Code Skills Documentation (custom slash commands are part of the unified Skills system) — Anthropic
- Claude Certified Architect Foundations Exam Guide — Task Statement 3.2 — Anthropic
- CCAR-F Exam Guide v1.0: Task Statement 3.2 — Anthropic
Exam Simulator
Section titled “Exam Simulator”Five exam-style multiple-choice questions on Custom Slash Commands and Skills. Pick an answer, then open the explanation.
Question 1
Section titled “Question 1”A team wants a /review command available to everyone who clones the repository. A developer also wants a personal /brainstorm skill that produces verbose codebase analysis output without cluttering the main conversation. Where should each be created and what configuration does the skill need?
- A. /review in .claude/commands/ for team sharing; /brainstorm as a SKILL.md in ~/.claude/skills/ with context: fork frontmatter
- B. Both in .claude/commands/ with the brainstorm skill using context: fork
- C. /review in CLAUDE.md as a documented procedure; /brainstorm in .claude/skills/ with only allowed-tools restrictions
- D. Both in ~/.claude/commands/ with instructions for each developer to copy them locally
Answer & explanation
Correct: A
- A is correct: /review needs to be project-scoped (.claude/commands/) so it is shared via version control. /brainstorm is personal, so it goes in ~/.claude/skills/. context: fork isolates the verbose analysis output from the main conversation.
- B is wrong: The /brainstorm skill is personal (not needed by the whole team), so placing it in project-scoped .claude/commands/ shares it unnecessarily.
- C is wrong: CLAUDE.md is for always-loaded standards, not command definitions. The brainstorm skill needs context: fork for output isolation, not just tool restrictions.
- D is wrong: ~/.claude/commands/ is user-scoped and not shared via version control. Requiring manual copying defeats the purpose of project-scoped configuration.
Question 2
Section titled “Question 2”A developer creates a skill that performs codebase analysis. During execution, the skill produces extensive file listings, dependency graphs, and code excerpts that fill the main conversation context. What frontmatter configuration solves this?
- A. allowed-tools: [Read, Grep, Glob] to limit the volume of data accessed
- B. output-limit: 1000 to cap the number of tokens produced
- C. argument-hint: “Specify a narrow scope” to reduce the amount of analysis
- D. context: fork to isolate the skill’s verbose output from the main conversation
Answer & explanation
Correct: D
- A is wrong: allowed-tools governs tool access (the guide’s register is restriction; current Claude Code pre-approves the listed tools), not the volume of output. The skill would still produce verbose output using the permitted tools.
- B is wrong: output-limit is not a valid SKILL.md frontmatter option. This option does not exist.
- C is wrong: argument-hint prompts for input parameters. It does not control output volume. Even with a narrow scope, analysis can produce verbose output.
- D is correct: context: fork runs the skill in an isolated sub-agent. All verbose output stays contained. The main conversation receives only the summary, keeping the context window clean for subsequent work.
Question 3
Section titled “Question 3”API naming conventions must be applied consistently to every code generation task in the project. Where should these conventions be configured?
- A. In a skill at .claude/skills/api-naming/SKILL.md
- B. In the project-level .claude/CLAUDE.md or a .claude/rules/ file
- C. In each developer’s ~/.claude/commands/api-naming.md
- D. In a pre-commit hook that validates naming after generation
Answer & explanation
Correct: B
- A is wrong: Skills are on-demand and must be explicitly invoked. Developers would need to invoke the skill before every code generation task. Universal standards that must apply automatically belong in CLAUDE.md.
- B is correct: CLAUDE.md and .claude/rules/ files are always-loaded, applying automatically to every session. Universal standards that must be consistently enforced belong here.
- C is wrong: User-scoped commands are personal and not shared. Each developer would need separate configuration, and new team members would receive nothing.
- D is wrong: A pre-commit hook validates after the fact, not during generation. The conventions should guide code generation in real time via CLAUDE.md.
Question 4
Section titled “Question 4”A team has a standard /analyse skill in .claude/skills/. One developer wants a more verbose version for their personal use. What is the correct approach?
- A. Modify the team’s .claude/skills/analyse/SKILL.md to add a verbose mode flag
- B. Override the team skill by creating ~/.claude/skills/analyse/SKILL.md with the same name
- C. Create a personal variant at ~/.claude/skills/deep-analyse/SKILL.md with a different name
- D. Add verbose output instructions to the developer’s ~/.claude/CLAUDE.md
Answer & explanation
Correct: C
- A is wrong: Modifying the team’s skill affects everyone. The developer wants a personal variant, not a team-wide change.
- B is wrong: Using the same name may cause conflicts or unpredictable precedence between project and user skill locations.
- C is correct: Personal skills go in ~/.claude/skills/ with different names to avoid conflicting with team skills. The developer gets their verbose version without affecting teammates.
- D is wrong: CLAUDE.md is for always-loaded universal standards, not skill-specific output configuration.
Question 5
Section titled “Question 5”A new developer creates a slash command at ~/.claude/commands/deploy-check.md. They commit and push their changes but teammates cannot find the /deploy-check command. Why?
- A. It sits in ~/.claude/commands/, outside the repository
- B. Teammates need to run /memory to load the new command
- C. The command file needs YAML frontmatter to be recognised
- D. Slash commands only work in interactive mode, not in their teammates’ CI environment
Answer & explanation
Correct: A
- A is correct: ~/.claude/commands/ is in the user’s home directory, outside any repository. It is not version-controlled or shared via git. For team-shared commands, the file must be in a project-scoped path (.claude/commands/ or .claude/skills/) inside the repository.
- B is wrong: /memory is a diagnostic tool for CLAUDE.md configuration, not a mechanism for loading commands.
- C is wrong: Command files do not require YAML frontmatter. The filename itself defines the command name.
- D is wrong: Slash commands work in interactive mode for all users. The issue is the file location, not the execution mode.