Overview
Commands in Claude Code are defined using Markdown files with YAML frontmatter. The frontmatter contains metadata that controls how the command appears in the UI and how arguments are processed.File Structure
Command files follow this basic structure:File Naming Convention
Command files should be named with lowercase and hyphens:call-summary.md→/call-summarywrite-query.md→/write-querypipeline-review.md→/pipeline-review
# /command-name
Frontmatter Schema
The YAML frontmatter at the top of each command file defines metadata used by the system.Required Fields
A concise description of what the command does. This appears in command palettes, autocomplete, and help text.Best practices:
- Keep it under 80 characters
- Use action verbs (“Process”, “Analyze”, “Generate”, “Write”)
- Describe the outcome, not the process
- Mention key features separated by em dashes
Optional Fields
Placeholder text shown in the command input UI to guide users on what arguments to provide. Use angle brackets for placeholders.Examples:Best practices:
- Use descriptive placeholders, not generic ones
- Good:
<call notes or transcript> - Bad:
<input> - Show multiple options when applicable:
<segment or rep> - Omit if the command takes no arguments
Command Body
After the frontmatter, the command body contains natural language instructions for Claude to follow.Structure Guidelines
-
Header: Start with
# /command-namematching the command invocation -
Usage Section: Show basic usage syntax
-
Argument Processing: Include references to access user input
-
How It Works: Describe functionality in standalone and connected modes
- Output Format: Show expected output structure with examples
- Tips and Best Practices: Help users get the most from the command
Referencing Connectors
When mentioning integrations, use strikethrough to indicate they’re optional:Argument Variables
Commands can access user input through special variables:| Variable | Description | Example |
|---|---|---|
$ARGUMENTS | All arguments provided by the user | Full text after command name |
@$1 | First file reference | First file path if provided |
@$2 | Second file reference | Second file path if provided |
@$N | Nth file reference | Additional file paths |
Usage Examples
Single argument:Complete Example
Tips
- Provide context — “This is a hot path” or “This handles PII” helps me focus.
- Specify concerns — “Focus on security” narrows the review.
- Include tests — I’ll check test coverage and quality too.