The Command Template System defines the structure and processing rules for command templates that drive the Spec-Driven Development workflow. These templates serve as the authoritative source for slash command behavior across all 16+ supported AI agents. This page documents the template file format, YAML frontmatter schema, placeholder system, and processing rules.
For information about how templates are converted to agent-specific formats, see Template Processing Pipeline. For documentation on cross-platform scripts referenced in templates, see Cross-Platform Script Architecture.
Command templates are stored in the templates/commands/ directory. Each template is a Markdown file with a specific structure consisting of YAML frontmatter followed by instructional content.
| Aspect | Convention |
|---|---|
| Directory | templates/commands/ |
| File Format | Markdown (.md) |
| Naming Pattern | {command-name}.md (e.g., specify.md, tasks.md) |
| Command Mapping | Filename maps to /speckit.{command-name} slash command |
Sources: templates/commands/specify.md1-262 templates/commands/tasks.md1-140
Sources: templates/commands/specify.md1-14 templates/commands/tasks.md1-15
The frontmatter is delimited by --- markers and contains metadata that controls command behavior and integration.
| Field | Type | Required | Description |
|---|---|---|---|
description | string | Yes | Human-readable command description shown in agent UIs |
handoffs | list | No | Suggested next commands with pre-filled prompts |
scripts | object | Yes | Script paths for bash (sh) and PowerShell (ps) variants |
Key Points:
sh key: Bash script path with argumentsps key: PowerShell script path with arguments{ARGS} placeholder is substituted during processingSources: templates/commands/specify.md11-14 templates/commands/tasks.md12-14
Handoffs enable workflow continuity by suggesting the next logical command with contextual prompts.
Field Definitions:
| Field | Type | Purpose |
|---|---|---|
label | string | Button text shown in agent UI |
agent | string | Target command (e.g., speckit.plan) |
prompt | string | Pre-filled text for next command |
send | boolean | If true, auto-submit the handoff (optional) |
Sources: templates/commands/specify.md3-10 templates/commands/tasks.md3-11
The template body contains structured Markdown sections that provide instructions to AI agents. These sections follow a consistent pattern across all command templates.
This section displays the raw arguments passed to the command:
You MUST consider the user input before proceeding (if not empty).
The `$ARGUMENTS` placeholder is substituted with the actual user input when the command is invoked.
Sources: <FileRef file-url="https://github.com/github/spec-kit/blob/9a1e3037/templates/commands/specify.md#L16-L22" min=16 max=22 file-path="templates/commands/specify.md">Hii</FileRef> <FileRef file-url="https://github.com/github/spec-kit/blob/9a1e3037/templates/commands/tasks.md#L17-L23" min=17 max=23 file-path="templates/commands/tasks.md">Hii</FileRef>
### Outline Section
The Outline section provides step-by-step instructions for command execution. It typically includes:
1. **Setup steps**: Script execution and environment validation
2. **Data loading**: Reading specification files and configuration
3. **Processing workflow**: Core command logic
4. **Output generation**: Writing results to files
5. **Reporting**: Summary of actions taken
Sources: <FileRef file-url="https://github.com/github/spec-kit/blob/9a1e3037/templates/commands/specify.md#L24-L198" min=24 max=198 file-path="templates/commands/specify.md">Hii</FileRef> <FileRef file-url="https://github.com/github/spec-kit/blob/9a1e3037/templates/commands/tasks.md#L25-L68" min=25 max=68 file-path="templates/commands/tasks.md">Hii</FileRef>
## Placeholder System
Templates use multiple placeholder types that are substituted during processing to create agent-specific command files.
### Placeholder Types and Substitution Rules
```mermaid
graph LR
subgraph "Template Placeholders"
ARGUMENTS["$ARGUMENTS"]
SCRIPT["{SCRIPT}"]
ARGS["{ARGS}"]
FEATURE_DIR["{FEATURE_DIR}"]
end
subgraph "Markdown Format<br/>(Most Agents)"
MD_ARGUMENTS["$ARGUMENTS"]
MD_SCRIPT["Resolved script path"]
MD_ARGS["$ARGUMENTS"]
end
subgraph "TOML Format<br/>(Gemini, Qwen)"
TOML_ARGS["{{args}}"]
TOML_SCRIPT["Resolved script path"]
end
ARGUMENTS --> MD_ARGUMENTS
ARGUMENTS --> TOML_ARGS
SCRIPT --> MD_SCRIPT
SCRIPT --> TOML_SCRIPT
ARGS --> MD_ARGS
ARGS --> TOML_ARGS
| Placeholder | Purpose | Markdown Substitution | TOML Substitution |
|---|---|---|---|
$ARGUMENTS | User's command arguments | $ARGUMENTS (preserved) | {{args}} |
{SCRIPT} | Script path from frontmatter | Resolved sh or ps path | Resolved sh or ps path |
{ARGS} | Inline argument reference | $ARGUMENTS | {{args}} |
{FEATURE_DIR} | Current feature directory | Resolved from script output | Resolved from script output |
Processing Rules:
$ARGUMENTS becomes {{args}} for TOML-based agents{SCRIPT} resolves to sh path for bash-based agents, ps path for PowerShell-based agents$ARGUMENTS remain as-is for agent runtime substitutionSources: templates/commands/specify.md12-72 templates/commands/tasks.md27
The specify.md template demonstrates the complete structure and placeholder usage:
Key Structural Elements:
Frontmatter (specify.md1-14):
User Input (specify.md16-22):
$ARGUMENTS placeholderOutline (specify.md24-198):
Guidelines (specify.md200-262):
Sources: templates/commands/specify.md1-262
The tasks.md template shows variation in structure for different command types:
Structural Differences:
check-prerequisites.sh instead of feature creationSources: templates/commands/tasks.md1-140
Templates are processed during project initialization to generate agent-specific command files.
Stage 1: Frontmatter Extraction
--- delimitersStage 2: Script Resolution
sh or ps script path based on target agent{SCRIPT} placeholder with resolved pathStage 3: Placeholder Substitution
{ARGS} to $ARGUMENTS (Markdown) or {{args}} (TOML)$ARGUMENTS as runtime placeholderStage 4: Path Rewriting
templates/ references to .specify/ for packaged projectsStage 5: Format Conversion
description and prompt fieldsSources: templates/commands/specify.md1-262 templates/commands/tasks.md1-140
Commands like specify.md implement multi-stage workflows with validation gates:
Implementation:
Sources: templates/commands/specify.md104-196
Templates that interact with the filesystem follow a script-first pattern:
Key Characteristics:
Sources: templates/commands/specify.md60-72 templates/commands/tasks.md27
The tasks.md template demonstrates conditional content generation:
Implementation Approach:
Sources: templates/commands/tasks.md29-140
To add a new command template:
templates/commands/{command-name}.md$ARGUMENTS, {SCRIPT}, {ARGS}When modifying templates, consider:
Templates must satisfy these constraints:
| Rule | Validation |
|---|---|
| Frontmatter required | Must have description and scripts fields |
| Dual scripts | Both sh and ps paths must be specified |
| User Input section | Must include $ARGUMENTS placeholder section |
| Outline section | Must provide step-by-step instructions |
| Script JSON output | Must parse JSON from script execution |
| Path resolution | All file paths must be resolvable |
Sources: templates/commands/specify.md1-262 templates/commands/tasks.md1-140
Refresh this wiki