Slash Commands and Skills
What goes where
- CLAUDE.md: always-loaded facts and guidance.
- Skills: procedures and reference material; the body loads only when used, so long reference content is almost free until needed.
- Slash commands (
.claude/commands/deploy.md): still work and create/deploy, but skills add supporting files, invocation controls and automatic loading. Prefer skills for new work. A skill overrides a command with the same name.
Skill anatomy
A directory with SKILL.md: YAML frontmatter (must start on line 1) then Markdown instructions. Optional supporting files (reference.md, scripts/) are loaded or run on demand. Keep SKILL.md under about 500 lines.
Locations and precedence: enterprise > personal (~/.claude/skills/<name>/SKILL.md) > project (.claude/skills/<name>/SKILL.md); plugin skills are namespaced (/plugin:skill).
Frontmatter that matters
| Field | Purpose |
|---|---|
name, description, when_to_use | Selection; descriptions are always in context (combined text truncated at 1,536 characters, so lead with the key use) |
argument-hint, arguments | Autocomplete hint, named positional args |
allowed-tools | Tools pre-approved for the invoking turn. It does not restrict other tools |
disallowed-tools | Tools removed while active |
disable-model-invocation: true | Only you can invoke (use for /deploy, /commit) |
user-invocable: false | Hidden from the menu; Claude-only background knowledge |
context: fork + agent | Run in a subagent (Explore, Plan, general-purpose or custom) |
paths | Glob patterns limiting automatic activation |
model, effort, hooks | Overrides while active |
Arguments and dynamic context
$ARGUMENTS, $0/$1 positional, $name named. ` !command runs a shell command **before** Claude sees the skill and injects the output (live data such as gh pr diff). If an injected command fails, the **whole skill invocation aborts**. disableSkillShellExecution` in settings turns this off.
Forked context
context: fork runs the skill in a new subagent that does not see your conversation; the skill must be self-contained. Explore and Plan agents start without CLAUDE.md. Use it only for skills with an explicit task; pure guideline content produces nothing useful. This differs from forking the conversation, which copies history.
Context cost
Once invoked, a skill's content stays in the conversation; after auto-compaction the first 5,000 tokens of each invoked skill are re-attached within a 25,000-token combined budget.
Exam traps
- Reading
allowed-toolsas a restriction. It pre-approves; it does not limit. - Using CLAUDE.md for a long procedure that belongs in a skill.
- A forked skill that depends on the conversation ("continue what we discussed").
- A side-effecting skill (deploy) that Claude can auto-invoke. Set
disable-model-invocation: true. - Plugin skills colliding. They are namespaced.
References
- Skills — checked Oct 16, 2026
Check your understanding
A
/deployworkflow must only run when a human types it. Setting?Show answerHide answerAnswer
disable-model-invocation: true.Inject the current PR diff into a skill. Mechanism?Show answerHide answer
Answer
`!gh pr diff` dynamic context injection.Does a
context: forkskill see the chat history?Show answerHide answerAnswer
No.