3.2 Custom slash commands and skills
Command scoping
| Scope | Directory | Shared? |
|---|---|---|
| Project | .claude/commands/ | Yes — version-controlled, available on clone/pull |
| User | ~/.claude/commands/ | No — personal |
A /review command that must reach every developer when they clone or pull goes in .claude/commands/. CLAUDE.md holds instructions, not command definitions, and there is no .claude/config.json commands array — both are distractors.
Skills
Skills live in .claude/skills/<name>/SKILL.md and configure behaviour through YAML frontmatter (skills reference, Equipping agents for the real world with Agent Skills):
---
name: analyze-codebase
description: Maps module structure and dependency flows for a target directory.
context: fork
allowed-tools: Read, Grep, Glob
argument-hint: <directory to analyze>
---
Map the structure of $ARGUMENTS. Report modules, entry points, and cross-module
dependencies as a bulleted outline. Do not modify files.
| Frontmatter | Effect | Use when |
|---|---|---|
context: fork | Runs the skill in an isolated sub-agent context; outputs do not pollute the main conversation | Verbose output (codebase analysis) or exploratory context (brainstorming alternatives) |
allowed-tools | Pre-approves the listed tools for the invoking turn — they run without a permission prompt. It grants; it does not restrict, and unlisted tools stay callable | A trusted procedure that would otherwise stop for approval at every step |
disallowed-tools | Removes the listed tools from the pool while the skill is active | Prevent destructive actions — e.g. a scaffolding skill that must never delete or execute |
argument-hint | Prompts the developer for required parameters when the skill is invoked bare | The skill needs an argument to be meaningful |
Personal customization: create a variant in ~/.claude/skills/ under a different name so teammates' invocations are unaffected.
Skills vs CLAUDE.md
| Skills | CLAUDE.md | |
|---|---|---|
| Loading | On demand, when invoked | Always loaded |
| Content | Task-specific workflows | Universal standards |
| Cost | Zero until used | Every session pays the tokens |
Quiz
- Question 1
You want a custom /review slash command that runs your team’s standard code review checklist, available to every developer when they clone or pull the repository. Where should the command file be created?
- Question 2
Your /audit-deps skill walks the dependency tree, prints every transitive package with its version and license, and finishes with a short list of packages needing an upgrade. The list is accurate. Developers complain that after running the skill, the main conversation has lost the thread of the feature they were building. Which frontmatter change addresses this?
- Question 3
A /cleanup-branches skill deletes local branches that have been merged. During testing it once misread a prompt and performed a force push. You need the skill to be incapable of anything beyond listing and deleting local branches, whatever it is asked to do.
- Question 4
Your /scaffold-service skill needs a service name and a target language. Developers invoke it with no arguments about half the time, and the skill guesses, producing scaffolds nobody wanted. Which frontmatter option addresses this?
Links
- https://code.claude.com/docs/en/commands
- https://code.claude.com/docs/en/skills
- https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview
- https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices
- https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills