Initial commit: Claude How To project
Added comprehensive examples for Claude Code features including slash commands, subagents, memory, MCP protocol, skills, and plugins with documentation and quick reference guides. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
59
01-slash-commands/README.md
Normal file
59
01-slash-commands/README.md
Normal file
@@ -0,0 +1,59 @@
|
||||
# Slash Commands Examples
|
||||
|
||||
This folder contains example slash commands that can be used with Claude Code.
|
||||
|
||||
## Installation
|
||||
|
||||
Copy these files to your project's `.claude/commands/` directory:
|
||||
|
||||
```bash
|
||||
cp *.md /path/to/your/project/.claude/commands/
|
||||
```
|
||||
|
||||
## Available Commands
|
||||
|
||||
### 1. `/optimize` - Code Optimization
|
||||
Analyzes code for performance issues, memory leaks, and optimization opportunities.
|
||||
|
||||
**Usage:**
|
||||
```
|
||||
/optimize
|
||||
[Paste your code]
|
||||
```
|
||||
|
||||
### 2. `/pr` - Pull Request Preparation
|
||||
Guides you through PR preparation checklist including linting, testing, and commit message formatting.
|
||||
|
||||
**Usage:**
|
||||
```
|
||||
/pr
|
||||
```
|
||||
|
||||
### 3. `/generate-api-docs` - API Documentation Generator
|
||||
Generates comprehensive API documentation from source code.
|
||||
|
||||
**Usage:**
|
||||
```
|
||||
/generate-api-docs
|
||||
```
|
||||
|
||||
## File Structure
|
||||
|
||||
Place commands in your project:
|
||||
```
|
||||
project/
|
||||
├── .claude/
|
||||
│ └── commands/
|
||||
│ ├── optimize.md
|
||||
│ ├── pr.md
|
||||
│ └── docs/
|
||||
│ └── generate-api-docs.md
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
- Use clear, action-oriented names
|
||||
- Document trigger words in description
|
||||
- Keep commands focused on single task
|
||||
- Version control project commands
|
||||
- Organize in subdirectories for categories
|
||||
21
01-slash-commands/generate-api-docs.md
Normal file
21
01-slash-commands/generate-api-docs.md
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
name: Generate API Documentation
|
||||
description: Create comprehensive API documentation from source code
|
||||
tags: documentation, api
|
||||
---
|
||||
|
||||
# API Documentation Generator
|
||||
|
||||
Generate API documentation by:
|
||||
|
||||
1. Scanning all files in `/src/api/`
|
||||
2. Extracting function signatures and JSDoc comments
|
||||
3. Organizing by endpoint/module
|
||||
4. Creating markdown with examples
|
||||
5. Including request/response schemas
|
||||
6. Adding error documentation
|
||||
|
||||
Output format:
|
||||
- Markdown file in `/docs/api.md`
|
||||
- Include curl examples for all endpoints
|
||||
- Add TypeScript types
|
||||
21
01-slash-commands/optimize.md
Normal file
21
01-slash-commands/optimize.md
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
name: Code Optimization
|
||||
description: Analyze code for performance issues and suggest optimizations
|
||||
tags: performance, analysis
|
||||
---
|
||||
|
||||
# Code Optimization
|
||||
|
||||
Review the provided code for the following issues in order of priority:
|
||||
|
||||
1. **Performance bottlenecks** - identify O(n²) operations, inefficient loops
|
||||
2. **Memory leaks** - find unreleased resources, circular references
|
||||
3. **Algorithm improvements** - suggest better algorithms or data structures
|
||||
4. **Caching opportunities** - identify repeated computations
|
||||
5. **Concurrency issues** - find race conditions or threading problems
|
||||
|
||||
Format your response with:
|
||||
- Issue severity (Critical/High/Medium/Low)
|
||||
- Location in code
|
||||
- Explanation
|
||||
- Recommended fix with code example
|
||||
27
01-slash-commands/pr.md
Normal file
27
01-slash-commands/pr.md
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
name: Prepare Pull Request
|
||||
description: Clean up code, stage changes, and prepare a pull request
|
||||
tags: git, workflow
|
||||
---
|
||||
|
||||
# Pull Request Preparation Checklist
|
||||
|
||||
Before creating a PR, execute these steps:
|
||||
|
||||
1. Run linting: `prettier --write .`
|
||||
2. Run tests: `npm test`
|
||||
3. Review git diff: `git diff HEAD`
|
||||
4. Stage changes: `git add .`
|
||||
5. Create commit message following conventional commits:
|
||||
- `fix:` for bug fixes
|
||||
- `feat:` for new features
|
||||
- `docs:` for documentation
|
||||
- `refactor:` for code restructuring
|
||||
- `test:` for test additions
|
||||
- `chore:` for maintenance
|
||||
|
||||
6. Generate PR summary including:
|
||||
- What changed
|
||||
- Why it changed
|
||||
- Testing performed
|
||||
- Potential impacts
|
||||
Reference in New Issue
Block a user