Claude Code Slash Commands
July 15, 2025 ยท View on GitHub
Overview
Context Forge now generates a comprehensive set of slash commands for Claude Code, enabling powerful AI-assisted development workflows. These commands are stored in .claude/commands/ and provide structured, repeatable patterns for common development tasks.
How Slash Commands Work
Command Structure
Each slash command is a markdown file in .claude/commands/ with this format:
name: command-name
description: Brief description of the command
category: PRPs|context|implementation|testing|documentation|custom
---
# Command Title: $ARGUMENTS
[Detailed instructions for Claude]
Using Commands
In Claude Code, invoke commands by typing:
/command-name your arguments here
The $ARGUMENTS placeholder is replaced with everything after the command name.
Command Categories
๐ฏ PRP Commands
/prp-create
Generate comprehensive PRPs with deep research and context gathering.
Usage: /prp-create user authentication system
Process:
- Analyzes codebase for patterns
- Researches external documentation
- Identifies gotchas and best practices
- Generates context-rich PRP with validation gates
/prp-execute
Execute a PRP with built-in validation loops.
Usage: /prp-execute authentication-prp
Features:
- Reads PRP from
PRPs/directory - Implements step-by-step
- Runs validation after each step
- Auto-fixes issues
- Confirms all tests pass
/parallel-prp-create
Create multiple interdependent PRPs simultaneously.
Usage: /parallel-prp-create auth, user-management, permissions
Benefits:
- Considers feature interactions
- Shared context across PRPs
- Consistent architecture
/prp-validate
Check PRP completeness and quality.
Usage: /prp-validate authentication-prp
Checks:
- Required sections present
- Validation gates defined
- Context sufficiency
- Task clarity
/prp-add-docs
Add critical documentation to ai_docs for future reference.
Usage: /prp-add-docs https://docs.example.com/auth-guide
๐ Context Commands
/prime-context
NEW: Smart project detection and architect mode
Load essential project knowledge and automatically switch to appropriate mode.
Usage: /prime-context
Smart Features:
- Project State Detection: Automatically identifies new vs existing projects
- Mode Switching: Different behavior based on project type
- Architect Mode: For new projects, Claude becomes Lead Software Architect
- Analysis Mode: For existing projects, provides comprehensive codebase analysis
New Project Mode:
- ๐๏ธ Architect Mode Activated: Claude takes charge as Lead Software Architect
- ๐ TodoWrite Integration: Creates concrete development tasks
- ๐ Immediate Implementation: Starts building instead of just analyzing
- ๐ซ Clean Commits: Enforces proper commit message format
Existing Project Mode:
- ๐ Comprehensive Analysis: Deep dive into codebase structure
- ๐ Strategic Recommendations: Actionable improvement suggestions
- ๐ฏ Context Loading: Project structure, patterns, and conventions
/analyze-codebase
Deep dive into specific codebase areas.
Usage: /analyze-codebase authentication flow
Analysis includes:
- File relationships
- Data flow
- Dependencies
- Patterns used
/context-refresh
Update context with recent changes.
Usage: /context-refresh
Updates:
- Modified files
- New dependencies
- Configuration changes
/explain-architecture
Document and explain system architecture.
Usage: /explain-architecture API layer
๐ ๏ธ Implementation Commands
/implement-feature
Implement features with tests and validation.
Usage: /implement-feature dark mode toggle
Process:
- Research similar features
- Plan implementation
- Write code with tests
- Run validation gates
- Ensure quality
/fix-bug
Diagnose and fix bugs with regression tests.
Usage: /fix-bug login fails with special characters
Workflow:
- Reproduce issue
- Identify root cause
- Implement fix
- Add regression tests
- Verify fix
/refactor-code
Safe refactoring with test coverage.
Usage: /refactor-code user service to use dependency injection
Safety measures:
- Maintains test coverage
- Incremental changes
- Validation after each step
/performance-optimize
Optimize code with benchmarking.
Usage: /performance-optimize database queries in user service
Includes:
- Performance profiling
- Optimization strategies
- Before/after benchmarks
- Regression testing
๐งช Testing Commands
/test-create
Generate comprehensive test suites.
Usage: /test-create user authentication module
Coverage:
- Unit tests
- Integration tests
- Edge cases
- Error scenarios
/test-coverage
Analyze and improve test coverage.
Usage: /test-coverage
Actions:
- Identify untested code
- Generate missing tests
- Improve test quality
/test-integration
Create end-to-end integration tests.
Usage: /test-integration user registration flow
๐ Documentation Commands
/doc-api
Generate API documentation.
Usage: /doc-api user endpoints
Generates:
- Endpoint descriptions
- Request/response examples
- Error codes
- Authentication requirements
/doc-architecture
Create architecture documentation.
Usage: /doc-architecture
Includes:
- System overview
- Component diagrams
- Data flow
- Design decisions
/doc-user-guide
Generate user-facing documentation.
Usage: /doc-user-guide authentication features
๐ Deployment Commands
/deploy-checklist
Generate deployment checklist.
Usage: /deploy-checklist production
Covers:
- Pre-deployment tests
- Configuration validation
- Migration steps
- Rollback procedures
/env-setup
Set up environment configurations.
Usage: /env-setup staging
๐ Debugging Commands
/debug-analyze
Analyze issues with debugging strategies.
Usage: /debug-analyze memory leak in background jobs
/log-analysis
Analyze logs for patterns and issues.
Usage: /log-analysis last 24 hours
๐ Code Review Commands
/review-code
Perform AI code review.
Usage: /review-code src/services/auth.ts
Reviews:
- Code quality
- Best practices
- Security issues
- Performance concerns
/security-scan
Security-focused code analysis.
Usage: /security-scan authentication module
๐๏ธ Scaffolding Commands
/scaffold-module
Generate module boilerplate.
Usage: /scaffold-module payment-processing
/scaffold-api
Create API endpoint structure.
Usage: /scaffold-api /api/v2/orders CRUD
Custom Commands
Creating Custom Commands
- Create a new file in
.claude/commands/custom/:
name: my-project-command
description: Project-specific workflow
category: custom
---
# My Custom Command: $ARGUMENTS
## Purpose
[What this command does]
## Steps
1. [Step 1 with specific project conventions]
2. [Step 2 with validation]
3. [Step 3 with output]
## Validation
- [ ] Tests pass
- [ ] Linting clean
- [ ] Project-specific checks
- Use in Claude Code:
/my-project-command parameters
Best Practices for Custom Commands
- Be Specific: Include exact file paths, patterns, and conventions
- Add Validation: Always include verification steps
- Reference Examples: Point to existing code patterns
- Include Context: Add links to relevant documentation
- Error Handling: Specify what to do when things go wrong
Advanced Usage
Command Chaining
Commands can reference other commands for complex workflows:
/prime-context
/analyze-codebase authentication
/prp-create OAuth2 integration
/prp-execute oauth2-integration
Parameterized Commands
Commands support multiple parameters:
/implement-feature "user profiles" --priority=high --tests=comprehensive
Conditional Execution
Commands can include conditional logic:
## If using TypeScript
- Add type definitions
- Run type checking
## If using JavaScript
- Add JSDoc comments
- Run linting
Integration with PRP Runner
Slash commands work seamlessly with the PRP runner:
- Create PRP:
/prp-create feature-name - Review generated PRP
- Execute:
context-forge run-prp feature-name
Or directly in Claude Code:
/prp-execute feature-name
Troubleshooting
Command Not Found
- Ensure
.claude/commands/exists - Check command name spelling
- Verify file has correct frontmatter
Arguments Not Replaced
- Ensure using
$ARGUMENTS(all caps) - Check for typos in placeholder
Command Not Working as Expected
- Review command instructions
- Check for project-specific requirements
- Ensure all dependencies available
Examples
Full Feature Implementation
# 1. Load context
/prime-context
# 2. Create comprehensive PRP
/prp-create user notification system with email and SMS
# 3. Review and execute
/prp-execute user-notification-system
# 4. Generate tests
/test-create notification service
# 5. Document
/doc-api notification endpoints
Bug Fix Workflow
# 1. Analyze the issue
/debug-analyze users report login timeout
# 2. Fix with tests
/fix-bug login timeout after 30 seconds
# 3. Verify
/test-integration login flow
Performance Optimization
# 1. Analyze current performance
/performance-analyze API response times
# 2. Optimize
/performance-optimize database queries
# 3. Verify improvements
/benchmark-compare before after
Conclusion
Slash commands transform Claude Code into a powerful development orchestrator, providing:
- Consistency: Repeatable workflows
- Quality: Built-in validation
- Efficiency: Complex tasks in one command
- Customization: Project-specific workflows
- Knowledge: Embedded best practices
Use them to accelerate development while maintaining high code quality!