refactor: Reorganize repository structure for optimal learning path

Reorder folders based on learning dependencies, complexity, and frequency of use:
- 01-slash-commands (unchanged) - Quick wins for beginners
- 02-memory (was 03) - Essential foundation
- 03-skills (was 05) - Auto-invoked capabilities
- 04-subagents (was 02) - Task delegation
- 05-mcp (was 04) - External integration
- 06-hooks (was 07) - Event automation
- 07-plugins (was 06) - Bundled solutions
- 08-checkpoints (unchanged) - Safe experimentation
- 09-advanced-features (unchanged) - Power user tools

Documentation improvements:
- Add LEARNING-ROADMAP.md with detailed milestones and exercises
- Simplify README.md for better scannability
- Consolidate Quick Start and Getting Started sections
- Combine Feature Comparison and Use Case Matrix tables
- Reorder README sections: Learning Path → Quick Reference → Getting Started
- Update all cross-references across module READMEs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Luong NGUYEN
2025-11-09 17:54:58 +01:00
parent 1df7ed4916
commit 5caeff2f1c
80 changed files with 747 additions and 259 deletions

596
07-plugins/README.md Normal file
View File

@@ -0,0 +1,596 @@
![Claude How To](../claude-howto-logo.svg)
# Claude Code Plugins
This folder contains complete plugin examples that bundle multiple Claude Code features into cohesive, installable packages.
## Overview
Claude Code Plugins are bundled collections of customizations (slash commands, subagents, MCP servers, and hooks) that install with a single command. They represent the highest-level extension mechanism—combining multiple features into cohesive, shareable packages.
## Plugin Architecture
```mermaid
graph TB
A["Plugin"]
B["Slash Commands"]
C["Subagents"]
D["MCP Servers"]
E["Hooks"]
F["Configuration"]
A -->|bundles| B
A -->|bundles| C
A -->|bundles| D
A -->|bundles| E
A -->|bundles| F
```
## Plugin Loading Process
```mermaid
sequenceDiagram
participant User
participant Claude as Claude Code
participant Plugin as Plugin Marketplace
participant Install as Installation
participant SlashCmds as Slash Commands
participant Subagents
participant MCPServers as MCP Servers
participant Hooks
participant Tools as Configured Tools
User->>Claude: /plugin install pr-review
Claude->>Plugin: Download plugin manifest
Plugin-->>Claude: Return plugin definition
Claude->>Install: Extract components
Install->>SlashCmds: Configure
Install->>Subagents: Configure
Install->>MCPServers: Configure
Install->>Hooks: Configure
SlashCmds-->>Tools: Ready to use
Subagents-->>Tools: Ready to use
MCPServers-->>Tools: Ready to use
Hooks-->>Tools: Ready to use
Tools-->>Claude: Plugin installed ✅
```
## Plugin Types & Distribution
| Type | Scope | Shared | Authority | Examples |
|------|-------|--------|-----------|----------|
| Official | Global | All users | Anthropic | PR Review, Security Guidance |
| Community | Public | All users | Community | DevOps, Data Science |
| Organization | Internal | Team members | Company | Internal standards, tools |
| Personal | Individual | Single user | Developer | Custom workflows |
## Plugin Definition Structure
```yaml
---
name: plugin-name
version: "1.0.0"
description: "What this plugin does"
author: "Your Name"
license: MIT
# Plugin metadata
tags:
- category
- use-case
# Requirements
requires:
- claude-code: ">=1.0.0"
# Components bundled
components:
- type: commands
path: commands/
- type: agents
path: agents/
- type: mcp
path: mcp/
- type: hooks
path: hooks/
# Configuration
config:
auto_load: true
enabled_by_default: true
---
```
## Plugin Structure Example
```
my-plugin/
├── plugin.yaml
├── commands/
│ ├── task-1.md
│ ├── task-2.md
│ └── workflows/
├── agents/
│ ├── specialist-1.md
│ ├── specialist-2.md
│ └── configs/
├── mcp/
│ ├── mcp-config.json
│ └── servers/
├── hooks/
│ ├── pre-deploy.js
│ └── post-merge.js
├── templates/
│ └── issue-template.md
├── scripts/
│ ├── helper-1.sh
│ └── helper-2.py
├── docs/
│ ├── README.md
│ └── USAGE.md
└── tests/
└── plugin.test.js
```
## Practical Examples
### Example 1: PR Review Plugin
**File:** `plugin.yaml`
```yaml
---
name: pr-review
version: "1.0.0"
description: Complete PR review workflow with security, testing, and docs
author: Anthropic
tags:
- code-review
- quality
- security
components:
- type: commands
path: commands/
- type: agents
path: agents/
- type: mcp
path: mcp/
- type: hooks
path: hooks/
---
```
**File:** `commands/review-pr.md`
```markdown
---
name: Review PR
description: Start comprehensive PR review with security and testing checks
---
# PR Review
This command initiates a complete pull request review including:
1. Security analysis
2. Test coverage verification
3. Documentation updates
4. Code quality checks
5. Performance impact assessment
```
**File:** `agents/security-reviewer.md`
```yaml
---
name: security-reviewer
description: Security-focused code review
tools: read, grep, diff
---
# Security Reviewer
Specializes in finding security vulnerabilities:
- Authentication/authorization issues
- Data exposure
- Injection attacks
- Secure configuration
```
**Installation:**
```bash
/plugin install pr-review
# Result:
# ✅ 3 slash commands installed
# ✅ 3 subagents configured
# ✅ 2 MCP servers connected
# ✅ 4 hooks registered
# ✅ Ready to use!
```
### Example 2: DevOps Plugin
**Components:**
```
devops-automation/
├── commands/
│ ├── deploy.md
│ ├── rollback.md
│ ├── status.md
│ └── incident.md
├── agents/
│ ├── deployment-specialist.md
│ ├── incident-commander.md
│ └── alert-analyzer.md
├── mcp/
│ ├── github-config.json
│ ├── kubernetes-config.json
│ └── prometheus-config.json
├── hooks/
│ ├── pre-deploy.js
│ ├── post-deploy.js
│ └── on-error.js
└── scripts/
├── deploy.sh
├── rollback.sh
└── health-check.sh
```
### Example 3: Documentation Plugin
**Bundled Components:**
```
documentation/
├── commands/
│ ├── generate-api-docs.md
│ ├── generate-readme.md
│ ├── sync-docs.md
│ └── validate-docs.md
├── agents/
│ ├── api-documenter.md
│ ├── code-commentator.md
│ └── example-generator.md
├── mcp/
│ ├── github-docs-config.json
│ └── slack-announce-config.json
└── templates/
├── api-endpoint.md
├── function-docs.md
└── adr-template.md
```
## Plugin Marketplace
```mermaid
graph TB
A["Plugin Marketplace"]
B["Official<br/>Anthropic"]
C["Community<br/>Marketplace"]
D["Enterprise<br/>Registry"]
A --> B
A --> C
A --> D
B -->|Categories| B1["Development"]
B -->|Categories| B2["DevOps"]
B -->|Categories| B3["Documentation"]
C -->|Search| C1["DevOps Automation"]
C -->|Search| C2["Mobile Dev"]
C -->|Search| C3["Data Science"]
D -->|Internal| D1["Company Standards"]
D -->|Internal| D2["Legacy Systems"]
D -->|Internal| D3["Compliance"]
```
## Plugin Installation & Lifecycle
```mermaid
graph LR
A["Discover"] -->|Browse| B["Marketplace"]
B -->|Select| C["Plugin Page"]
C -->|View| D["Components"]
D -->|Install| E["/plugin install"]
E -->|Extract| F["Configure"]
F -->|Activate| G["Use"]
G -->|Check| H["Update"]
H -->|Available| G
G -->|Done| I["Disable"]
I -->|Later| J["Enable"]
J -->|Back| G
```
## Plugin Features Comparison
| Feature | Slash Command | Skill | Subagent | Plugin |
|---------|---------------|-------|----------|--------|
| **Installation** | Manual copy | Manual copy | Manual config | One command |
| **Setup Time** | 5 minutes | 10 minutes | 15 minutes | 2 minutes |
| **Bundling** | Single file | Single file | Single file | Multiple |
| **Versioning** | Manual | Manual | Manual | Automatic |
| **Team Sharing** | Copy file | Copy file | Copy file | Install ID |
| **Updates** | Manual | Manual | Manual | Auto-available |
| **Dependencies** | None | None | None | May include |
| **Marketplace** | No | No | No | Yes |
| **Distribution** | Repository | Repository | Repository | Marketplace |
## Installation Methods
### Official Plugin
```bash
/plugin install plugin-name
```
### Local Plugin (for development)
```bash
/plugin install ./path/to/plugin
```
### From Git Repository
```bash
/plugin install github:username/repo
```
## When to Create a Plugin
```mermaid
graph TD
A["Should I create a plugin?"]
A -->|Need multiple components| B{"Multiple commands<br/>or subagents<br/>or MCPs?"}
B -->|Yes| C["✅ Create Plugin"]
B -->|No| D["Use Individual Feature"]
A -->|Team workflow| E{"Share with<br/>team?"}
E -->|Yes| C
E -->|No| F["Keep as Local Setup"]
A -->|Complex setup| G{"Needs auto<br/>configuration?"}
G -->|Yes| C
G -->|No| D
```
### Plugin Use Cases
| Use Case | Recommendation | Why |
|----------|-----------------|-----|
| **Team Onboarding** | ✅ Use Plugin | Instant setup, all configurations |
| **Framework Setup** | ✅ Use Plugin | Bundles framework-specific commands |
| **Enterprise Standards** | ✅ Use Plugin | Central distribution, version control |
| **Quick Task Automation** | ❌ Use Command | Overkill complexity |
| **Single Domain Expertise** | ❌ Use Skill | Too heavy, use skill instead |
| **Specialized Analysis** | ❌ Use Subagent | Create manually or use skill |
| **Live Data Access** | ❌ Use MCP | Standalone, don't bundle |
## Publishing a Plugin
**Steps to publish:**
1. Create plugin structure with all components
2. Write `plugin.yaml` manifest
3. Create `README.md` with documentation
4. Test locally with `/plugin install ./my-plugin`
5. Submit to plugin marketplace
6. Get reviewed and approved
7. Published on marketplace
8. Users can install with one command
**Example submission:**
```markdown
# PR Review Plugin
## Description
Complete PR review workflow with security, testing, and documentation checks.
## What's Included
- 3 slash commands for different review types
- 3 specialized subagents
- GitHub and CodeQL MCP integration
- Automated security scanning hooks
## Installation
```bash
/plugin install pr-review
```
## Features
✅ Security analysis
✅ Test coverage checking
✅ Documentation verification
✅ Code quality assessment
✅ Performance impact analysis
## Usage
```bash
/review-pr
/check-security
/check-tests
```
## Requirements
- Claude Code 1.0+
- GitHub access
- CodeQL (optional)
```
## Plugin vs Manual Configuration
**Manual Setup (2+ hours):**
- Install slash commands one by one
- Create subagents individually
- Configure MCPs separately
- Set up hooks manually
- Document everything
- Share with team (hope they configure correctly)
**With Plugin (2 minutes):**
```bash
/plugin install pr-review
# ✅ Everything installed and configured
# ✅ Ready to use immediately
# ✅ Team can reproduce exact setup
```
## Best Practices
### Do's ✅
- Use clear, descriptive plugin names
- Include comprehensive README
- Version your plugin properly (semver)
- Test all components together
- Document requirements clearly
- Provide usage examples
- Include error handling
- Tag appropriately for discovery
- Maintain backward compatibility
- Keep plugins focused and cohesive
- Include comprehensive tests
- Document all dependencies
### Don'ts ❌
- Don't bundle unrelated features
- Don't hardcode credentials
- Don't skip testing
- Don't forget documentation
- Don't create redundant plugins
- Don't ignore versioning
- Don't overcomplicate component dependencies
- Don't forget to handle errors gracefully
## Installation Instructions
### Installing from Marketplace
1. **Browse available plugins:**
```bash
/plugin list
```
2. **View plugin details:**
```bash
/plugin info plugin-name
```
3. **Install a plugin:**
```bash
/plugin install plugin-name
```
### Installing from Local Path
```bash
/plugin install ./path/to/plugin-directory
```
### Installing from GitHub
```bash
/plugin install github:username/repo
```
### Listing Installed Plugins
```bash
/plugin list --installed
```
### Updating a Plugin
```bash
/plugin update plugin-name
```
### Disabling/Enabling a Plugin
```bash
# Temporarily disable
/plugin disable plugin-name
# Re-enable
/plugin enable plugin-name
```
### Uninstalling a Plugin
```bash
/plugin uninstall plugin-name
```
## Related Concepts
The following Claude Code features work together with plugins:
- **[Slash Commands](../01-slash-commands/)** - Individual commands bundled in plugins
- **[Memory](../02-memory/)** - Persistent context for plugins
- **[Skills](../03-skills/)** - Domain expertise that can be wrapped into plugins
- **[Subagents](../04-subagents/)** - Specialized agents included as plugin components
- **[MCP Servers](../05-mcp/)** - Model Context Protocol integrations bundled in plugins
- **[Hooks](../06-hooks/)** - Event handlers that trigger plugin workflows
## Complete Example Workflow
### PR Review Plugin Full Workflow
```
1. User: /review-pr
2. Plugin executes:
├── pre-review.js hook validates git repo
├── GitHub MCP fetches PR data
├── security-reviewer subagent analyzes security
├── test-checker subagent verifies coverage
└── performance-analyzer subagent checks performance
3. Results synthesized and presented:
✅ Security: No critical issues
⚠️ Testing: Coverage 65% (recommend 80%+)
✅ Performance: No significant impact
📝 12 recommendations provided
```
## Troubleshooting
### Plugin Won't Install
- Check Claude Code version compatibility: `/version`
- Verify `plugin.yaml` syntax with `yaml` validator
- Check internet connection (for remote plugins)
- Review permissions: `ls -la plugin/`
### Components Not Loading
- Verify paths in `plugin.yaml` match actual directory structure
- Check file permissions: `chmod +x scripts/`
- Review component file syntax
- Check logs: `/plugin debug plugin-name`
### MCP Connection Failed
- Verify environment variables are set correctly
- Check MCP server installation and health
- Test MCP connection independently with `/mcp test`
- Review MCP configuration in `mcp/` directory
### Commands Not Available After Install
- Ensure plugin was installed successfully: `/plugin list --installed`
- Check if plugin is enabled: `/plugin status plugin-name`
- Restart Claude Code: `exit` and reopen
- Check for naming conflicts with existing commands
### Hook Execution Issues
- Verify hook files have correct permissions
- Check hook syntax and event names
- Review hook logs for error details
- Test hooks manually if possible
## Additional Resources
- [Claude Code Documentation](https://docs.claude.com/claude-code)
- [Plugin Marketplace](https://plugins.claude.com)
- [Official Plugin Examples](https://github.com/anthropic/claude-plugins)
- [Plugin Development Guide](https://docs.claude.com/plugins/development)
- [MCP Server Reference](https://spec.modelcontextprotocol.io/)
- [Subagent Configuration Guide](../04-subagents/README.md)
- [Hook System Reference](../06-hooks/README.md)

View File

@@ -0,0 +1,104 @@
![Claude How To](../../claude-howto-logo.svg)
# DevOps Automation Plugin
Complete DevOps automation for deployment, monitoring, and incident response.
## Features
✅ Automated deployments
✅ Rollback procedures
✅ System health monitoring
✅ Incident response workflows
✅ Kubernetes integration
## Installation
```bash
/plugin install devops-automation
```
## What's Included
### Slash Commands
- `/deploy` - Deploy to production or staging
- `/rollback` - Rollback to previous version
- `/status` - Check system health
- `/incident` - Handle production incidents
### Subagents
- `deployment-specialist` - Deployment operations
- `incident-commander` - Incident coordination
- `alert-analyzer` - System health analysis
### MCP Servers
- Kubernetes integration
### Scripts
- `deploy.sh` - Deployment automation
- `rollback.sh` - Rollback automation
- `health-check.sh` - Health check utilities
### Hooks
- `pre-deploy.js` - Pre-deployment validation
- `post-deploy.js` - Post-deployment tasks
## Usage
### Deploy to Staging
```
/deploy staging
```
### Deploy to Production
```
/deploy production
```
### Rollback
```
/rollback production
```
### Check Status
```
/status
```
### Handle Incident
```
/incident
```
## Requirements
- Claude Code 1.0+
- Kubernetes CLI (kubectl)
- Cluster access configured
## Configuration
Set up your Kubernetes config:
```bash
export KUBECONFIG=~/.kube/config
```
## Example Workflow
```
User: /deploy production
Claude:
1. Runs pre-deploy hook (validates kubectl, cluster connection)
2. Delegates to deployment-specialist subagent
3. Runs deploy.sh script
4. Monitors deployment progress via Kubernetes MCP
5. Runs post-deploy hook (waits for pods, smoke tests)
6. Provides deployment summary
Result:
✅ Deployment complete
📦 Version: v2.1.0
🚀 Pods: 3/3 ready
⏱️ Time: 2m 34s
```

View File

@@ -0,0 +1,14 @@
---
name: alert-analyzer
description: Analyzes monitoring alerts and system metrics
tools: read, grep, bash
---
# Alert Analyzer
Analyzes system health and alerts:
- Alert correlation
- Trend analysis
- Root cause identification
- Metric visualization
- Proactive issue detection

View File

@@ -0,0 +1,14 @@
---
name: deployment-specialist
description: Handles all deployment operations
tools: read, write, bash, grep
---
# Deployment Specialist
Expert in deployment operations:
- Blue-green deployments
- Canary releases
- Rollback procedures
- Health checks
- Database migrations

View File

@@ -0,0 +1,14 @@
---
name: incident-commander
description: Coordinates incident response
tools: read, write, bash, grep
---
# Incident Commander
Manages incident response:
- Severity assessment
- Team coordination
- Status updates
- Resolution tracking
- Post-mortem facilitation

View File

@@ -0,0 +1,15 @@
---
name: Deploy
description: Deploy application to production or staging
---
# Deploy Application
Execute deployment workflow:
1. Run pre-deployment checks
2. Build application
3. Run tests
4. Deploy to target environment
5. Run health checks
6. Notify team on Slack

View File

@@ -0,0 +1,16 @@
---
name: Incident Response
description: Handle production incidents with structured response
---
# Incident Response
Structured incident response workflow:
1. Create incident record
2. Assess severity and impact
3. Notify on-call team
4. Gather diagnostic information
5. Coordinate response efforts
6. Document resolution
7. Schedule post-mortem

View File

@@ -0,0 +1,14 @@
---
name: Rollback
description: Rollback to previous deployment
---
# Rollback Deployment
Rollback to previous stable version:
1. Identify previous deployment
2. Verify rollback target is healthy
3. Execute rollback procedure
4. Run health checks
5. Notify team

View File

@@ -0,0 +1,15 @@
---
name: System Status
description: Check overall system health and status
---
# System Status Check
Check system health across all services:
1. Query Kubernetes pod status
2. Check database connections
3. Monitor API response times
4. Review error rates
5. Check resource utilization
6. Report overall health

View File

@@ -0,0 +1,34 @@
#!/usr/bin/env node
/**
* Post-deployment hook
* Runs after deployment completes
*/
async function postDeploy() {
console.log('Running post-deployment tasks...');
const { execSync } = require('child_process');
// Wait for pods to be ready
console.log('Waiting for pods to be ready...');
try {
execSync('kubectl wait --for=condition=ready pod -l app=myapp --timeout=300s', {
stdio: 'inherit'
});
} catch (error) {
console.error('❌ Pods failed to become ready');
process.exit(1);
}
// Run smoke tests
console.log('Running smoke tests...');
// Add your smoke test commands here
console.log('✅ Post-deployment tasks complete');
}
postDeploy().catch(error => {
console.error('Post-deploy hook failed:', error);
process.exit(1);
});

View File

@@ -0,0 +1,35 @@
#!/usr/bin/env node
/**
* Pre-deployment hook
* Validates environment and prerequisites before deployment
*/
async function preDeploy() {
console.log('Running pre-deployment checks...');
const { execSync } = require('child_process');
// Check if kubectl is installed
try {
execSync('which kubectl', { stdio: 'pipe' });
} catch (error) {
console.error('❌ kubectl not found. Please install Kubernetes CLI.');
process.exit(1);
}
// Check if connected to cluster
try {
execSync('kubectl cluster-info', { stdio: 'pipe' });
} catch (error) {
console.error('❌ Not connected to Kubernetes cluster');
process.exit(1);
}
console.log('✅ Pre-deployment checks passed');
}
preDeploy().catch(error => {
console.error('Pre-deploy hook failed:', error);
process.exit(1);
});

View File

@@ -0,0 +1,11 @@
{
"mcpServers": {
"kubernetes": {
"command": "npx",
"args": ["@modelcontextprotocol/server-kubernetes"],
"env": {
"KUBECONFIG": "${KUBECONFIG}"
}
}
}
}

View File

@@ -0,0 +1,31 @@
---
name: devops-automation
version: "1.0.0"
description: Complete DevOps automation for deployment, monitoring, and incident response
author: Community
license: MIT
tags:
- devops
- deployment
- monitoring
- automation
requires:
- claude-code: ">=1.0.0"
components:
- type: commands
path: commands/
- type: agents
path: agents/
- type: mcp
path: mcp/
- type: hooks
path: hooks/
- type: scripts
path: scripts/
config:
auto_load: true
enabled_by_default: true
---

View File

@@ -0,0 +1,28 @@
#!/bin/bash
set -e
echo "🚀 Starting deployment..."
# Load environment
ENV=${1:-staging}
echo "📦 Target environment: $ENV"
# Pre-deployment checks
echo "✓ Running pre-deployment checks..."
npm run lint
npm test
# Build
echo "🔨 Building application..."
npm run build
# Deploy
echo "🚢 Deploying to $ENV..."
kubectl apply -f k8s/$ENV/
# Health check
echo "🏥 Running health checks..."
sleep 10
curl -f http://api.$ENV.example.com/health
echo "✅ Deployment complete!"

View File

@@ -0,0 +1,30 @@
#!/bin/bash
echo "🏥 System Health Check"
echo "===================="
ENV=${1:-production}
# Check API
echo -n "API: "
if curl -sf http://api.$ENV.example.com/health > /dev/null; then
echo "✅ Healthy"
else
echo "❌ Unhealthy"
fi
# Check Database
echo -n "Database: "
if pg_isready -h db.$ENV.example.com > /dev/null 2>&1; then
echo "✅ Healthy"
else
echo "❌ Unhealthy"
fi
# Check Pods
echo -n "Kubernetes Pods: "
PODS_READY=$(kubectl get pods -n $ENV --no-headers | grep "Running" | wc -l)
PODS_TOTAL=$(kubectl get pods -n $ENV --no-headers | wc -l)
echo "$PODS_READY/$PODS_TOTAL ready"
echo "===================="

View File

@@ -0,0 +1,25 @@
#!/bin/bash
set -e
echo "⏪ Starting rollback..."
ENV=${1:-staging}
echo "📦 Target environment: $ENV"
# Get previous deployment
PREVIOUS=$(kubectl rollout history deployment/app -n $ENV | tail -2 | head -1 | awk '{print $1}')
echo "🔄 Rolling back to revision: $PREVIOUS"
# Execute rollback
kubectl rollout undo deployment/app -n $ENV
# Wait for rollback
echo "⏳ Waiting for rollback to complete..."
kubectl rollout status deployment/app -n $ENV
# Health check
echo "🏥 Running health checks..."
sleep 5
curl -f http://api.$ENV.example.com/health
echo "✅ Rollback complete!"

View File

@@ -0,0 +1,116 @@
![Claude How To](../../claude-howto-logo.svg)
# Documentation Plugin
Comprehensive documentation generation and maintenance for your project.
## Features
✅ API documentation generation
✅ README creation and updates
✅ Documentation synchronization
✅ Code comment improvements
✅ Example generation
## Installation
```bash
/plugin install documentation
```
## What's Included
### Slash Commands
- `/generate-api-docs` - Generate API documentation
- `/generate-readme` - Create or update README
- `/sync-docs` - Sync docs with code changes
- `/validate-docs` - Validate documentation
### Subagents
- `api-documenter` - API documentation specialist
- `code-commentator` - Code comment improvements
- `example-generator` - Code example creation
### Templates
- `api-endpoint.md` - API endpoint documentation template
- `function-docs.md` - Function documentation template
- `adr-template.md` - Architecture Decision Record template
### MCP Servers
- GitHub integration for documentation syncing
## Usage
### Generate API Documentation
```
/generate-api-docs
```
### Create README
```
/generate-readme
```
### Sync Documentation
```
/sync-docs
```
### Validate Documentation
```
/validate-docs
```
## Requirements
- Claude Code 1.0+
- GitHub access (optional)
## Example Workflow
```
User: /generate-api-docs
Claude:
1. Scans all API endpoints in /src/api/
2. Delegates to api-documenter subagent
3. Extracts function signatures and JSDoc
4. Organizes by module/endpoint
5. Uses api-endpoint.md template
6. Generates comprehensive markdown docs
7. Includes curl, JavaScript, and Python examples
Result:
✅ API documentation generated
📄 Files created:
- docs/api/users.md
- docs/api/auth.md
- docs/api/products.md
📊 Coverage: 23/23 endpoints documented
```
## Templates Usage
### API Endpoint Template
Use for documenting REST API endpoints with full examples.
### Function Documentation Template
Use for documenting individual functions/methods.
### ADR Template
Use for documenting architectural decisions.
## Configuration
Set up GitHub token for documentation syncing:
```bash
export GITHUB_TOKEN="your_github_token"
```
## Best Practices
- Keep documentation close to code
- Update docs with code changes
- Include practical examples
- Validate regularly
- Use templates for consistency

View File

@@ -0,0 +1,14 @@
---
name: api-documenter
description: API documentation specialist
tools: read, write, grep
---
# API Documenter
Creates comprehensive API documentation:
- Endpoint documentation
- Parameter descriptions
- Response schemas
- Code examples (curl, JS, Python)
- Error codes

View File

@@ -0,0 +1,14 @@
---
name: code-commentator
description: Code comment and inline documentation specialist
tools: read, write, edit
---
# Code Commentator
Improves code documentation:
- JSDoc/docstring comments
- Inline explanations
- Parameter descriptions
- Return type documentation
- Usage examples

View File

@@ -0,0 +1,14 @@
---
name: example-generator
description: Code example and tutorial specialist
tools: read, write
---
# Example Generator
Creates practical code examples:
- Getting started guides
- Common use cases
- Integration examples
- Best practices
- Troubleshooting scenarios

View File

@@ -0,0 +1,15 @@
---
name: Generate API Documentation
description: Generate comprehensive API documentation from source code
---
# API Documentation Generator
Generate complete API documentation:
1. Scan API endpoints
2. Extract function signatures and JSDoc
3. Organize by module/endpoint
4. Create markdown with examples
5. Include request/response schemas
6. Add error documentation

View File

@@ -0,0 +1,15 @@
---
name: Generate README
description: Create or update project README
---
# README Generator
Generate comprehensive README:
1. Project overview and description
2. Installation instructions
3. Usage examples
4. API documentation links
5. Contributing guidelines
6. License information

View File

@@ -0,0 +1,14 @@
---
name: Sync Documentation
description: Sync documentation with code changes
---
# Documentation Sync
Synchronize documentation with codebase:
1. Detect code changes
2. Identify outdated documentation
3. Update affected docs
4. Verify examples still work
5. Update version numbers

View File

@@ -0,0 +1,14 @@
---
name: Validate Documentation
description: Validate documentation for completeness and accuracy
---
# Documentation Validation
Validate documentation quality:
1. Check for broken links
2. Verify code examples
3. Ensure completeness
4. Check formatting
5. Validate against actual code

View File

@@ -0,0 +1,11 @@
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "${GITHUB_TOKEN}"
}
}
}
}

View File

@@ -0,0 +1,28 @@
---
name: documentation
version: "1.0.0"
description: Comprehensive documentation generation and maintenance
author: Community
license: MIT
tags:
- documentation
- api
- guides
requires:
- claude-code: ">=1.0.0"
components:
- type: commands
path: commands/
- type: agents
path: agents/
- type: mcp
path: mcp/
- type: templates
path: templates/
config:
auto_load: true
enabled_by_default: true
---

View File

@@ -0,0 +1,39 @@
# ADR [Number]: [Title]
## Status
[Proposed | Accepted | Deprecated | Superseded]
## Context
What is the issue that we're seeing that is motivating this decision or change?
## Decision
What is the change that we're proposing and/or doing?
## Consequences
What becomes easier or more difficult to do because of this change?
### Positive
- Benefit 1
- Benefit 2
### Negative
- Drawback 1
- Drawback 2
### Neutral
- Consideration 1
- Consideration 2
## Alternatives Considered
What other options were considered and why were they not chosen?
### Alternative 1
Description and reason for not choosing.
### Alternative 2
Description and reason for not choosing.
## References
- Related ADRs
- External documentation
- Discussion links

View File

@@ -0,0 +1,101 @@
# [METHOD] /api/v1/[endpoint]
## Description
Brief explanation of what this endpoint does.
## Authentication
Required authentication method (e.g., Bearer token).
## Parameters
### Path Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| id | string | Yes | Resource ID |
### Query Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| page | integer | No | Page number (default: 1) |
| limit | integer | No | Items per page (default: 20) |
### Request Body
```json
{
"field": "value"
}
```
## Responses
### 200 OK
```json
{
"success": true,
"data": {
"id": "123",
"name": "Example"
}
}
```
### 400 Bad Request
```json
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid input"
}
}
```
### 404 Not Found
```json
{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Resource not found"
}
}
```
## Examples
### cURL
```bash
curl -X GET "https://api.example.com/api/v1/endpoint" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json"
```
### JavaScript
```javascript
const response = await fetch('/api/v1/endpoint', {
headers: {
'Authorization': 'Bearer token',
'Content-Type': 'application/json'
}
});
const data = await response.json();
```
### Python
```python
import requests
response = requests.get(
'https://api.example.com/api/v1/endpoint',
headers={'Authorization': 'Bearer token'}
)
data = response.json()
```
## Rate Limits
- 1000 requests per hour for authenticated users
- 100 requests per hour for public endpoints
## Related Endpoints
- [GET /api/v1/related](#)
- [POST /api/v1/related](#)

View File

@@ -0,0 +1,50 @@
# Function: `functionName`
## Description
Brief description of what the function does.
## Signature
```typescript
function functionName(param1: Type1, param2: Type2): ReturnType
```
## Parameters
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| param1 | Type1 | Yes | Description of param1 |
| param2 | Type2 | No | Description of param2 |
## Returns
**Type**: `ReturnType`
Description of what is returned.
## Throws
- `Error`: When invalid input is provided
- `TypeError`: When wrong type is passed
## Examples
### Basic Usage
```typescript
const result = functionName('value1', 'value2');
console.log(result);
```
### Advanced Usage
```typescript
const result = functionName(
complexParam1,
{ option: true }
);
```
## Notes
- Additional notes or warnings
- Performance considerations
- Best practices
## See Also
- [Related Function](#)
- [API Documentation](#)

View File

@@ -0,0 +1,88 @@
![Claude How To](../../claude-howto-logo.svg)
# PR Review Plugin
Complete PR review workflow with security, testing, and documentation checks.
## Features
✅ Security analysis
✅ Test coverage checking
✅ Documentation verification
✅ Code quality assessment
✅ Performance impact analysis
## Installation
```bash
/plugin install pr-review
```
## What's Included
### Slash Commands
- `/review-pr` - Comprehensive PR review
- `/check-security` - Security-focused review
- `/check-tests` - Test coverage analysis
### Subagents
- `security-reviewer` - Security vulnerability detection
- `test-checker` - Test coverage analysis
- `performance-analyzer` - Performance impact evaluation
### MCP Servers
- GitHub integration for PR data
### Hooks
- `pre-review.js` - Pre-review validation
## Usage
### Basic PR Review
```
/review-pr
```
### Security Check Only
```
/check-security
```
### Test Coverage Check
```
/check-tests
```
## Requirements
- Claude Code 1.0+
- GitHub access
- Git repository
## Configuration
Set up your GitHub token:
```bash
export GITHUB_TOKEN="your_github_token"
```
## Example Workflow
```
User: /review-pr
Claude:
1. Runs pre-review hook (validates git repo)
2. Fetches PR data via GitHub MCP
3. Delegates security review to security-reviewer subagent
4. Delegates testing to test-checker subagent
5. Delegates performance to performance-analyzer subagent
6. Synthesizes all findings
7. Provides comprehensive review report
Result:
✅ Security: No critical issues found
⚠️ Testing: Coverage is 65%, recommend 80%+
✅ Performance: No significant impact
📝 Recommendations: Add tests for edge cases
```

View File

@@ -0,0 +1,13 @@
---
name: performance-analyzer
description: Performance impact analysis
tools: read, grep, bash
---
# Performance Analyzer
Evaluates performance impact of changes:
- Algorithm complexity
- Database query efficiency
- Memory usage
- Caching opportunities

View File

@@ -0,0 +1,13 @@
---
name: security-reviewer
description: Security-focused code review
tools: read, grep, diff
---
# Security Reviewer
Specializes in finding security vulnerabilities:
- Authentication/authorization issues
- Data exposure
- Injection attacks
- Secure configuration

View File

@@ -0,0 +1,13 @@
---
name: test-checker
description: Test coverage and quality analysis
tools: read, bash, grep
---
# Test Checker
Analyzes test coverage and quality:
- Coverage percentage
- Missing test cases
- Test quality assessment
- Edge case identification

View File

@@ -0,0 +1,14 @@
---
name: Security Check
description: Run security-focused code review
---
# Security Check
Perform focused security analysis on code changes:
1. Authentication/authorization checks
2. Data exposure risks
3. Injection vulnerabilities
4. Cryptographic weaknesses
5. Sensitive data in logs

View File

@@ -0,0 +1,14 @@
---
name: Test Coverage Check
description: Verify test coverage and quality
---
# Test Coverage Check
Analyze test coverage and quality:
1. Check test coverage percentage
2. Identify untested code paths
3. Review test quality
4. Suggest missing test cases
5. Verify edge cases are covered

View File

@@ -0,0 +1,14 @@
---
name: Review PR
description: Start comprehensive PR review with security and testing checks
---
# PR Review
This command initiates a complete pull request review including:
1. Security analysis
2. Test coverage verification
3. Documentation updates
4. Code quality checks
5. Performance impact assessment

View File

@@ -0,0 +1,37 @@
#!/usr/bin/env node
/**
* Pre-review hook
* Runs before starting PR review to ensure prerequisites are met
*/
async function preReview() {
console.log('Running pre-review checks...');
// Check if git repository
const { execSync } = require('child_process');
try {
execSync('git rev-parse --git-dir', { stdio: 'pipe' });
} catch (error) {
console.error('❌ Not a git repository');
process.exit(1);
}
// Check for uncommitted changes
try {
const status = execSync('git status --porcelain', { encoding: 'utf-8' });
if (status.trim()) {
console.warn('⚠️ Warning: Uncommitted changes detected');
}
} catch (error) {
console.error('❌ Failed to check git status');
process.exit(1);
}
console.log('✅ Pre-review checks passed');
}
preReview().catch(error => {
console.error('Pre-review hook failed:', error);
process.exit(1);
});

View File

@@ -0,0 +1,11 @@
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "${GITHUB_TOKEN}"
}
}
}
}

View File

@@ -0,0 +1,28 @@
---
name: pr-review
version: "1.0.0"
description: Complete PR review workflow with security, testing, and docs
author: Anthropic
license: MIT
tags:
- code-review
- quality
- security
requires:
- claude-code: ">=1.0.0"
components:
- type: commands
path: commands/
- type: agents
path: agents/
- type: mcp
path: mcp/
- type: hooks
path: hooks/
config:
auto_load: true
enabled_by_default: true
---