aboutsummaryrefslogtreecommitdiffstats
path: root/.agents/skills/command-development/examples
diff options
context:
space:
mode:
authorsillylaird <sillyfanboy@gmail.com>2026-09-03 00:33:59 +0000
committersillylaird <sillyfanboy@gmail.com>2026-09-03 00:33:59 +0000
commit898b52edcb47bcb3e9d6106e74ca73e74ea01e70 (patch)
tree85c6ee5ad58b860144551184d4cf86b560c62b91 /.agents/skills/command-development/examples
downloadwww-898b52edcb47bcb3e9d6106e74ca73e74ea01e70.tar.gz
www-898b52edcb47bcb3e9d6106e74ca73e74ea01e70.zip
import live www.sillylaird.ca webrootHEADmain
Diffstat (limited to '.agents/skills/command-development/examples')
-rw-r--r--.agents/skills/command-development/examples/plugin-commands.md557
-rw-r--r--.agents/skills/command-development/examples/simple-commands.md504
2 files changed, 1061 insertions, 0 deletions
diff --git a/.agents/skills/command-development/examples/plugin-commands.md b/.agents/skills/command-development/examples/plugin-commands.md
new file mode 100644
index 0000000..e14ef4d
--- /dev/null
+++ b/.agents/skills/command-development/examples/plugin-commands.md
@@ -0,0 +1,557 @@
+# Plugin Command Examples
+
+Practical examples of commands designed for Claude Code plugins, demonstrating plugin-specific patterns and features.
+
+## Table of Contents
+
+1. [Simple Plugin Command](#1-simple-plugin-command)
+2. [Script-Based Analysis](#2-script-based-analysis)
+3. [Template-Based Generation](#3-template-based-generation)
+4. [Multi-Script Workflow](#4-multi-script-workflow)
+5. [Configuration-Driven Deployment](#5-configuration-driven-deployment)
+6. [Agent Integration](#6-agent-integration)
+7. [Skill Integration](#7-skill-integration)
+8. [Multi-Component Workflow](#8-multi-component-workflow)
+9. [Validated Input Command](#9-validated-input-command)
+10. [Environment-Aware Command](#10-environment-aware-command)
+
+---
+
+## 1. Simple Plugin Command
+
+**Use case:** Basic command that uses plugin script
+
+**File:** `commands/analyze.md`
+
+```markdown
+---
+description: Analyze code quality using plugin tools
+argument-hint: [file-path]
+allowed-tools: Bash(node:*), Read
+---
+
+Analyze @$1 using plugin's quality checker:
+
+!`node ${CLAUDE_PLUGIN_ROOT}/scripts/quality-check.js $1`
+
+Review the analysis output and provide:
+1. Summary of findings
+2. Priority issues to address
+3. Suggested improvements
+4. Code quality score interpretation
+```
+
+**Key features:**
+- Uses `${CLAUDE_PLUGIN_ROOT}` for portable path
+- Combines file reference with script execution
+- Simple single-purpose command
+
+---
+
+## 2. Script-Based Analysis
+
+**Use case:** Run comprehensive analysis using multiple plugin scripts
+
+**File:** `commands/full-audit.md`
+
+```markdown
+---
+description: Complete code audit using plugin suite
+argument-hint: [directory]
+allowed-tools: Bash(*)
+model: sonnet
+---
+
+Running complete audit on $1:
+
+**Security scan:**
+!`bash ${CLAUDE_PLUGIN_ROOT}/scripts/security-scan.sh $1`
+
+**Performance analysis:**
+!`bash ${CLAUDE_PLUGIN_ROOT}/scripts/perf-analyze.sh $1`
+
+**Best practices check:**
+!`bash ${CLAUDE_PLUGIN_ROOT}/scripts/best-practices.sh $1`
+
+Analyze all results and create comprehensive report including:
+- Critical issues requiring immediate attention
+- Performance optimization opportunities
+- Security vulnerabilities and fixes
+- Overall health score and recommendations
+```
+
+**Key features:**
+- Multiple script executions
+- Organized output sections
+- Comprehensive workflow
+- Clear reporting structure
+
+---
+
+## 3. Template-Based Generation
+
+**Use case:** Generate documentation following plugin template
+
+**File:** `commands/gen-api-docs.md`
+
+```markdown
+---
+description: Generate API documentation from template
+argument-hint: [api-file]
+---
+
+Template structure: @${CLAUDE_PLUGIN_ROOT}/templates/api-documentation.md
+
+API implementation: @$1
+
+Generate complete API documentation following the template format above.
+
+Ensure documentation includes:
+- Endpoint descriptions with HTTP methods
+- Request/response schemas
+- Authentication requirements
+- Error codes and handling
+- Usage examples with curl commands
+- Rate limiting information
+
+Format output as markdown suitable for README or docs site.
+```
+
+**Key features:**
+- Uses plugin template
+- Combines template with source file
+- Standardized output format
+- Clear documentation structure
+
+---
+
+## 4. Multi-Script Workflow
+
+**Use case:** Orchestrate build, test, and deploy workflow
+
+**File:** `commands/release.md`
+
+```markdown
+---
+description: Execute complete release workflow
+argument-hint: [version]
+allowed-tools: Bash(*), Read
+---
+
+Executing release workflow for version $1:
+
+**Step 1 - Pre-release validation:**
+!`bash ${CLAUDE_PLUGIN_ROOT}/scripts/pre-release-check.sh $1`
+
+**Step 2 - Build artifacts:**
+!`bash ${CLAUDE_PLUGIN_ROOT}/scripts/build-release.sh $1`
+
+**Step 3 - Run test suite:**
+!`bash ${CLAUDE_PLUGIN_ROOT}/scripts/run-tests.sh`
+
+**Step 4 - Package release:**
+!`bash ${CLAUDE_PLUGIN_ROOT}/scripts/package.sh $1`
+
+Review all step outputs and report:
+1. Any failures or warnings
+2. Build artifacts location
+3. Test results summary
+4. Next steps for deployment
+5. Rollback plan if needed
+```
+
+**Key features:**
+- Multi-step workflow
+- Sequential script execution
+- Clear step numbering
+- Comprehensive reporting
+
+---
+
+## 5. Configuration-Driven Deployment
+
+**Use case:** Deploy using environment-specific plugin configuration
+
+**File:** `commands/deploy.md`
+
+```markdown
+---
+description: Deploy application to environment
+argument-hint: [environment]
+allowed-tools: Read, Bash(*)
+---
+
+Deployment configuration for $1: @${CLAUDE_PLUGIN_ROOT}/config/$1-deploy.json
+
+Current git state: !`git rev-parse --short HEAD`
+
+Build info: !`cat package.json | grep -E '(name|version)'`
+
+Execute deployment to $1 environment using configuration above.
+
+Deployment checklist:
+1. Validate configuration settings
+2. Build application for $1
+3. Run pre-deployment tests
+4. Deploy to target environment
+5. Run smoke tests
+6. Verify deployment success
+7. Update deployment log
+
+Report deployment status and any issues encountered.
+```
+
+**Key features:**
+- Environment-specific configuration
+- Dynamic config file loading
+- Pre-deployment validation
+- Structured checklist
+
+---
+
+## 6. Agent Integration
+
+**Use case:** Command that launches plugin agent for complex task
+
+**File:** `commands/deep-review.md`
+
+```markdown
+---
+description: Deep code review using plugin agent
+argument-hint: [file-or-directory]
+---
+
+Initiate comprehensive code review of @$1 using the code-reviewer agent.
+
+The agent will perform:
+1. **Static analysis** - Check for code smells and anti-patterns
+2. **Security audit** - Identify potential vulnerabilities
+3. **Performance review** - Find optimization opportunities
+4. **Best practices** - Ensure code follows standards
+5. **Documentation check** - Verify adequate documentation
+
+The agent has access to:
+- Plugin's linting rules: ${CLAUDE_PLUGIN_ROOT}/config/lint-rules.json
+- Security checklist: ${CLAUDE_PLUGIN_ROOT}/checklists/security.md
+- Performance guidelines: ${CLAUDE_PLUGIN_ROOT}/docs/performance.md
+
+Note: This uses the Task tool to launch the plugin's code-reviewer agent for thorough analysis.
+```
+
+**Key features:**
+- Delegates to plugin agent
+- Documents agent capabilities
+- References plugin resources
+- Clear scope definition
+
+---
+
+## 7. Skill Integration
+
+**Use case:** Command that leverages plugin skill for specialized knowledge
+
+**File:** `commands/document-api.md`
+
+```markdown
+---
+description: Document API following plugin standards
+argument-hint: [api-file]
+---
+
+API source code: @$1
+
+Generate API documentation following the plugin's API documentation standards.
+
+Use the api-documentation-standards skill to ensure:
+- **OpenAPI compliance** - Follow OpenAPI 3.0 specification
+- **Consistent formatting** - Use plugin's documentation style
+- **Complete coverage** - Document all endpoints and schemas
+- **Example quality** - Provide realistic usage examples
+- **Error documentation** - Cover all error scenarios
+
+The skill provides:
+- Standard documentation templates
+- API documentation best practices
+- Common patterns for this codebase
+- Quality validation criteria
+
+Generate production-ready API documentation.
+```
+
+**Key features:**
+- Invokes plugin skill by name
+- Documents skill purpose
+- Clear expectations
+- Leverages skill knowledge
+
+---
+
+## 8. Multi-Component Workflow
+
+**Use case:** Complex workflow using agents, skills, and scripts
+
+**File:** `commands/complete-review.md`
+
+```markdown
+---
+description: Comprehensive review using all plugin components
+argument-hint: [file-path]
+allowed-tools: Bash(node:*), Read
+---
+
+Target file: @$1
+
+Execute comprehensive review workflow:
+
+**Phase 1: Automated Analysis**
+Run plugin analyzer: !`node ${CLAUDE_PLUGIN_ROOT}/scripts/analyze.js $1`
+
+**Phase 2: Deep Review (Agent)**
+Launch the code-quality-reviewer agent for detailed analysis.
+Agent will examine:
+- Code structure and organization
+- Error handling patterns
+- Testing coverage
+- Documentation quality
+
+**Phase 3: Standards Check (Skill)**
+Use the coding-standards skill to validate:
+- Naming conventions
+- Code formatting
+- Best practices adherence
+- Framework-specific patterns
+
+**Phase 4: Report Generation**
+Template: @${CLAUDE_PLUGIN_ROOT}/templates/review-report.md
+
+Compile all findings into comprehensive report following template.
+
+**Phase 5: Recommendations**
+Generate prioritized action items:
+1. Critical issues (must fix)
+2. Important improvements (should fix)
+3. Nice-to-have enhancements (could fix)
+
+Include specific file locations and suggested changes for each item.
+```
+
+**Key features:**
+- Multi-phase workflow
+- Combines scripts, agents, skills
+- Template-based reporting
+- Prioritized outputs
+
+---
+
+## 9. Validated Input Command
+
+**Use case:** Command with input validation and error handling
+
+**File:** `commands/build-env.md`
+
+```markdown
+---
+description: Build for specific environment with validation
+argument-hint: [environment]
+allowed-tools: Bash(*)
+---
+
+Validate environment argument: !`echo "$1" | grep -E "^(dev|staging|prod)$" && echo "VALID" || echo "INVALID"`
+
+Check build script exists: !`test -x ${CLAUDE_PLUGIN_ROOT}/scripts/build.sh && echo "EXISTS" || echo "MISSING"`
+
+Verify configuration available: !`test -f ${CLAUDE_PLUGIN_ROOT}/config/$1.json && echo "FOUND" || echo "NOT_FOUND"`
+
+If all validations pass:
+
+**Configuration:** @${CLAUDE_PLUGIN_ROOT}/config/$1.json
+
+**Execute build:** !`bash ${CLAUDE_PLUGIN_ROOT}/scripts/build.sh $1 2>&1`
+
+**Validation results:** !`bash ${CLAUDE_PLUGIN_ROOT}/scripts/validate-build.sh $1 2>&1`
+
+Report build status and any issues.
+
+If validations fail:
+- Explain which validation failed
+- Provide expected values/locations
+- Suggest corrective actions
+- Document troubleshooting steps
+```
+
+**Key features:**
+- Input validation
+- Resource existence checks
+- Error handling
+- Helpful error messages
+- Graceful failure handling
+
+---
+
+## 10. Environment-Aware Command
+
+**Use case:** Command that adapts behavior based on environment
+
+**File:** `commands/run-checks.md`
+
+```markdown
+---
+description: Run environment-appropriate checks
+argument-hint: [environment]
+allowed-tools: Bash(*), Read
+---
+
+Environment: $1
+
+Load environment configuration: @${CLAUDE_PLUGIN_ROOT}/config/$1-checks.json
+
+Determine check level: !`echo "$1" | grep -E "^prod$" && echo "FULL" || echo "BASIC"`
+
+**For production environment:**
+- Full test suite: !`bash ${CLAUDE_PLUGIN_ROOT}/scripts/test-full.sh`
+- Security scan: !`bash ${CLAUDE_PLUGIN_ROOT}/scripts/security-scan.sh`
+- Performance audit: !`bash ${CLAUDE_PLUGIN_ROOT}/scripts/perf-check.sh`
+- Compliance check: !`bash ${CLAUDE_PLUGIN_ROOT}/scripts/compliance.sh`
+
+**For non-production environments:**
+- Basic tests: !`bash ${CLAUDE_PLUGIN_ROOT}/scripts/test-basic.sh`
+- Quick lint: !`bash ${CLAUDE_PLUGIN_ROOT}/scripts/lint.sh`
+
+Analyze results based on environment requirements:
+
+**Production:** All checks must pass with zero critical issues
+**Staging:** No critical issues, warnings acceptable
+**Development:** Focus on blocking issues only
+
+Report status and recommend proceed/block decision.
+```
+
+**Key features:**
+- Environment-aware logic
+- Conditional execution
+- Different validation levels
+- Appropriate reporting per environment
+
+---
+
+## Common Patterns Summary
+
+### Pattern: Plugin Script Execution
+```markdown
+!`node ${CLAUDE_PLUGIN_ROOT}/scripts/script-name.js $1`
+```
+Use for: Running plugin-provided Node.js scripts
+
+### Pattern: Plugin Configuration Loading
+```markdown
+@${CLAUDE_PLUGIN_ROOT}/config/config-name.json
+```
+Use for: Loading plugin configuration files
+
+### Pattern: Plugin Template Usage
+```markdown
+@${CLAUDE_PLUGIN_ROOT}/templates/template-name.md
+```
+Use for: Using plugin templates for generation
+
+### Pattern: Agent Invocation
+```markdown
+Launch the [agent-name] agent for [task description].
+```
+Use for: Delegating complex tasks to plugin agents
+
+### Pattern: Skill Reference
+```markdown
+Use the [skill-name] skill to ensure [requirements].
+```
+Use for: Leveraging plugin skills for specialized knowledge
+
+### Pattern: Input Validation
+```markdown
+Validate input: !`echo "$1" | grep -E "^pattern$" && echo "OK" || echo "ERROR"`
+```
+Use for: Validating command arguments
+
+### Pattern: Resource Validation
+```markdown
+Check exists: !`test -f ${CLAUDE_PLUGIN_ROOT}/path/file && echo "YES" || echo "NO"`
+```
+Use for: Verifying required plugin files exist
+
+---
+
+## Development Tips
+
+### Testing Plugin Commands
+
+1. **Test with plugin installed:**
+ ```bash
+ cd /path/to/plugin
+ claude /command-name args
+ ```
+
+2. **Verify ${CLAUDE_PLUGIN_ROOT} expansion:**
+ ```bash
+ # Add debug output to command
+ !`echo "Plugin root: ${CLAUDE_PLUGIN_ROOT}"`
+ ```
+
+3. **Test across different working directories:**
+ ```bash
+ cd /tmp && claude /command-name
+ cd /other/project && claude /command-name
+ ```
+
+4. **Validate resource availability:**
+ ```bash
+ # Check all plugin resources exist
+ !`ls -la ${CLAUDE_PLUGIN_ROOT}/scripts/`
+ !`ls -la ${CLAUDE_PLUGIN_ROOT}/config/`
+ ```
+
+### Common Mistakes to Avoid
+
+1. **Using relative paths instead of ${CLAUDE_PLUGIN_ROOT}:**
+ ```markdown
+ # Wrong
+ !`node ./scripts/analyze.js`
+
+ # Correct
+ !`node ${CLAUDE_PLUGIN_ROOT}/scripts/analyze.js`
+ ```
+
+2. **Forgetting to allow required tools:**
+ ```markdown
+ # Missing allowed-tools
+ !`bash script.sh` # Will fail without Bash permission
+
+ # Correct
+ ---
+ allowed-tools: Bash(*)
+ ---
+ !`bash ${CLAUDE_PLUGIN_ROOT}/scripts/script.sh`
+ ```
+
+3. **Not validating inputs:**
+ ```markdown
+ # Risky - no validation
+ Deploy to $1 environment
+
+ # Better - with validation
+ Validate: !`echo "$1" | grep -E "^(dev|staging|prod)$" || echo "INVALID"`
+ Deploy to $1 environment (if valid)
+ ```
+
+4. **Hardcoding plugin paths:**
+ ```markdown
+ # Wrong - breaks on different installations
+ @/home/user/.claude/plugins/my-plugin/config.json
+
+ # Correct - works everywhere
+ @${CLAUDE_PLUGIN_ROOT}/config.json
+ ```
+
+---
+
+For detailed plugin-specific features, see `references/plugin-features-reference.md`.
+For general command development, see main `SKILL.md`.
diff --git a/.agents/skills/command-development/examples/simple-commands.md b/.agents/skills/command-development/examples/simple-commands.md
new file mode 100644
index 0000000..2348239
--- /dev/null
+++ b/.agents/skills/command-development/examples/simple-commands.md
@@ -0,0 +1,504 @@
+# Simple Command Examples
+
+Basic slash command patterns for common use cases.
+
+**Important:** All examples below are written as instructions FOR Claude (agent consumption), not messages TO users. Commands tell Claude what to do, not tell users what will happen.
+
+## Example 1: Code Review Command
+
+**File:** `.claude/commands/review.md`
+
+```markdown
+---
+description: Review code for quality and issues
+allowed-tools: Read, Bash(git:*)
+---
+
+Review the code in this repository for:
+
+1. **Code Quality:**
+ - Readability and maintainability
+ - Consistent style and formatting
+ - Appropriate abstraction levels
+
+2. **Potential Issues:**
+ - Logic errors or bugs
+ - Edge cases not handled
+ - Performance concerns
+
+3. **Best Practices:**
+ - Design patterns used correctly
+ - Error handling present
+ - Documentation adequate
+
+Provide specific feedback with file and line references.
+```
+
+**Usage:**
+```
+> /review
+```
+
+---
+
+## Example 2: Security Review Command
+
+**File:** `.claude/commands/security-review.md`
+
+```markdown
+---
+description: Review code for security vulnerabilities
+allowed-tools: Read, Grep
+model: sonnet
+---
+
+Perform comprehensive security review checking for:
+
+**Common Vulnerabilities:**
+- SQL injection risks
+- Cross-site scripting (XSS)
+- Authentication/authorization issues
+- Insecure data handling
+- Hardcoded secrets or credentials
+
+**Security Best Practices:**
+- Input validation present
+- Output encoding correct
+- Secure defaults used
+- Error messages safe
+- Logging appropriate (no sensitive data)
+
+For each issue found:
+- File and line number
+- Severity (Critical/High/Medium/Low)
+- Description of vulnerability
+- Recommended fix
+
+Prioritize issues by severity.
+```
+
+**Usage:**
+```
+> /security-review
+```
+
+---
+
+## Example 3: Test Command with File Argument
+
+**File:** `.claude/commands/test-file.md`
+
+```markdown
+---
+description: Run tests for specific file
+argument-hint: [test-file]
+allowed-tools: Bash(npm:*), Bash(jest:*)
+---
+
+Run tests for $1:
+
+Test execution: !`npm test $1`
+
+Analyze results:
+- Tests passed/failed
+- Code coverage
+- Performance issues
+- Flaky tests
+
+If failures found, suggest fixes based on error messages.
+```
+
+**Usage:**
+```
+> /test-file src/utils/helpers.test.ts
+```
+
+---
+
+## Example 4: Documentation Generator
+
+**File:** `.claude/commands/document.md`
+
+```markdown
+---
+description: Generate documentation for file
+argument-hint: [source-file]
+---
+
+Generate comprehensive documentation for @$1
+
+Include:
+
+**Overview:**
+- Purpose and responsibility
+- Main functionality
+- Dependencies
+
+**API Documentation:**
+- Function/method signatures
+- Parameter descriptions with types
+- Return values with types
+- Exceptions/errors thrown
+
+**Usage Examples:**
+- Basic usage
+- Common patterns
+- Edge cases
+
+**Implementation Notes:**
+- Algorithm complexity
+- Performance considerations
+- Known limitations
+
+Format as Markdown suitable for project documentation.
+```
+
+**Usage:**
+```
+> /document src/api/users.ts
+```
+
+---
+
+## Example 5: Git Status Summary
+
+**File:** `.claude/commands/git-status.md`
+
+```markdown
+---
+description: Summarize Git repository status
+allowed-tools: Bash(git:*)
+---
+
+Repository Status Summary:
+
+**Current Branch:** !`git branch --show-current`
+
+**Status:** !`git status --short`
+
+**Recent Commits:** !`git log --oneline -5`
+
+**Remote Status:** !`git fetch && git status -sb`
+
+Provide:
+- Summary of changes
+- Suggested next actions
+- Any warnings or issues
+```
+
+**Usage:**
+```
+> /git-status
+```
+
+---
+
+## Example 6: Deployment Command
+
+**File:** `.claude/commands/deploy.md`
+
+```markdown
+---
+description: Deploy to specified environment
+argument-hint: [environment] [version]
+allowed-tools: Bash(kubectl:*), Read
+---
+
+Deploy to $1 environment using version $2
+
+**Pre-deployment Checks:**
+1. Verify $1 configuration exists
+2. Check version $2 is valid
+3. Verify cluster accessibility: !`kubectl cluster-info`
+
+**Deployment Steps:**
+1. Update deployment manifest with version $2
+2. Apply configuration to $1
+3. Monitor rollout status
+4. Verify pod health
+5. Run smoke tests
+
+**Rollback Plan:**
+Document current version for rollback if issues occur.
+
+Proceed with deployment? (yes/no)
+```
+
+**Usage:**
+```
+> /deploy staging v1.2.3
+```
+
+---
+
+## Example 7: Comparison Command
+
+**File:** `.claude/commands/compare-files.md`
+
+```markdown
+---
+description: Compare two files
+argument-hint: [file1] [file2]
+---
+
+Compare @$1 with @$2
+
+**Analysis:**
+
+1. **Differences:**
+ - Lines added
+ - Lines removed
+ - Lines modified
+
+2. **Functional Changes:**
+ - Breaking changes
+ - New features
+ - Bug fixes
+ - Refactoring
+
+3. **Impact:**
+ - Affected components
+ - Required updates elsewhere
+ - Migration requirements
+
+4. **Recommendations:**
+ - Code review focus areas
+ - Testing requirements
+ - Documentation updates needed
+
+Present as structured comparison report.
+```
+
+**Usage:**
+```
+> /compare-files src/old-api.ts src/new-api.ts
+```
+
+---
+
+## Example 8: Quick Fix Command
+
+**File:** `.claude/commands/quick-fix.md`
+
+```markdown
+---
+description: Quick fix for common issues
+argument-hint: [issue-description]
+model: haiku
+---
+
+Quickly fix: $ARGUMENTS
+
+**Approach:**
+1. Identify the issue
+2. Find relevant code
+3. Propose fix
+4. Explain solution
+
+Focus on:
+- Simple, direct solution
+- Minimal changes
+- Following existing patterns
+- No breaking changes
+
+Provide code changes with file paths and line numbers.
+```
+
+**Usage:**
+```
+> /quick-fix button not responding to clicks
+> /quick-fix typo in error message
+```
+
+---
+
+## Example 9: Research Command
+
+**File:** `.claude/commands/research.md`
+
+```markdown
+---
+description: Research best practices for topic
+argument-hint: [topic]
+model: sonnet
+---
+
+Research best practices for: $ARGUMENTS
+
+**Coverage:**
+
+1. **Current State:**
+ - How we currently handle this
+ - Existing implementations
+
+2. **Industry Standards:**
+ - Common patterns
+ - Recommended approaches
+ - Tools and libraries
+
+3. **Comparison:**
+ - Our approach vs standards
+ - Gaps or improvements needed
+ - Migration considerations
+
+4. **Recommendations:**
+ - Concrete action items
+ - Priority and effort estimates
+ - Resources for implementation
+
+Provide actionable guidance based on research.
+```
+
+**Usage:**
+```
+> /research error handling in async operations
+> /research API authentication patterns
+```
+
+---
+
+## Example 10: Explain Code Command
+
+**File:** `.claude/commands/explain.md`
+
+```markdown
+---
+description: Explain how code works
+argument-hint: [file-or-function]
+---
+
+Explain @$1 in detail
+
+**Explanation Structure:**
+
+1. **Overview:**
+ - What it does
+ - Why it exists
+ - How it fits in system
+
+2. **Step-by-Step:**
+ - Line-by-line walkthrough
+ - Key algorithms or logic
+ - Important details
+
+3. **Inputs and Outputs:**
+ - Parameters and types
+ - Return values
+ - Side effects
+
+4. **Edge Cases:**
+ - Error handling
+ - Special cases
+ - Limitations
+
+5. **Usage Examples:**
+ - How to call it
+ - Common patterns
+ - Integration points
+
+Explain at level appropriate for junior engineer.
+```
+
+**Usage:**
+```
+> /explain src/utils/cache.ts
+> /explain AuthService.login
+```
+
+---
+
+## Key Patterns
+
+### Pattern 1: Read-Only Analysis
+
+```markdown
+---
+allowed-tools: Read, Grep
+---
+
+Analyze but don't modify...
+```
+
+**Use for:** Code review, documentation, analysis
+
+### Pattern 2: Git Operations
+
+```markdown
+---
+allowed-tools: Bash(git:*)
+---
+
+!`git status`
+Analyze and suggest...
+```
+
+**Use for:** Repository status, commit analysis
+
+### Pattern 3: Single Argument
+
+```markdown
+---
+argument-hint: [target]
+---
+
+Process $1...
+```
+
+**Use for:** File operations, targeted actions
+
+### Pattern 4: Multiple Arguments
+
+```markdown
+---
+argument-hint: [source] [target] [options]
+---
+
+Process $1 to $2 with $3...
+```
+
+**Use for:** Workflows, deployments, comparisons
+
+### Pattern 5: Fast Execution
+
+```markdown
+---
+model: haiku
+---
+
+Quick simple task...
+```
+
+**Use for:** Simple, repetitive commands
+
+### Pattern 6: File Comparison
+
+```markdown
+Compare @$1 with @$2...
+```
+
+**Use for:** Diff analysis, migration planning
+
+### Pattern 7: Context Gathering
+
+```markdown
+---
+allowed-tools: Bash(git:*), Read
+---
+
+Context: !`git status`
+Files: @file1 @file2
+
+Analyze...
+```
+
+**Use for:** Informed decision making
+
+## Tips for Writing Simple Commands
+
+1. **Start basic:** Single responsibility, clear purpose
+2. **Add complexity gradually:** Start without frontmatter
+3. **Test incrementally:** Verify each feature works
+4. **Use descriptive names:** Command name should indicate purpose
+5. **Document arguments:** Always use argument-hint
+6. **Provide examples:** Show usage in comments
+7. **Handle errors:** Consider missing arguments or files