Files
claude-code-best-practice/reports/claude-commands-frontmatter.md
T
2026-03-01 15:36:08 +05:00

3.1 KiB
Raw Blame History

Claude Code: Commands Frontmatter Reference

Quick-reference tables for defining custom commands in .claude/commands/<name>.md.

← Back to Claude Code Best Practice Claude

Frontmatter Fields

Field Type Required Description
description string Recommended Short description shown in autocomplete when user types /
model string No Model override for this command (e.g., haiku, sonnet)

Commands have minimal frontmatter compared to agents and skills — they are lightweight entry points that delegate heavy work to agents.


Invocation

Method Example
Slash command User types /command-name at the prompt
With arguments /command-name arg1 arg2 — arguments are appended to the prompt

Scope Levels

Scope Location Shared
Project .claude/commands/*.md Yes (committed to repo)
User ~/.claude/commands/*.md No (personal, all projects)

Both scopes are available simultaneously — project commands appear alongside user commands.


Template Variables

Available inside command markdown via ${VARIABLE}:

Variable Description
${ARGUMENTS} Arguments passed after the command name
${CLAUDE_SESSION_ID} Current session identifier
${CLAUDE_PROJECT_DIR} Project root directory path

Example: Orchestrator Command

---
description: Fetch and transform weather data for Karachi
model: haiku
---

# Weather Orchestrator

1. Ask the user for temperature unit preference
2. Use the Task tool to invoke the weather agent
3. Report the results

Commands in This Repository

Command Model Description Delegates To
weather-orchestrator haiku Fetch and transform Karachi weather weather agent

Intentionally Not Documented Here

These items were identified during the 2.1.02.1.49 audit but belong in other reports:

Item Reason Where It Belongs
Skill user-invocable field Skill-specific frontmatter claude-skills-frontmatter.md
Skill ${CLAUDE_SESSION_ID} variable Skill-specific template variable claude-skills-frontmatter.md
Agent memory frontmatter Already covered in depth claude-agent-memory.md
claude.ai MCP connectors Product feature, not settings N/A
chat:newline keybinding Keybindings reference, not settings claude-commands.md (Keyboard Shortcuts section)

Sources