217 lines
3.9 KiB
Markdown
217 lines
3.9 KiB
Markdown
|
|
# Command Examples
|
||
|
|
|
||
|
|
Complete, working slash command examples.
|
||
|
|
|
||
|
|
## Security Review
|
||
|
|
|
||
|
|
```markdown
|
||
|
|
---
|
||
|
|
description: Comprehensive security review of code files
|
||
|
|
allowed-tools: Read(*), Grep(*)
|
||
|
|
argument-hint: <files...>
|
||
|
|
---
|
||
|
|
|
||
|
|
Perform a security audit on: $ARGUMENTS
|
||
|
|
|
||
|
|
Check for:
|
||
|
|
1. SQL injection vulnerabilities
|
||
|
|
2. XSS vulnerabilities
|
||
|
|
3. Authentication/authorization issues
|
||
|
|
4. Hardcoded secrets or credentials
|
||
|
|
5. Unsafe deserialization
|
||
|
|
6. Path traversal vulnerabilities
|
||
|
|
|
||
|
|
For each issue found:
|
||
|
|
- Severity level (Critical/High/Medium/Low)
|
||
|
|
- Location (file:line)
|
||
|
|
- Explanation of the vulnerability
|
||
|
|
- Recommended fix with code example
|
||
|
|
```
|
||
|
|
|
||
|
|
**Usage**: `/security-review @src/auth.js @src/api.js`
|
||
|
|
|
||
|
|
## Commit + Push
|
||
|
|
|
||
|
|
```markdown
|
||
|
|
---
|
||
|
|
description: Review changes, commit, and push to remote
|
||
|
|
allowed-tools: Bash(git:*)
|
||
|
|
---
|
||
|
|
|
||
|
|
!git status
|
||
|
|
!git diff
|
||
|
|
|
||
|
|
Review the changes above and:
|
||
|
|
1. Create an appropriate commit message
|
||
|
|
2. Commit the changes
|
||
|
|
3. Push to remote
|
||
|
|
|
||
|
|
Ask for confirmation before pushing.
|
||
|
|
```
|
||
|
|
|
||
|
|
**Usage**: `/commit-push`
|
||
|
|
|
||
|
|
## Test Generator
|
||
|
|
|
||
|
|
```markdown
|
||
|
|
---
|
||
|
|
description: Generate comprehensive tests for a function
|
||
|
|
argument-hint: <file> <function-name>
|
||
|
|
model: claude-sonnet-4
|
||
|
|
---
|
||
|
|
|
||
|
|
For the function "$2" in @$1:
|
||
|
|
|
||
|
|
1. Analyze the function's behavior
|
||
|
|
2. Identify edge cases
|
||
|
|
3. Generate comprehensive unit tests including:
|
||
|
|
- Happy path tests
|
||
|
|
- Edge case tests
|
||
|
|
- Error condition tests
|
||
|
|
- Boundary value tests
|
||
|
|
|
||
|
|
Use the project's existing test framework and patterns.
|
||
|
|
```
|
||
|
|
|
||
|
|
**Usage**: `/generate-tests src/utils.js calculateTotal`
|
||
|
|
|
||
|
|
## Documentation Generator
|
||
|
|
|
||
|
|
```markdown
|
||
|
|
---
|
||
|
|
description: Generate JSDoc/TSDoc comments for code
|
||
|
|
---
|
||
|
|
|
||
|
|
Generate comprehensive documentation for: $ARGUMENTS
|
||
|
|
|
||
|
|
Include:
|
||
|
|
- Function/class description
|
||
|
|
- Parameter types and descriptions
|
||
|
|
- Return value description
|
||
|
|
- Usage examples
|
||
|
|
- Edge cases and error conditions
|
||
|
|
```
|
||
|
|
|
||
|
|
**Usage**: `/document @src/api/users.js`
|
||
|
|
|
||
|
|
## API Endpoint Creator
|
||
|
|
|
||
|
|
```markdown
|
||
|
|
---
|
||
|
|
description: Create REST API endpoint with tests
|
||
|
|
argument-hint: <method> <path> <description>
|
||
|
|
---
|
||
|
|
|
||
|
|
Create a $1 endpoint at "$2" that $3
|
||
|
|
|
||
|
|
Include:
|
||
|
|
1. Route handler with validation
|
||
|
|
2. Controller logic
|
||
|
|
3. Unit tests
|
||
|
|
4. Integration tests
|
||
|
|
5. API documentation
|
||
|
|
```
|
||
|
|
|
||
|
|
**Usage**: `/api POST /users/login "authenticates a user"`
|
||
|
|
|
||
|
|
## Refactor Command
|
||
|
|
|
||
|
|
```markdown
|
||
|
|
---
|
||
|
|
description: Refactor code for better maintainability
|
||
|
|
---
|
||
|
|
|
||
|
|
Refactor $ARGUMENTS
|
||
|
|
|
||
|
|
Focus on:
|
||
|
|
- Extract repeated code into functions
|
||
|
|
- Improve naming clarity
|
||
|
|
- Reduce complexity
|
||
|
|
- Add error handling
|
||
|
|
- Maintain existing behavior
|
||
|
|
|
||
|
|
Show before/after comparison.
|
||
|
|
```
|
||
|
|
|
||
|
|
**Usage**: `/refactor @src/legacy.js`
|
||
|
|
|
||
|
|
## Performance Analyzer
|
||
|
|
|
||
|
|
```markdown
|
||
|
|
---
|
||
|
|
description: Analyze code for performance bottlenecks
|
||
|
|
allowed-tools: Read(*), Grep(*)
|
||
|
|
---
|
||
|
|
|
||
|
|
Analyze $ARGUMENTS for performance issues
|
||
|
|
|
||
|
|
Check for:
|
||
|
|
1. O(n²) or worse algorithms
|
||
|
|
2. Unnecessary re-renders (React)
|
||
|
|
3. Memory leaks
|
||
|
|
4. Inefficient database queries
|
||
|
|
5. Large bundle sizes
|
||
|
|
|
||
|
|
Provide specific optimization suggestions with code examples.
|
||
|
|
```
|
||
|
|
|
||
|
|
**Usage**: `/performance @src/components/DataTable.tsx`
|
||
|
|
|
||
|
|
## Dependency Audit
|
||
|
|
|
||
|
|
```markdown
|
||
|
|
---
|
||
|
|
description: Audit project dependencies
|
||
|
|
allowed-tools: Bash(npm:*), Read(package.json)
|
||
|
|
---
|
||
|
|
|
||
|
|
!npm outdated
|
||
|
|
!npm audit
|
||
|
|
|
||
|
|
Review dependencies and:
|
||
|
|
1. Identify security vulnerabilities
|
||
|
|
2. Find outdated packages
|
||
|
|
3. Detect unused dependencies
|
||
|
|
4. Recommend updates or replacements
|
||
|
|
```
|
||
|
|
|
||
|
|
**Usage**: `/audit-deps`
|
||
|
|
|
||
|
|
## Code Cleanup
|
||
|
|
|
||
|
|
```markdown
|
||
|
|
---
|
||
|
|
description: Clean up code formatting and style
|
||
|
|
allowed-tools: Read(*), Write(*), Bash(npx prettier:*)
|
||
|
|
---
|
||
|
|
|
||
|
|
Clean up $ARGUMENTS
|
||
|
|
|
||
|
|
1. Remove unused imports
|
||
|
|
2. Fix formatting issues
|
||
|
|
3. Resolve linter warnings
|
||
|
|
4. Remove console.logs
|
||
|
|
5. Add missing type annotations
|
||
|
|
```
|
||
|
|
|
||
|
|
**Usage**: `/cleanup @src/**/*.ts`
|
||
|
|
|
||
|
|
## Migration Helper
|
||
|
|
|
||
|
|
```markdown
|
||
|
|
---
|
||
|
|
description: Help migrate code to new API/library version
|
||
|
|
argument-hint: <files> <from-version> <to-version>
|
||
|
|
---
|
||
|
|
|
||
|
|
Migrate $1 from version $2 to $3
|
||
|
|
|
||
|
|
1. Identify breaking changes
|
||
|
|
2. Update deprecated APIs
|
||
|
|
3. Fix type errors
|
||
|
|
4. Update tests
|
||
|
|
5. Verify functionality
|
||
|
|
```
|
||
|
|
|
||
|
|
**Usage**: `/migrate @src/app.js 3.0 4.0`
|