Task Statement 3.2·Domain 3 — 20% of exam
Custom Slash Commands and Skills
Create and configure custom slash commands and skills
Official Exam Guide Objectives
The objectives below are quoted from Anthropic's Claude Certified Architect – Foundations exam guide, v1.1. Read the exam guide summary for the full blueprint.
Knowledge of
- Project-scoped commands in .claude/commands/ (shared via version control) vs user-scoped commands in ~/.claude/commands/ (personal)
- Skills in .claude/skills/ with SKILL.md files that support frontmatter configuration including context: fork, allowed-tools, and argument-hint
- The context: fork frontmatter option for running skills in an isolated sub-agent context, preventing skill outputs from polluting the main conversation
- Personal skill customization: creating personal variants in ~/.claude/skills/ with different names to avoid affecting teammates
Skills in
- Creating project-scoped slash commands in .claude/commands/ for team-wide availability via version control
- Using context: fork to isolate skills that produce verbose output (e.g., codebase analysis) or exploratory context (e.g., brainstorming alternatives) from the main session
- Configuring allowed-tools in skill frontmatter to restrict tool access during skill execution (e.g., limiting to file write operations to prevent destructive actions)
- Using argument-hint frontmatter to prompt developers for required parameters when they invoke the skill without arguments
- Choosing between skills (on-demand invocation for task-specific workflows) and CLAUDE.md (always-loaded universal standards)
What You Need to Know
Custom commands and skills are now one system rather than two: the Skills system. Both .claude/skills/ and .claude/commands/ yield /commands that behave identically, but what you put in each differs. Under .claude/skills/ the unit is a directory holding a SKILL.md — .claude/skills/deploy/SKILL.md. Under .claude/commands/ it is a single Markdown file, .claude/commands/deploy.md. Dropping a loose .md straight into .claude/skills/ produces nothing. Treat .claude/skills/ as the canonical location; .claude/commands/ remains supported for backward compatibility.
The Unified Skills System
Either path gets you the same thing — a /command a developer can type:
.claude/commands/deploy.mdcreates/deploy— a flat file whose filename becomes the command name.claude/skills/deploy/SKILL.mdalso creates/deploy— one directory per skill, named after the command, withSKILL.mdas the required entrypoint inside it
What tips the recommendation towards the skills path is what it adds on top: room for supporting files next to the SKILL.md, automatic discovery so Claude can reach for a skill when the request matches it, and a defined outcome when both paths define the same name — the skill takes it. Frontmatter is identical across the two (context: fork, allowed-tools, argument-hint) and the resulting /command is identical, so nothing already sitting in .claude/commands/ needs touching.
A skill is a directory, a command is a flat file, step 1: A skill is a directory holding SKILL.md
Commands and skills are found by where their files sit. There is no settings file or registry that declares them, so "is this command shared?" is answered by asking whether its file is inside the repository.
Two Scoping Levels
Project-scoped (shared via git):
.claude/skills/ (canonical) or .claude/commands/ (alias), inside the repository. Both are committed, so anyone who clones or pulls has the commands immediately. This is where team workflows belong: /review, /deploy-check, /lint, /migration-guide.
<!-- .claude/commands/review.md — creates /review -->
Work through the staged diff and report against these, in order:
1. Are failures handled the way the rest of the codebase handles them?
2. Does every new exported function have a test that would catch a regression?
3. Do new endpoints match the naming already in use?
4. Is there anything credential-shaped committed by accident?User-scoped (personal):
~/.claude/skills/ (canonical) or ~/.claude/commands/ (alias). Nothing here is committed or shared, which makes it the right home for workflows that suit how you work and would only be noise for everyone else.
Two questions settle every placement
Most items in this task reduce to two independent choices: who gets it (shared through the repository, or personal) and when it loads (always, or on demand). Cross them and every placement has a cell:
| Always loaded | On demand | |
|---|---|---|
| Shared | project CLAUDE.md, project .claude/rules/ | project .claude/skills/, .claude/commands/ |
| Personal | ~/.claude/CLAUDE.md, CLAUDE.local.md | ~/.claude/skills/, ~/.claude/commands/ |
Read the stem for both answers before reading the options. A distractor usually gets one of the two right — the right scope with the wrong loading behaviour, or the reverse.
Skills Frontmatter: Optional Configuration
A SKILL.md under .claude/skills/ may carry YAML frontmatter to configure how it runs. The same frontmatter is honoured for .claude/commands/ files, though .claude/skills/ is where configured skills are meant to live. Note that skills are invoked for a task rather than loaded continuously — they are not CLAUDE.md.
The three critical frontmatter options:
context: fork
Runs the skill inside an isolated sub-agent context, so whatever it generates stays there and the main conversation is untouched. That matters for anything noisy:
- Codebase analysis (produces extensive file listings and code excerpts)
- Brainstorming (generates many alternatives and evaluations)
- Any task that produces noisy, exploratory output
Leave it out and every line the skill produces lands in the main conversation, spending context that later turns will need — which is why a verbose skill without context: fork degrades the responses that follow it rather than just the one it ran in.
Frontmatter goes at the very top of the SKILL.md. Invoking it as /analyse-feature means the file to edit is .claude/skills/analyse-feature/SKILL.md:
---
context: fork
allowed-tools:
- Read
- Grep
- Glob
---Without context: fork, later turns degrade, step 1: /brainstorm without context: fork — straight into the conversation
The guide names two reasons to fork, and they are different. Verbose output (codebase analysis, dependency audits, log trawling) would crowd the window. Exploratory context (brainstorming alternatives, comparing approaches) is a subtler cost: the discarded branches stay in the conversation and keep anchoring later reasoning even when there is room for them.
The fork is structural. Telling an unforked skill to "summarise rather than print every excerpt" is a request the model may not follow, and changing its model changes who does the work, not where the output lands.
What a forked skill sees. The SKILL.md body becomes the subagent's prompt, and it runs with the configuration of the agent type chosen by agent. Most agent types also load your CLAUDE.md files; Explore and Plan start without them, and a custom subagent can opt out with omitClaudeMd. It never sees the conversation that invoked it. What comes back to the main conversation is the subagent's result, so a forked skill's body should say what that result is ("return a summary of at most 40 lines: components, responsibilities, the three riskiest coupling points with file:line").
When not to fork.
- The skill needs the conversation — it acts on something you just discussed. A forked subagent has no access to that history.
- The skill is guidelines without a task ("follow these API conventions"). A forked subagent receives the guidelines, has nothing to do with them, and returns nothing useful. Guidance that should shape the work in progress belongs in the main context.
- The output is small. Isolation costs a subagent run and buys nothing when there was little to contain.
Beyond what the guide covers: a forked skill runs in the background by default (the background field, default true); setting background: false makes the invoking turn wait for the result. In non-interactive runs (-p, the Agent SDK) Claude Code waits for it anyway, and a backgrounded fork runs with the narrower tool set that background subagents get.
Four things called "fork"
| Mechanism | What it creates | Sees the conversation? |
|---|---|---|
context: fork in a skill's frontmatter | One skill invocation, run in a subagent | No — the skill body is its prompt |
fork_session / --fork-session (Task 1.7) | A new branch of a whole persisted session | Yes — it starts from the session's history |
| A forked subagent (Task 1.3) | A subagent that "inherits the entire conversation so far" | Yes |
| An ordinary subagent via the Task/Agent tool (Task 1.3) | A delegated task in a fresh context | No — only what the spawn prompt carries |
A stem about a skill whose output floods the session is about the first row, whatever the options call the others.
allowed-tools
Pre-approves what it lists, so the skill can use those tools without stopping for a permission prompt. Read carefully what it does not do: it is not a restriction. Every other tool remains reachable, governed by your usual permission settings exactly as before. It buys uninterrupted execution for a workflow you trust, not a sandbox.
---
allowed-tools:
- Read
- Grep
- Glob
---Taking tools away — the actual security boundary — is disallowed-tools, or deny rules in your permission settings. An existing ask or deny rule still applies whatever allowed-tools lists. The list can also be written on one line, space- or comma-separated (allowed-tools: Read Grep Glob).
One consequence is worth knowing: the workspace-trust check does not gate this field, so a skill committed to a repository can pre-approve tools for itself even in a non-interactive -p run. That makes allowed-tools lines something to review in pull requests.
The stakes decide which instrument fits. A read-only analysis skill that keeps stopping for prompts is a convenience problem, and allowed-tools solves it. A workflow that could reach Bash or Write against a production deployment path is an enforcement problem: the answer is a boundary (disallowed-tools, a deny rule) or a hook, not a pre-approval list. The exam guide's own framing of allowed-tools as a restriction is covered in the Current state callout under Deep Dive.
argument-hint
The exam guide's purpose for it: "to prompt developers for required parameters when they invoke the skill without arguments". Where a stem says developers keep invoking a skill without the parameter it needs, argument-hint is the answer.
---
argument-hint: "Which module? Give a path, e.g. src/billing/invoices"
---A body that handles the missing case:
---
argument-hint: "[issue-number]"
---
If no issue number was supplied, ask for it and do nothing else until you have it.
Otherwise investigate issue #$ARGUMENTS and propose a fix.Skills vs CLAUDE.md: The Critical Distinction
This distinction is tested directly on the exam:
- Skills = invoked for a task. Their descriptions sit in context permanently so Claude knows what exists, while the body arrives only on invocation. That invocation may be explicit (
/skill-name) or automatic — Claude reaches for a skill whosedescriptionfits the request, or one whosepathsfrontmatter matches the files being edited. Settingdisable-model-invocation: truerestricts a skill to explicit invocation only. - CLAUDE.md = present from the start of every session, with nothing to invoke and no matching step.
Which gives the rule: procedures for a particular task do not belong in CLAUDE.md, and standing reference material does not belong in a skill.
The quickest test is fact or procedure? Facts every session needs ("we use 2-space indentation", "API handlers live in src/api/handlers") go in CLAUDE.md. Procedures ("run the release checklist: bump the version, update the changelog, tag, verify") go in a skill. Because a skill's body costs nothing until it is invoked, long material that only one procedure needs is cheap to keep with that skill, where in CLAUDE.md it would be paid for in every session that never runs it.
Naming conventions that must shape every piece of generated code are always-on, so CLAUDE.md or .claude/rules/ is their home. A multi-step analysis somebody runs now and then is a skill. And conventions attaching to one file type — tests being the obvious case — fit path-scoped .claude/rules/ best, since those load as standing context whenever a matching file is in play.
When a stem offers a fourth option, a hook, the table extends:
| Need | Mechanism | Loads or runs |
|---|---|---|
| A universal standard every session must know | CLAUDE.md | Always |
| A convention for certain files only | .claude/rules/ with paths: | When matching files are in play |
| A multi-step procedure run on demand | Skill | When invoked, by a person or by Claude |
| A guarantee that must hold whatever the model decides | Hook | On every matching event |
The first three are all instructions the model reads and may follow; only the hook enforces.
Personal Skill Customisation
Personal variants live in ~/.claude/skills/ (or ~/.claude/commands/) under a name of their own. Where the team ships /analyse and you want something more thorough, build yours as /deep-analyse rather than redefining theirs — a distinct name keeps both available and leaves your colleagues' behaviour unchanged.
Where skills live, and which wins a name clash
| Location | Path | Applies to |
|---|---|---|
| Enterprise | managed settings | Everyone in the organisation |
| Personal | ~/.claude/skills/<name>/SKILL.md | All your projects |
| Project | .claude/skills/<name>/SKILL.md | This project |
| Plugin | <plugin>/skills/<name>/SKILL.md | Wherever the plugin is enabled, namespaced as /<plugin>:<name> |
Precedence is enterprise, then personal, then project, so a personal skill with the same name as a project skill shadows the team's version on your machine. Nothing in ~/.claude/ reaches a teammate either way; the guide's advice is about the name, not the location. A variant such as /review-strict beside the team's /review keeps both reachable and makes the difference visible, where a same-named copy makes your results diverge from your colleagues' with nothing to show why.
Where to Place Custom Commands: Quick Reference
| Need | Canonical location | Also works | Scoping |
|---|---|---|---|
| A command the whole team should get on clone | .claude/skills/<name>/SKILL.md | .claude/commands/<name>.md | Project (shared via git) |
| The same, but configured with frontmatter | .claude/skills/<name>/SKILL.md | .claude/commands/<name>.md | Project (shared via git) |
| Something only you want to invoke | ~/.claude/skills/<name>/SKILL.md | ~/.claude/commands/<name>.md | User (not shared) |
| Conventions that must shape every session | .claude/CLAUDE.md or root CLAUDE.md | — | Project (always loaded) |
| How you personally like Claude to behave | ~/.claude/CLAUDE.md | — | User (not shared) |
Deep Dive
$ARGUMENTS and positional arguments
$ARGUMENTS expands to all arguments passed at invocation. If $ARGUMENTS doesn't appear anywhere in the skill or command body, Claude Code appends the arguments automatically as ARGUMENTS: <value> so they're never silently dropped. For positional access, $N is shorthand for $ARGUMENTS[N] with 0-based indexing — $0 is the first argument, $1 the second, and so on.
---
argument-hint: "[issue-number] [priority]"
---
Investigate issue #$0 (priority: $1) and propose a fix.Invoking /triage 4521 high binds $0 to 4521 and $1 to high.
Sourcecode.claude.com › skillsfetched 2026-07-30
Full SKILL.md frontmatter field table
All frontmatter fields are optional; only description is recommended, since it's what Claude uses to decide when to auto-invoke the skill (falling back to the first paragraph of the body if omitted). The complete set is name, description, when_to_use, argument-hint, arguments, disable-model-invocation, user-invocable, allowed-tools, disallowed-tools, model, effort, context, agent, background, hooks, paths, shell, metadata, license and compatibility. The fields that matter for the exam:
| Field | Purpose |
|---|---|
name | Sets the command that the / menu shows and that you type. name: deploy in .claude/skills/deploy-staging/ gives /deploy; the directory name also invokes the skill |
description | What the skill does and when to use it — drives model-invoked triggering. Put the key use case first: description and when_to_use together are truncated at 1,536 characters in the skill listing |
argument-hint | Autocomplete hint for expected arguments, e.g. [issue-number] |
allowed-tools | Tools pre-approved for the invoking turn only; the grant clears on your next message. It "does not restrict which tools are available" |
disallowed-tools | Takes tools away while the skill runs — the field that actually restricts |
model | Overrides the session model for the rest of the current turn only |
context: fork | Runs the skill in an isolated subagent context |
agent | With context: fork, picks the subagent type (Explore, Plan, general-purpose, or a custom .claude/agents/ subagent); defaults to general-purpose |
background | With context: fork, whether the fork runs in the background; defaults to true |
paths | Glob patterns that limit when Claude loads the skill automatically |
disable-model-invocation: true | Only the user can invoke it; the description isn't loaded into context |
user-invocable: false | Only Claude can invoke it; hidden from the / menu |
The three guide-named fields together, in a skill that maps a service without flooding the session:
---
name: map-service
description: Map a service's entry points, module boundaries and external dependencies. Use when someone asks how a service is structured.
argument-hint: "[service-directory]"
context: fork
agent: Explore
allowed-tools: Read Grep Glob
---
Map the architecture of $ARGUMENTS.
Return at most 40 lines: components, data flow, and the three riskiest
coupling points, each with file:line.The invariant: the verbose search work happens in the fork, and the last line fixes what comes back.
Sourcecode.claude.com › skillsfetched 2026-11-19
context: fork and the agent field
context: fork runs the skill in a forked subagent context: the skill content becomes the prompt that drives the subagent, and that subagent has no access to the parent conversation's history. The agent field then selects which subagent configuration executes the forked skill — a built-in agent (Explore, Plan, general-purpose) or any custom subagent defined in .claude/agents/ — defaulting to general-purpose when omitted. A forked skill runs in the background unless background: false is set.
Sourcecode.claude.com › skillsfetched 2026-11-19
Dynamic context injection with the ! prefix
The !`<command>` syntax runs a shell command before the skill content is sent to Claude, and the command's output replaces the placeholder in the prompt — so Claude receives actual data (a git diff, a file listing) rather than the command text itself.
Review the staged changes:
!`git diff --staged`Sourcecode.claude.com › skillsfetched 2026-07-30
Skill permission rules
Skill invocation itself can be gated with permission rules: Skill(name) matches an exact skill, Skill(name *) is a prefix match covering any arguments.
Sourcecode.claude.com › skillsfetched 2026-07-30
MCP prompts as slash commands
Separately from .claude/skills/ and .claude/commands/, MCP servers can expose their own prompts as slash commands in the form /mcp__servername__promptname, discovered dynamically from connected servers with server and prompt names normalised (spaces become underscores). Many prompts accept arguments, passed space-separated after the command, e.g. /mcp__github__pr_review 456.
Sourcecode.claude.com › mcpfetched 2026-07-30
allowed-tools pre-approves — it does not restrict, step 1: allowed-tools: Read, Grep, Glob
Quick Reference
| Item | Value / behaviour |
|---|---|
| Command file | .claude/commands/<name>.md — flat Markdown, filename becomes command name |
| Skill directory | .claude/skills/<name>/SKILL.md — directory required, canonical location |
| Skill/command name conflict | skill wins over a same-named command |
name (skill) | sets the / command; the directory name also invokes it |
description + when_to_use | truncated at 1,536 characters in the listing — key use case first |
$ARGUMENTS | all arguments; auto-appended as ARGUMENTS: <value> if not referenced |
$N / $ARGUMENTS[N] | positional argument, 0-based ($0 = first) |
| Other substitutions | named arguments declared in an arguments: list (e.g. $issue); ${CLAUDE_SKILL_DIR}; ${CLAUDE_SESSION_ID} |
!`cmd` | runs shell command pre-send; output replaces the placeholder |
context: fork | isolated subagent context; skill content becomes the subagent's prompt; no conversation history |
agent (with fork) | Explore | Plan | general-purpose (default) | custom .claude/agents/ |
background (with fork) | defaults to true; false makes the invoking turn wait |
| Don't fork | guidelines-only skills; skills that need the conversation; small output |
allowed-tools (current docs) | pre-approves tools for the invoking turn; NOT a restriction |
allowed-tools (exam-guide answer) | restricts tool access during skill execution |
disallowed-tools | the real boundary — bare tool name removes it from context entirely |
argument-hint (exam-guide answer) | prompts developers for required parameters when invoked without arguments |
argument-hint (current docs) | autocomplete hint only; the body must handle a missing argument |
disable-model-invocation: true | user-only invocation; description hidden from context |
user-invocable: false | Claude-only invocation; hidden from / menu |
| Skill locations by precedence | enterprise > personal (~/.claude/skills/) > project (.claude/skills/) > bundled |
| Same-named personal skill | silently shadows the team's skill for you — give a variant its own name |
| Nested skill name clash | qualified as apps/web:deploy |
| MCP prompt commands | /mcp__servername__promptname, space-separated arguments |
| Skills vs CLAUDE.md | skills load on invocation; CLAUDE.md loads every session automatically |
| Fact or procedure? | fact every session needs → CLAUDE.md; procedure → skill; guarantee → hook |
Exam Traps
More wrong answers, and why each fails
| Tempting answer | Why it fails | Choose instead |
|---|---|---|
Keep a personal skill under .claude/skills/ and add its path to .gitignore | It works until someone edits .gitignore; it fights the scoping system when the home directory already gives exactly this | ~/.claude/skills/<name>/SKILL.md |
| Prove a command is shared by running it in your own session, or by checking its frontmatter is valid YAML | Your machine is the one place where project and personal scope look identical, and valid frontmatter says nothing about who can reach the file | Check the file is tracked in the repository (or try it from a fresh clone) |
How This Is Tested
Items for this task sit mainly in the guide's "Code Generation with Claude Code" scenario, which names custom slash commands; the same decisions can appear in the developer-productivity and CI scenarios.
| Stem signal | Answer | Wrong-answer pattern beside it |
|---|---|---|
A /review command must reach every developer on clone or pull | .claude/commands/ (or .claude/skills/<name>/SKILL.md) in the repository | ~/.claude/commands/; CLAUDE.md; an invented config file |
| A codebase-analysis or brainstorming skill floods the conversation; later answers degrade | context: fork | Asking the skill to be brief; switching it to a smaller model |
| Restrict what a skill can do while it runs (e.g. limit it to file writes) | allowed-tools (the guide's answer) | Answering from today's product behaviour, where the field only pre-approves |
| Developers keep invoking the skill without the parameter it needs | argument-hint | Expecting the invocation to be rejected until an argument is supplied |
| You want a stricter or more verbose personal version of the team's skill | A differently named skill in ~/.claude/skills/ | Editing the shared skill; a same-named personal copy |
| A convention must apply on every task / a procedure runs now and then | CLAUDE.md or .claude/rules/ / a skill | Swapping the two |
Official sample question 4, option by option
The stem: "You want to create a custom /review slash command that runs your team's standard code review checklist. This command should be available to every developer when they clone or pull the repository. Where should you create this command file?"
| Option | Verdict | The official explanation |
|---|---|---|
| A. "In the .claude/commands/ directory in the project repository" | Correct | "Project-scoped custom slash commands should be stored in the .claude/commands/ directory within the repository. These commands are version-controlled and automatically available to all developers when they clone or pull the repo." |
| B. "In ~/.claude/commands/ in each developer's home directory" | Wrong | "~/.claude/commands/ is for personal commands that aren't shared via version control." |
| C. "In the CLAUDE.md file at the project root" | Wrong | "CLAUDE.md is for project instructions and context, not command definitions." |
| D. "In a .claude/config.json file with a commands array" | Wrong | It "describes a configuration mechanism that doesn't exist in Claude Code." |
The stem's two requirements map onto the two questions from What You Need to Know: "every developer when they clone or pull" fixes the scope (shared, so inside the repository), and "a command" fixes the loading behaviour (on demand, so not CLAUDE.md). D is the invented-feature distractor: it sounds like configuration, sits under the right .claude/ directory, and does not exist. Commands are discovered from their directories, never declared in a settings file. .claude/skills/review/SKILL.md would also work today, but it is not among the options; the guide's answer names .claude/commands/.
Practice Scenario
Your team standardised on .claude/skills/ for shared workflows. A developer commits .claude/skills/release-notes.md containing the release-notes procedure, and the branch merges cleanly. Nobody can invoke /release-notes afterwards — it never appears in the command list, and no error is logged anywhere. What's the most effective first step?
Practice Questions
Exam simulator
Question 1 of 13
Scenario · Developer Productivity with Claude
You copied your team's /review skill into ~/.claude/skills/review/ and made it much stricter. During a pairing session, you and a teammate ran /review on the same diff and got very different results, and it took an hour to work out why. You still want the stricter checks for your own work. What change would most effectively prevent this?