Learn how to modify existing commands and create new ones to fit your specific workflow needs.
Each command follows a consistent markdown structure:
# Command Name
Brief description of what the command does.
## Instructions
Detailed step-by-step workflow that Claude Code will follow when executing the command.
1. **Step Category**
- Specific action items
- Tool usage recommendations
- Quality checkpoints
2. **Next Step Category**
- Additional actions
- Validation steps
- Output requirementsTo customize a command for your needs:
-
Find the Command File:
# Commands are located in: .claude/commands/command-name.md -
Edit the Instructions:
# Open the command file in your editor code .claude/commands/code-review.md -
Modify the Workflow:
- Add project-specific steps
- Remove unnecessary steps
- Adjust tool preferences
- Update quality criteria
Original command might include generic steps. Customize for your stack:
# Code Review
## Instructions
1. **Technology Stack Analysis**
- Check React components for hooks usage patterns
- Verify TypeScript strict mode compliance
- Review Next.js routing conventions
- Assess Tailwind CSS class organization
2. **Project-Specific Quality Checks**
- Ensure all API calls use our custom `useAPI` hook
- Verify component props match our TypeScript interfaces
- Check that error boundaries are properly implemented
- Review accessibility compliance with our WCAG standardsInclude project-specific information:
## Instructions
1. **Pre-Analysis Setup**
- Review project documentation in `/docs` folder
- Check current sprint goals in SPRINT.md
- Verify compliance with team coding standards in STANDARDS.md
- Consider architectural decisions recorded in `/docs/adrs/`# Create a new command file
touch .claude/commands/deploy-staging.md# Deploy to Staging
Deploy the current branch to staging environment with pre-deployment checks.
## Instructions
1. **Pre-deployment Validation**
- Run all tests and ensure they pass
- Verify build process completes successfully
- Check for any uncommitted changes
- Validate environment variables are set
2. **Deployment Process**
- Build the application for staging
- Run database migrations if needed
- Deploy to staging server
- Verify deployment health checks
3. **Post-deployment Verification**
- Run smoke tests against staging
- Check application logs for errors
- Verify critical user flows work
- Update deployment tracking# Test the new command in Claude Code
claude code
/project:deploy-stagingCommands can accept arguments via the $ARGUMENTS placeholder:
# Create Feature
Create a new feature with the name provided in arguments.
## Instructions
1. **Feature Planning**
- Create feature branch: `feature/$ARGUMENTS`
- Generate feature specification for "$ARGUMENTS"
- Plan component architecture for $ARGUMENTS feature
2. **Implementation**
- Create base components for $ARGUMENTS
- Implement core functionality
- Add tests for $ARGUMENTS featureAdd logic based on project characteristics:
## Instructions
1. **Framework Detection**
- If package.json contains "react": Use React-specific patterns
- If package.json contains "vue": Use Vue-specific patterns
- If Cargo.toml exists: Use Rust-specific approaches
- If requirements.txt exists: Use Python-specific tools
2. **Environment-Specific Steps**
- Development: Include debugging tools and verbose logging
- Production: Focus on performance and security
- Testing: Emphasize test coverage and mockingCreate complex workflows that span multiple sessions:
# Epic Implementation
Implement a large feature across multiple work sessions.
## Instructions
1. **Session 1: Planning and Architecture**
- Break down epic into user stories
- Design system architecture changes
- Create technical specification
- Set up project tracking
2. **Session 2-N: Implementation Phases**
- Implement one user story at a time
- Create tests for each component
- Review and refactor after each story
- Update documentation continuously
3. **Final Session: Integration and Deployment**
- Integrate all components
- Run comprehensive testing
- Prepare deployment pipeline
- Create deployment documentation# JS Code Review
## Instructions
1. **JavaScript-Specific Checks**
- Verify ESLint configuration and compliance
- Check TypeScript types and interfaces
- Review package.json dependencies for security
- Assess bundle size and optimization opportunities
2. **Framework-Specific Analysis**
- React: Check hooks usage, component patterns, state management
- Node.js: Review API design, middleware usage, error handling
- Next.js: Assess routing, SSR/SSG usage, performance# Python Code Review
## Instructions
1. **Python-Specific Analysis**
- Check PEP 8 compliance
- Review virtual environment setup
- Assess requirements.txt/pyproject.toml
- Verify type hints usage
2. **Framework-Specific Checks**
- Django: Review models, views, URL patterns
- Flask: Check route definitions, middleware
- FastAPI: Verify async patterns, Pydantic modelsEach command should have a single, clear purpose:
# Good: Focused command
# Security Audit
# Avoid: Kitchen-sink command
# Code Review and Security Audit and Performance CheckOrganize instructions with descriptive headings:
1. **Pre-Analysis Setup**
2. **Core Analysis**
3. **Report Generation**
4. **Follow-up Actions**Add validation steps throughout:
2. **Implementation**
- Create the feature component
- **Quality Gate**: Ensure component passes TypeScript compilation
- Add unit tests
- **Quality Gate**: Verify test coverage above 80%Avoid hardcoding specific values:
# Good: Generic approach
- Review all API endpoints for security vulnerabilities
# Avoid: Hardcoded specifics
- Review the /api/users endpoint for SQL injectionHelp Claude understand the project context:
1. **Context Analysis**
- Review project README for domain understanding
- Check ARCHITECTURE.md for system design
- Understand business requirements from requirements/Create a shared command set for your team:
# Create team-specific commands directory
mkdir team-commands/
# Copy base commands and customize
cp .claude/commands/*.md team-commands/
# Customize for team standards
# Share via git repository
git add team-commands/
git commit -m "Add team-specific Claude commands"Embed company standards into commands:
## Instructions
1. **Company Standards Compliance**
- Verify code follows CompanyName coding standards
- Check that security review checklist is completed
- Ensure accessibility standards (WCAG 2.1 AA) are met
- Validate API design follows company REST guidelines-
Check File Format:
# Ensure proper markdown format head -n 10 .claude/commands/your-command.md -
Validate Structure:
- First line must be
# Command Name - Must have
## Instructionssection - Use consistent markdown formatting
- First line must be
-
Test Incrementally:
- Start with simple commands
- Add complexity gradually
- Test each change
If Claude struggles with complex commands:
-
Break Into Smaller Commands:
# Instead of one large command /project:full-deployment # Create smaller, focused commands /project:pre-deploy-check /project:deploy-app /project:post-deploy-verify
-
Simplify Instructions:
- Use clear, actionable language
- Avoid ambiguous requirements
- Provide specific examples
Add debugging information to commands:
## Instructions
1. **Debug Information**
- Print current working directory
- List relevant files in project
- Show current git branch and status
- Display environment variables (if safe)
2. **Validation Steps**
- Confirm each step completion before proceeding
- Log important decisions and findings
- Save intermediate results for reviewThis customization guide should help you tailor the commands to your specific needs and create new workflows that match your development process.