Slash Commands
agentcmd includes powerful /cmd:* slash commands for spec-driven workflow
automation.
How Slash Commands Orchestrate Agents
Slash commands are pre-built agent instructions that tell AI agents what to do. When you run a slash command, agentcmd:
- Loads the command definition from
.claude/commands/cmd/ - Sends the instructions to an AI agent (Claude Code, Codex, or Gemini)
- The agent executes the workflow defined in the command
- Returns structured results (often JSON)
Example: /cmd:generate-feature-spec
When you run:
/cmd:generate-feature-spec "Add dark mode support"agentcmd orchestrates Claude to:
- Analyze your codebase for existing patterns
- Research similar implementations
- Generate comprehensive feature spec with tasks
- Create spec folder in
.agent/specs/todo/ - Update spec index
- Return spec ID for implementation
You issued one command. The agent did the work.
See Agents for more on agent orchestration.
Command Namespace
This reference only documents /cmd:* namespace commands - the official
agentcmd workflow commands. Custom commands in your project (like
/commit-and-push, /pull-request) are project-specific and documented
separately.
All agentcmd workflow commands use the /cmd: prefix to distinguish them from custom project commands.
Available Commands
Spec Generation
/cmd:generate-feature-spec
Generate feature implementation spec with tasks and complexity estimates.
Usage:
/cmd:generate-feature-spec [context]Arguments:
context(optional) - Feature description or requirements. If omitted, uses conversation history.
What it does:
- Analyzes feature requirements
- Researches codebase for patterns
- Breaks down into phased tasks
- Assigns complexity scores (1-10 per task)
- Writes spec to
.agent/specs/todo/{timestamp}-{name}/spec.md - Updates
.agent/specs/index.json
Example:
/cmd:generate-feature-spec "Add OAuth authentication with Google and GitHub"Returns: JSON with spec_id, spec_path, complexity, next_command
/cmd:generate-bug-spec
Generate bug fix spec with reproduction steps and investigation workflow.
Usage:
/cmd:generate-bug-spec [context]Arguments:
context(optional) - Bug description or reproduction steps
What it does:
- Documents reproduction steps
- Analyzes root cause
- Proposes fix strategy
- Creates test cases for regression
- Writes spec to
.agent/specs/todo/
Example:
/cmd:generate-bug-spec "Login page crashes on mobile Safari when clicking 'Remember me'"/cmd:generate-issue-spec
Generate general issue/refactoring spec.
Usage:
/cmd:generate-issue-spec [context]Arguments:
context(optional) - Issue description
What it does:
- Documents problem statement
- Proposes solution approach
- Analyzes impact
- Defines success criteria
- Writes spec to
.agent/specs/todo/
Example:
/cmd:generate-issue-spec "Refactor auth service to improve testability and reduce coupling"/cmd:generate-prd
Generate Product Requirements Document (PRD) before implementation.
Usage:
/cmd:generate-prd [context]Arguments:
context(optional) - Feature description or requirements
What it does:
- Analyzes feature requirements and business value
- Documents user stories and success criteria
- Defines high-level technical approach
- Creates PRD folder without implementation spec
- Writes to
.agent/specs/todo/{timestamp}-{name}/prd.md - Updates
.agent/specs/index.json(no path field until spec added)
Example:
/cmd:generate-prd "Add dark mode support with system preference detection"Returns: JSON with spec_id, prd_file, next_command: "/cmd:add-spec [id]"
/cmd:add-spec
Add implementation spec to existing PRD folder.
Usage:
/cmd:add-spec <spec-id>Arguments:
spec-id- 10-digit spec ID of existing folder with PRD
What it does:
- Reads existing PRD from folder (if present)
- Detects spec type from conversation (feature/bug/issue)
- Routes to appropriate generate command
- Writes spec.md to existing folder
- Updates index.json with path field
Example:
# 1. Generate PRD first
/cmd:generate-prd "Add OAuth authentication"
# Returns: { "spec_id": "2511131522", ... }
# 2. Add implementation spec
/cmd:add-spec 2511131522Use case: Separate planning (PRD) from detailed implementation spec.
Spec Implementation
/cmd:implement-spec
Implement feature from spec file.
Usage:
/cmd:implement-spec <spec-id-or-name-or-path>Arguments:
spec-id-or-name-or-path- Spec ID (10 digits), feature name, or full path
What it does:
- Reads spec file from
.agent/specs/ - Updates status to "in-progress"
- Implements each task in order
- Checks off tasks as completed
- Runs validation (build, tests, lint)
- Updates status to "review"
Example:
/cmd:implement-spec 2511161056 # By ID
/cmd:implement-spec oauth-authentication # By name
/cmd:implement-spec .agent/specs/todo/2511161056-oauth/spec.md # By path/cmd:review-spec-implementation
Review implementation against spec and document findings.
Usage:
/cmd:review-spec-implementation <spec-id-or-name-or-path>Arguments:
spec-id-or-name-or-path- Spec identifier
What it does:
- Reads spec and implementation
- Verifies all tasks completed
- Checks for deviations from spec
- Runs validation (tests, build, lint)
- Documents findings in review file
- Suggests fixes if needed
Example:
/cmd:review-spec-implementation 2511161056Spec Management
/cmd:list-specs
List all specs by folder and/or filter by status.
Usage:
/cmd:list-specs [folder] [--search keyword] [--sort field]Arguments:
folder(optional) - Filter by folder:todo,in-progress,done,backlog--search(optional) - Search specs by keyword--sort(optional) - Sort by field:complexity,created,updated
Example:
/cmd:list-specs todo # All todo specs
/cmd:list-specs todo --search "auth" # Todo specs with "auth"
/cmd:list-specs --sort complexity # All specs by complexity/cmd:move-spec
Move spec between workflow folders (backlog → todo → in-progress → done).
Usage:
/cmd:move-spec <spec-id-or-name> <target-folder>Arguments:
spec-id-or-name- Spec identifiertarget-folder- Destination:backlog,todo,in-progress, ordone
What it does:
- Moves spec folder to target directory
- Updates status in spec file
- Updates
.agent/specs/index.json
Example:
/cmd:move-spec 2511161056 in-progress
/cmd:move-spec oauth-auth done/cmd:remove-spec
Delete spec folder and remove from index.
Usage:
/cmd:remove-spec <spec-id-or-name-or-path>Caution: This permanently deletes the spec folder.
Example:
/cmd:remove-spec 2511161056Using Commands in Workflows
Slash commands can be called programmatically from workflows:
import { buildSlashCommand } from "agentcmd-workflows";
await step.agent("generate-spec", {
agent: "claude",
json: true,
prompt: buildSlashCommand("/cmd:generate-feature-spec", {
context: "Add dark mode support",
}),
});The buildSlashCommand helper formats slash commands with proper argument structure.
Creating Custom Commands
Create your own slash commands in .claude/commands/:
# Create command file
cat > .claude/commands/analyze-security.md << 'EOF'
Analyze codebase for security vulnerabilities.
Steps:
1. Scan for common vulnerabilities (SQL injection, XSS, etc.)
2. Check dependencies for known issues
3. Review authentication/authorization code
4. Generate security report
EOF
# Use it
/analyze-securitySee: Type-Safe Slash Commands for full tutorial.
Command Best Practices
Spec-Driven Workflow
Use commands to follow the spec-driven development flow:
# 1. Generate spec
/cmd:generate-feature-spec "Add user authentication"
# 2. Implement
/cmd:implement-spec 2511161056
# 3. Review
/cmd:review-spec-implementation 2511161056
# 4. Move to done
/cmd:move-spec 2511161056 doneIterative Development
Use commands iteratively for complex features:
# Start implementation
/cmd:implement-spec my-feature
# Review progress (finds issues)
/cmd:review-spec-implementation my-feature
# Continue implementation (fixes issues)
/cmd:implement-spec my-feature
# Final review (passes)
/cmd:review-spec-implementation my-featureRelated
- Agents - How agents execute slash commands
- Spec-Driven Development - Understanding spec structure
- Type-Safe Commands - Create your own
- Workflow Definition - Build custom workflows
- CLI Reference - Command-line interface