Slash Commands Library
Ready-to-use slash commands for common development tasks. Copy, customize, and add to your project.
/review-pr
Git & GitHubReview a pull request with detailed feedback on code quality, potential bugs, and best practices
Review this pull request:
- Check for bugs and edge cases
- Verify code follows best practices
- Suggest performance improvements
- Check test coverage
- Review documentation
Focus on: {describe focus areas}Example Usage:
Review this pull request focusing on security and error handling
/write-tests
TestingGenerate comprehensive test cases for a function or component
Write comprehensive tests for {file/function name}:
- Unit tests for all functions
- Edge cases and error conditions
- Mock external dependencies
- Aim for 90%+ coverage
- Use {testing framework}
Include both positive and negative test cases.Example Usage:
Write comprehensive tests for src/utils/auth.ts using Jest
/explain-code
DocumentationExplain what a piece of code does in plain English
Explain this code in simple terms:
- What does it do?
- How does it work?
- What are the key concepts?
- Any potential issues or gotchas?
- Suggestions for improvement
Explain like I'm a {beginner/intermediate/advanced} developer.Example Usage:
Explain this code like I'm an intermediate developer
/optimize-performance
OptimizationAnalyze and optimize code for better performance
Analyze and optimize this code for performance: - Identify bottlenecks - Suggest algorithmic improvements - Recommend caching strategies - Check for unnecessary re-renders (React) - Database query optimization (if applicable) Provide before/after comparisons.
Example Usage:
Optimize this React component that's causing slow renders
/refactor-clean
RefactoringRefactor code to be cleaner, more maintainable, and follow best practices
Refactor this code to improve: - Readability and maintainability - Follow SOLID principles - Extract reusable functions - Remove code duplication - Improve naming conventions - Add proper error handling Explain each change and why it's better.
Example Usage:
Refactor this messy React component
/debug-issue
DebuggingDebug an issue by analyzing error messages and code context
Help debug this issue:
Error: {paste error message}
Code context: {describe where it happens}
What I've tried: {list attempts}
Help me:
- Understand the root cause
- Fix the issue
- Prevent it from happening again
- Add tests to catch similar issuesExample Usage:
Help debug this TypeError: Cannot read property 'map' of undefined
/add-typescript
TypeScriptConvert JavaScript code to TypeScript with proper types
Convert this JavaScript to TypeScript: - Add proper type definitions - Create interfaces for objects - Use generics where appropriate - Add JSDoc comments - Ensure strict type safety Make types as specific as possible.
Example Usage:
Convert this JavaScript file to TypeScript with strict types
/create-api
API DevelopmentCreate a RESTful API endpoint with proper structure
Create a REST API endpoint for {resource}:
- Route definition
- Request validation
- Business logic
- Error handling
- Response formatting
- Tests
- Documentation
Framework: {framework name}
Database: {database type}Example Usage:
Create a REST API endpoint for user registration using Express and MongoDB
/write-docs
DocumentationGenerate comprehensive documentation for code
Write documentation for {file/module/function}:
- Overview and purpose
- Parameters and return values
- Usage examples
- Edge cases
- Related functions/modules
Format: {JSDoc/README/API docs}Example Usage:
Write JSDoc documentation for all functions in utils/helpers.ts
/security-audit
SecurityAudit code for security vulnerabilities
Perform security audit on {file/feature}:
- Check for common vulnerabilities (XSS, SQL injection, etc.)
- Validate input sanitization
- Check authentication/authorization
- Review secret management
- Identify potential attack vectors
- Suggest fixes
Follow OWASP Top 10 guidelines.Example Usage:
Security audit on the user authentication flow
/migrate-db
DatabaseCreate a database migration script
Create database migration for: {describe changes}
Include:
- Up migration (apply changes)
- Down migration (rollback)
- Data preservation strategy
- Index management
- Validation
Database: {PostgreSQL/MySQL/MongoDB}
ORM: {Prisma/TypeORM/Sequelize}Example Usage:
Create migration to add email verification to users table in PostgreSQL
/setup-ci
DevOpsSet up CI/CD pipeline configuration
Create CI/CD pipeline for {project}:
- Run tests
- Lint code
- Build project
- Deploy to {environment}
- Run security scans
- Notify on failure
Platform: {GitHub Actions/GitLab CI/Circle CI}Example Usage:
Set up GitHub Actions to test and deploy Next.js app to Vercel
How to Use Slash Commands
1. Create the command file
.claude/commands/command-name.md2. Copy the command template
Click "Copy" on any command above and paste it into your .md file
3. Customize for your project
Replace placeholders like {framework} with your actual tools
4. Use in Claude Code
Type /command-name in Claude Code CLI to run it