mirror of
https://github.com/SuperClaude-Org/SuperClaude_Framework.git
synced 2025-12-29 16:16:08 +00:00
Initial commit: SuperClaude v4.0.0 configuration framework
- Core configuration files (CLAUDE.md, RULES.md, PERSONAS.md, MCP.md) - 17 slash commands for specialized workflows - 25 shared YAML resources for advanced configurations - Installation script for global deployment - 9 cognitive personas for specialized thinking modes - MCP integration patterns for intelligent tool usage - Token economy and ultracompressed mode support 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
40
.claude/commands/shared/ambiguity-check.yml
Normal file
40
.claude/commands/shared/ambiguity-check.yml
Normal file
@@ -0,0 +1,40 @@
|
||||
# Ambiguity Check Patterns
|
||||
|
||||
## Integration
|
||||
|
||||
```yaml
|
||||
Commands:
|
||||
Include: shared/ambiguity-check.yml
|
||||
Check: ambiguity_level() before execute
|
||||
Block: CRITICAL ambiguity
|
||||
|
||||
Detection:
|
||||
Keywords: See RULES.md § Ambiguity
|
||||
Missing: Path|Scope|Criteria
|
||||
Risk: Combine w/ operation risk
|
||||
|
||||
Response:
|
||||
LOW: Proceed w/ assumption note
|
||||
MEDIUM: Suggest interpretation+confirm
|
||||
HIGH: Present options A/B/C
|
||||
CRITICAL: Block until clarified
|
||||
```
|
||||
|
||||
## Quick Checks
|
||||
|
||||
```yaml
|
||||
Path Ambiguity:
|
||||
"update config" → Which file?
|
||||
"fix tests" → Which tests?
|
||||
"deploy" → Which environment?
|
||||
|
||||
Scope Ambiguity:
|
||||
"refactor" → Single file or module?
|
||||
"optimize" → Speed or memory?
|
||||
"add security" → What threats?
|
||||
|
||||
Action Ambiguity:
|
||||
"make it work" → Define "work"
|
||||
"fix the bug" → Which bug?
|
||||
"improve" → What aspect?
|
||||
```
|
||||
21
.claude/commands/shared/audit.yml
Normal file
21
.claude/commands/shared/audit.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
# Audit Logging
|
||||
|
||||
```yaml
|
||||
Format: <timestamp>|<operation>|<risk>|<user>|<status>|<details>
|
||||
Location: .claudedocs/audit/YYYY-MM-DD.log | Daily rotate | 10MB max | 30d retention
|
||||
|
||||
Risk: CRIT[10] | HIGH[7-9] | MED[4-6] | LOW[1-3]
|
||||
|
||||
Required:
|
||||
- File deletions/overwrites
|
||||
- Git operations (push,force,rebase)
|
||||
- Database operations
|
||||
- Deployments
|
||||
- Security modifications
|
||||
- Checkpoints/rollbacks
|
||||
|
||||
Integration:
|
||||
Start: audit_log("start",op,risk)
|
||||
Success: audit_log("success",op,risk)
|
||||
Failure: audit_log("fail",op,risk,error)
|
||||
```
|
||||
28
.claude/commands/shared/checkpoint.yml
Normal file
28
.claude/commands/shared/checkpoint.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
# Checkpoint System
|
||||
|
||||
```yaml
|
||||
Create:
|
||||
Tag: git tag checkpoint/<type>-$(date +%Y%m%d-%H%M%S)
|
||||
Stash: git stash push -m "checkpoint-<operation>-<timestamp>"
|
||||
Manifest: .claude/checkpoints/manifest.yml
|
||||
Summary: .claudedocs/summaries/checkpoint-<type>-<timestamp>.md
|
||||
|
||||
Triggers:
|
||||
Auto: Destructive|Refactor|Migration|Permissions|Deploy
|
||||
Manual: User request|Risky ops|Experiments
|
||||
|
||||
Types: feature|fix|refactor|migrate|deploy|manual
|
||||
|
||||
Rollback:
|
||||
Full: git reset --hard <checkpoint>
|
||||
Selective: git checkout <checkpoint> -- <files>
|
||||
Incremental: git revert <commits>
|
||||
Stash: git stash pop
|
||||
|
||||
Process:
|
||||
- Verify checkpoint exists
|
||||
- Check working tree
|
||||
- Confirm w/ user
|
||||
- Create pre-rollback checkpoint
|
||||
- Execute & verify
|
||||
```
|
||||
107
.claude/commands/shared/cleanup-patterns.yml
Normal file
107
.claude/commands/shared/cleanup-patterns.yml
Normal file
@@ -0,0 +1,107 @@
|
||||
# Cleanup Patterns & Safety Rules
|
||||
|
||||
## Safe→Remove (Auto)
|
||||
```yaml
|
||||
Files:
|
||||
- node_modules (if package-lock exists)
|
||||
- dist/, build/, .next/, .nuxt/
|
||||
- .tmp, temp/, cache/
|
||||
- *.log, *.tmp, *.cache
|
||||
- .DS_Store, thumbs.db, desktop.ini
|
||||
- coverage/, .nyc_output/
|
||||
|
||||
Code:
|
||||
- console.log(), console.debug()
|
||||
- debugger; statements
|
||||
- TODO comments >30 days old
|
||||
- Commented code blocks >7 days old
|
||||
- Unused imports (if safe analysis confirms)
|
||||
```
|
||||
|
||||
## Requires Confirmation (Manual)
|
||||
```yaml
|
||||
Files:
|
||||
- Large files >10MB
|
||||
- Untracked files in git
|
||||
- User-specific cfgs (.vscode/, .idea/)
|
||||
- DB files, logs w/ data
|
||||
|
||||
Code:
|
||||
- Unused functions (if no external refs)
|
||||
- Dead code branches
|
||||
- Deprecated API calls
|
||||
- Large commented blocks
|
||||
|
||||
Deps:
|
||||
- Unused packages in package.json
|
||||
- Packages w/ security vulns
|
||||
- Major version updates
|
||||
- Dev deps in prod
|
||||
```
|
||||
|
||||
## Never Remove (Protected)
|
||||
```yaml
|
||||
Files:
|
||||
- .env.example, .env.template
|
||||
- README.md, LICENSE, CHANGELOG
|
||||
- .gitignore, .gitattributes
|
||||
- package.json, package-lock.json
|
||||
- Source code in src/, lib/
|
||||
|
||||
Code:
|
||||
- Error handling blocks
|
||||
- Type definitions
|
||||
- API interfaces
|
||||
- Configuration objects
|
||||
- Test files
|
||||
|
||||
Dependencies:
|
||||
- Core framework packages
|
||||
- Peer dependencies
|
||||
- Packages used in production
|
||||
```
|
||||
|
||||
## Risk Assessment
|
||||
```yaml
|
||||
LOW [1-3]:
|
||||
- Temporary files
|
||||
- Build artifacts
|
||||
- Log files
|
||||
- Cache directories
|
||||
|
||||
MEDIUM [4-6]:
|
||||
- Unused code
|
||||
- Old git branches
|
||||
- Dev dependencies
|
||||
- Config cleanup
|
||||
|
||||
HIGH [7-9]:
|
||||
- Dependency updates
|
||||
- Git history changes
|
||||
- Production configs
|
||||
- Database cleanup
|
||||
|
||||
CRITICAL [10]:
|
||||
- Production data
|
||||
- Security configs
|
||||
- Core framework files
|
||||
- User data
|
||||
```
|
||||
|
||||
## Cleanup Strategies
|
||||
```yaml
|
||||
Incremental:
|
||||
- Start with safe files
|
||||
- Progress to code cleanup
|
||||
- Finish with dependencies
|
||||
|
||||
Verification:
|
||||
- Run tests after code cleanup
|
||||
- Verify builds after file cleanup
|
||||
- Check functionality after deps
|
||||
|
||||
Rollback:
|
||||
- Git commit before cleanup
|
||||
- Backup configs before changes
|
||||
- Document what was removed
|
||||
```
|
||||
52
.claude/commands/shared/command-memory.yml
Normal file
52
.claude/commands/shared/command-memory.yml
Normal file
@@ -0,0 +1,52 @@
|
||||
# Command Result Sharing & Context Mgmt
|
||||
|
||||
## Enhanced Result Storage
|
||||
```yaml
|
||||
Cache Duration: Current session+persistent patterns
|
||||
Storage Format:
|
||||
analyze: {issues[], metrics{}, hotspots[], patterns[]}
|
||||
build: {artifacts[], errors[], warnings[], perf{}}
|
||||
test: {passed[], failed[], coverage%, flaky[]}
|
||||
scan: {vulns[], risks{}, fixes[], compliance{}}
|
||||
design: {arch{}, patterns[], decisions[]}
|
||||
troubleshoot: {findings[], root_causes[], solutions[]}
|
||||
|
||||
Reuse Rules:
|
||||
Same target+flags: Use cache | Modified files: Invalidate
|
||||
Chained commands: Auto-pass results | Time limit: 30min
|
||||
Persistent patterns: Store successful workflows across sessions
|
||||
Context sharing: Pass relevant subset→next command
|
||||
```
|
||||
|
||||
## Advanced Context Chaining
|
||||
```yaml
|
||||
Intelligent Workflows:
|
||||
analyze→improve: Use found issues as targets + priority ranking
|
||||
build→test: Focus on changed modules + integration points
|
||||
scan→fix: Prioritize critical vulnerabilities + context
|
||||
design→build: Apply architectural patterns + decisions
|
||||
troubleshoot→improve: Use root cause analysis for targeted fixes
|
||||
any→deploy: Verify all checks passed + readiness assessment
|
||||
|
||||
Context Enrichment:
|
||||
File Change Detection: Track modifications since last analysis
|
||||
Dependency Mapping: Understand component relationships
|
||||
Performance Baseline: Compare against historical metrics
|
||||
Quality Trends: Track improvement over time
|
||||
User Patterns: Learn from successful workflows
|
||||
```
|
||||
|
||||
## Smart Context Optimization
|
||||
```yaml
|
||||
Memory Management:
|
||||
Essential Context: Keep critical information accessible
|
||||
Token Optimization: Compress verbose results for efficiency
|
||||
Selective Loading: Load only needed context per command
|
||||
Background Processing: Precompute likely needed context
|
||||
|
||||
Pattern Learning:
|
||||
Workflow Recognition: Identify common command sequences
|
||||
Success Patterns: Learn from effective approaches
|
||||
Error Prevention: Remember failure patterns to avoid
|
||||
User Preferences: Adapt to individual working styles
|
||||
```
|
||||
161
.claude/commands/shared/command-templates.yml
Normal file
161
.claude/commands/shared/command-templates.yml
Normal file
@@ -0,0 +1,161 @@
|
||||
# Command Templates - Token Optimized Patterns
|
||||
|
||||
## Legend
|
||||
| Symbol | Meaning | | Abbrev | Meaning |
|
||||
|--------|---------|---|--------|---------|
|
||||
| → | leads to | | cfg | configuration |
|
||||
| & | and/with | | impl | implementation |
|
||||
| w/ | with | | perf | performance |
|
||||
| @ | at/located | | ops | operations |
|
||||
| ∀ | for all/every | | val | validation |
|
||||
| ∃ | exists/there is | | req | requirements |
|
||||
|
||||
## Universal Command Structure Template
|
||||
|
||||
```yaml
|
||||
Command_Header:
|
||||
Execute: "immediately. Add --plan flag if user wants to see plan first."
|
||||
Legend: "@command-specific legend generation"
|
||||
Purpose: "[Action] [Subject] specified in $ARGUMENTS"
|
||||
|
||||
Universal_Flags:
|
||||
Planning: "--plan (show execution plan)"
|
||||
Thinking: "--think | --think-hard | --ultrathink"
|
||||
Docs: "--uc (ultracompressed mode)"
|
||||
MCP: "--c7 --seq --magic --pup | --no-mcp"
|
||||
|
||||
Flag_Templates:
|
||||
MCP_Control: "@see shared/mcp-flags.yml"
|
||||
Thinking_Modes: "@see shared/thinking-modes.yml"
|
||||
Planning_Mode: "@see shared/planning-mode.yml"
|
||||
|
||||
Research_Requirements:
|
||||
Standard: "shared/research-first.yml enforced"
|
||||
External_Libs: "C7/WebSearch docs required"
|
||||
Patterns: "Official verification mandatory"
|
||||
Citations: "// Source: [doc ref] required"
|
||||
|
||||
Report_Output:
|
||||
Location: ".claudedocs/[type]/[command]-[type]-<timestamp>.md"
|
||||
Directory: "mkdir -p .claudedocs/[type]/"
|
||||
Reference: "📄 Report saved to: [path]"
|
||||
```
|
||||
|
||||
## Command Type Templates
|
||||
|
||||
```yaml
|
||||
Analysis_Commands:
|
||||
Structure: "Analyze [subject] using [method]"
|
||||
Flags: "--code --architecture --security --performance"
|
||||
Output: "Analysis reports→.claudedocs/reports/"
|
||||
|
||||
Build_Commands:
|
||||
Structure: "Build [type] w/ [requirements]"
|
||||
Flags: "--init --feature --tdd --watch"
|
||||
Output: "Working code + tests + docs"
|
||||
|
||||
Workflow_Commands:
|
||||
Structure: "[Action] using [workflow] pattern"
|
||||
Flags: "--dry-run --interactive --iterate"
|
||||
Output: "Process results + metrics"
|
||||
```
|
||||
|
||||
## Shared Flag Descriptions
|
||||
|
||||
```yaml
|
||||
Core_Flags:
|
||||
plan: "Show execution plan before running"
|
||||
think: "Multi-file analysis w/ context (4K)"
|
||||
think_hard: "Deep system analysis (10K)"
|
||||
ultrathink: "Comprehensive analysis (32K)"
|
||||
uc: "UltraCompressed mode (~70% token reduction)"
|
||||
|
||||
MCP_Flags:
|
||||
c7: "Context7→docs & examples"
|
||||
seq: "Sequential→complex thinking"
|
||||
magic: "Magic→UI component generation"
|
||||
pup: "Puppeteer→browser automation"
|
||||
no_mcp: "Disable all MCP servers"
|
||||
|
||||
Quality_Flags:
|
||||
tdd: "Test-driven development"
|
||||
coverage: "Code coverage analysis"
|
||||
validate: "Validation & verification"
|
||||
security: "Security scan & audit"
|
||||
|
||||
Workflow_Flags:
|
||||
dry_run: "Preview w/o execution"
|
||||
watch: "Continuous monitoring"
|
||||
interactive: "Step-by-step guidance"
|
||||
iterate: "Iterative improvement"
|
||||
```
|
||||
|
||||
## Cross-Reference System
|
||||
|
||||
```yaml
|
||||
Instead_Of_Repeating:
|
||||
MCP_Explanations: "@see shared/mcp-flags.yml"
|
||||
Thinking_Modes: "@see shared/thinking-modes.yml"
|
||||
Research_Standards: "@see shared/research-first.yml"
|
||||
Validation_Rules: "@see shared/validation.yml"
|
||||
Performance_Patterns: "@see shared/performance-monitoring.yml"
|
||||
|
||||
Template_Usage:
|
||||
Command_File: |
|
||||
@include shared/command-templates.yml#Analysis_Commands
|
||||
@flags shared/command-templates.yml#Core_Flags,MCP_Flags
|
||||
|
||||
Reference_Format: "@see [file]#[section]"
|
||||
Include_Format: "@include [file]#[section]"
|
||||
```
|
||||
|
||||
## Token Optimization Patterns
|
||||
|
||||
```yaml
|
||||
Compression_Rules:
|
||||
Articles: Remove "the|a|an" where clear
|
||||
Conjunctions: Replace "and"→"&" | "with"→"w/"
|
||||
Prepositions: Compress "at"→"@" | "to"→"→"
|
||||
Verbose_Phrases: "in order to"→"to" | "make sure"→"ensure"
|
||||
|
||||
Symbol_Expansion:
|
||||
Mathematics: ∀(all) ∃(exists) ∈(member) ⊂(subset) ∪(union) ∩(intersection)
|
||||
Logic: ∴(therefore) ∵(because) ≡(equivalent) ≈(approximately)
|
||||
Process: ▶(start) ⏸(pause) ⏹(stop) ⚡(fast) 🔄(cycle)
|
||||
Quality: ✅(success) ❌(failure) ⚠(warning) 📊(metrics)
|
||||
|
||||
Structure_Priority:
|
||||
1_YAML: Most compact structured data
|
||||
2_Tables: Comparison & reference data
|
||||
3_Lists: Enumeration & sequences
|
||||
4_Prose: Only when necessary
|
||||
|
||||
Abbreviation_Standards:
|
||||
Technical: cfg(config) impl(implementation) perf(performance) val(validation)
|
||||
Actions: analyze→anlz | build→bld | deploy→dply | test→tst
|
||||
Objects: database→db | interface→api | environment→env | dependency→dep
|
||||
```
|
||||
|
||||
## Implementation Notes
|
||||
|
||||
```yaml
|
||||
Usage_Pattern:
|
||||
1_Define_Template: Create in shared/command-templates.yml
|
||||
2_Reference_Template: Use @include in command files
|
||||
3_Override_Specific: Add command-specific details only
|
||||
4_Validate_Consistency: Auto-check cross-references
|
||||
|
||||
Benefits:
|
||||
Token_Reduction: ~40% reduction in command file size
|
||||
Consistency: Standardized patterns across all commands
|
||||
Maintenance: Single source of truth for common elements
|
||||
Scalability: Easy addition of new commands using templates
|
||||
|
||||
Migration_Strategy:
|
||||
Phase_1: Create templates for most common patterns
|
||||
Phase_2: Update existing commands to use templates
|
||||
Phase_3: Implement auto-validation of template usage
|
||||
```
|
||||
|
||||
---
|
||||
*Command Templates v1.0 - Token-optimized reusable patterns for SuperClaude commands*
|
||||
206
.claude/commands/shared/config-validator.yml
Normal file
206
.claude/commands/shared/config-validator.yml
Normal file
@@ -0,0 +1,206 @@
|
||||
# Config Validation System
|
||||
|
||||
## Legend
|
||||
| Symbol | Meaning | | Abbrev | Meaning |
|
||||
|--------|---------|---|--------|---------|
|
||||
| → | leads to | | cfg | configuration |
|
||||
| & | and/with | | val | validation |
|
||||
| ✅ | valid/success | | req | required |
|
||||
| ❌ | invalid/error | | dep | dependency |
|
||||
|
||||
## Validation Rules
|
||||
|
||||
```yaml
|
||||
Core_Config_Files:
|
||||
Required_Files:
|
||||
- ~/.claude/CLAUDE.md
|
||||
- ~/.claude/RULES.md
|
||||
- ~/.claude/PERSONAS.md
|
||||
- ~/.claude/MCP.md
|
||||
|
||||
YAML_Syntax_Check:
|
||||
Tool: "yamllint --strict"
|
||||
Rules: "No syntax errors, proper indentation, valid structure"
|
||||
Action_On_Fail: "Block loading, show specific line errors"
|
||||
|
||||
Cross_Reference_Validation:
|
||||
Persona_Command_Matrix:
|
||||
Check: "All personas reference valid commands"
|
||||
Example: "architect → /user:design --api (must exist)"
|
||||
|
||||
MCP_Server_References:
|
||||
Check: "All MCP flags reference available servers"
|
||||
Valid: "--c7 --seq --magic --pup"
|
||||
Invalid: "--unknown-mcp"
|
||||
|
||||
Shared_Resource_Links:
|
||||
Check: "@see shared/file.yml references exist"
|
||||
Pattern: "@see shared/([^\\s]+)"
|
||||
Validation: "File exists & section valid"
|
||||
|
||||
Command_Flag_Consistency:
|
||||
Check: "Universal flags defined consistently"
|
||||
Universal: "--plan --think --think-hard --ultrathink --uc"
|
||||
MCP: "--c7 --seq --magic --pup --no-mcp"
|
||||
```
|
||||
|
||||
## Dependency Validation
|
||||
|
||||
```yaml
|
||||
Command_Dependencies:
|
||||
Required_Sections:
|
||||
- Legend (w/ symbols used in file)
|
||||
- Command description
|
||||
- Examples
|
||||
- Deliverables
|
||||
|
||||
Flag_Definitions:
|
||||
Check: "All flags mentioned have descriptions"
|
||||
Pattern: "--([a-z-]+)"
|
||||
Validation: "Flag documented in file or shared templates"
|
||||
|
||||
MCP_Integration:
|
||||
Consistency: "MCP usage matches persona preferences"
|
||||
Example: "frontend persona → prefers --magic flag"
|
||||
|
||||
Research_Requirements:
|
||||
Check: "All commands reference research-first.yml"
|
||||
Required: "@see shared/research-first.yml"
|
||||
|
||||
Shared_Resource_Dependencies:
|
||||
Template_Usage:
|
||||
Pattern: "@include shared/([^#]+)#([^\\s]+)"
|
||||
Validation: "Template file exists & section defined"
|
||||
|
||||
Cross_References:
|
||||
Pattern: "@see shared/([^\\s]+)"
|
||||
Validation: "Referenced files exist & accessible"
|
||||
|
||||
Symbol_Consistency:
|
||||
Check: "Symbols used match legend definitions"
|
||||
Validation: "All symbols (→ & w/ @) defined in legend"
|
||||
```
|
||||
|
||||
## Validation Implementation
|
||||
|
||||
```yaml
|
||||
Pre_Load_Checks:
|
||||
1_File_Existence:
|
||||
Check: "All required files present"
|
||||
Action: "Create missing w/ defaults or block"
|
||||
|
||||
2_YAML_Syntax:
|
||||
Tool: "Built-in YAML parser"
|
||||
Report: "Line-specific syntax errors"
|
||||
|
||||
3_Cross_References:
|
||||
Check: "All @see & @include links valid"
|
||||
Report: "Broken references w/ suggestions"
|
||||
|
||||
4_Consistency:
|
||||
Check: "Persona↔command↔MCP alignment"
|
||||
Report: "Inconsistencies w/ recommended fixes"
|
||||
|
||||
Runtime_Validation:
|
||||
Command_Execution:
|
||||
Check: "Requested command exists & valid"
|
||||
Check: "All flags recognized"
|
||||
Check: "MCP servers available"
|
||||
|
||||
Context_Validation:
|
||||
Check: "Required dependencies present"
|
||||
Check: "Permissions adequate"
|
||||
Check: "No circular references"
|
||||
|
||||
Auto_Repair:
|
||||
Missing_Sections:
|
||||
Action: "Generate w/ templates"
|
||||
Example: "Missing legend → auto-generate from symbols used"
|
||||
|
||||
Broken_References:
|
||||
Action: "Suggest alternatives or create stubs"
|
||||
Example: "@see missing-file.yml → create basic template"
|
||||
|
||||
Outdated_Patterns:
|
||||
Action: "Suggest modernization"
|
||||
Example: "Old flag syntax → new standardized format"
|
||||
```
|
||||
|
||||
## Validation Reports
|
||||
|
||||
```yaml
|
||||
Report_Structure:
|
||||
Location: ".claudedocs/validation/config-validation-<timestamp>.md"
|
||||
Sections:
|
||||
- Executive Summary (✅❌ counts)
|
||||
- File-by-file detailed results
|
||||
- Cross-reference matrix
|
||||
- Recommended actions
|
||||
- Auto-repair options
|
||||
|
||||
Severity_Levels:
|
||||
CRITICAL: "Syntax errors, missing required files"
|
||||
HIGH: "Broken cross-references, invalid MCP refs"
|
||||
MEDIUM: "Missing documentation, inconsistent patterns"
|
||||
LOW: "Style issues, optimization opportunities"
|
||||
|
||||
Actions_By_Severity:
|
||||
CRITICAL: "Block loading until fixed"
|
||||
HIGH: "Warn & continue w/ degraded functionality"
|
||||
MEDIUM: "Note in report, suggest fixes"
|
||||
LOW: "Background report only"
|
||||
```
|
||||
|
||||
## Integration Points
|
||||
|
||||
```yaml
|
||||
SuperClaude_Startup:
|
||||
1_Run_Validation: "Before loading any configs"
|
||||
2_Report_Issues: "Show summary to user"
|
||||
3_Auto_Repair: "Fix what can be auto-repaired"
|
||||
4_Block_Critical: "Don't load if critical errors"
|
||||
|
||||
Command_Execution:
|
||||
Pre_Execution: "Validate command & flags exist"
|
||||
Runtime: "Check dependencies available"
|
||||
Post_Execution: "Validate output format"
|
||||
|
||||
Config_Updates:
|
||||
On_File_Change: "Re-validate affected files"
|
||||
On_Install: "Full validation before deployment"
|
||||
Periodic: "Weekly validation health check"
|
||||
|
||||
Developer_Tools:
|
||||
CLI_Command: "/user:validate --config"
|
||||
Report_Command: "/user:validate --report"
|
||||
Fix_Command: "/user:validate --auto-repair"
|
||||
```
|
||||
|
||||
## Implementation Examples
|
||||
|
||||
```yaml
|
||||
Basic_Usage:
|
||||
Manual: "validate_config() before load"
|
||||
Automatic: "Built into SuperClaude startup"
|
||||
Reporting: "Generate .claudedocs/validation/ reports"
|
||||
|
||||
Error_Examples:
|
||||
Syntax_Error: |
|
||||
"YAML syntax error in PERSONAS.md line 42:
|
||||
Expected scalar, found sequence
|
||||
Fix: Check indentation & structure"
|
||||
|
||||
Broken_Reference: |
|
||||
"@see shared/missing-file.yml not found
|
||||
Suggestions:
|
||||
- Create missing-file.yml w/ template
|
||||
- Fix reference to shared/existing-file.yml"
|
||||
|
||||
Inconsistency: |
|
||||
"Persona 'frontend' references --magic flag
|
||||
but MCP.md shows Magic server disabled
|
||||
Fix: Enable Magic server or update persona"
|
||||
```
|
||||
|
||||
---
|
||||
*Config Validator v1.0 - Automated validation for SuperClaude configuration integrity*
|
||||
134
.claude/commands/shared/documentation-dirs.yml
Normal file
134
.claude/commands/shared/documentation-dirs.yml
Normal file
@@ -0,0 +1,134 @@
|
||||
# Docs Directory Standards
|
||||
|
||||
## Directory Structure
|
||||
```yaml
|
||||
Claude_Operational_Docs:
|
||||
Base_Directory: .claudedocs/
|
||||
|
||||
Structure:
|
||||
audit/: # Audit logs & op history
|
||||
reports/: # Analysis reports, scan results, findings
|
||||
summaries/: # Command summaries, estimates, overviews
|
||||
metrics/: # Perf metrics, coverage reports, benchmarks
|
||||
incidents/: # Troubleshooting RCAs, incident docs
|
||||
|
||||
Naming_Conventions:
|
||||
Reports: <command>-<type>-<timestamp>.md
|
||||
Metrics: <metric>-<date>.md|html|json
|
||||
Audit: audit-<YYYY-MM-DD>.log
|
||||
|
||||
Examples:
|
||||
- .claudedocs/reports/analysis-security-20240115-143022.md
|
||||
- .claudedocs/metrics/coverage-20240115.html
|
||||
- .claudedocs/audit/audit-2024-01-15.log
|
||||
- .claudedocs/incidents/rca-api-timeout-20240115-143022.md
|
||||
|
||||
Project_Documentation:
|
||||
Base_Directory: /docs
|
||||
|
||||
Structure:
|
||||
api/: # API documentation, endpoints, schemas
|
||||
guides/: # User guides, tutorials, how-tos
|
||||
architecture/: # System design, diagrams, decisions
|
||||
development/: # Developer setup, contributing, standards
|
||||
references/: # Quick references, cheat sheets
|
||||
|
||||
Organization:
|
||||
- README.md at each level
|
||||
- index.md for navigation
|
||||
- Versioned subdirectories when needed
|
||||
- Assets in dedicated folders
|
||||
|
||||
Examples:
|
||||
- /docs/api/rest-api.md
|
||||
- /docs/guides/getting-started.md
|
||||
- /docs/architecture/system-overview.md
|
||||
- /docs/development/setup.md
|
||||
```
|
||||
|
||||
## Enforcement Rules
|
||||
```yaml
|
||||
Directory_Creation:
|
||||
Auto_Create: true
|
||||
Permissions: 755 for dirs, 644 for files
|
||||
|
||||
Pre_Write_Check:
|
||||
- Verify parent directory exists
|
||||
- Create if missing with proper permissions
|
||||
- Validate write access
|
||||
- Handle errors gracefully
|
||||
|
||||
Report_Generation:
|
||||
Required_Headers:
|
||||
- Generated by: SuperClaude v4.0.0
|
||||
- Command: /user:<command> [flags]
|
||||
- Timestamp: ISO 8601 format
|
||||
- Duration: Operation time
|
||||
|
||||
Format_Standards:
|
||||
- Markdown for human-readable reports
|
||||
- JSON for machine-readable metrics
|
||||
- HTML for coverage reports
|
||||
- Plain text for logs
|
||||
|
||||
Documentation_Standards:
|
||||
Project_Docs:
|
||||
- Clear section headers
|
||||
- Table of contents for long docs
|
||||
- Code examples with syntax highlighting
|
||||
- Cross-references to related docs
|
||||
|
||||
Operational_Reports:
|
||||
- Executive summary first
|
||||
- Detailed findings follow
|
||||
- Actionable recommendations
|
||||
- Severity/priority indicators
|
||||
```
|
||||
|
||||
## Integration Points
|
||||
```yaml
|
||||
Commands:
|
||||
analyze: → .claudedocs/reports/analysis-*.md
|
||||
scan: → .claudedocs/reports/scan-*.md
|
||||
test: → .claudedocs/metrics/coverage-*.html
|
||||
improve: → .claudedocs/metrics/quality-*.md
|
||||
troubleshoot: → .claudedocs/incidents/rca-*.md
|
||||
estimate: → .claudedocs/summaries/estimate-*.md
|
||||
document: → /docs/[category]/*.md
|
||||
|
||||
Shared_Resources:
|
||||
audit.yml: → .claudedocs/audit/
|
||||
performance-monitoring.yml: → .claudedocs/metrics/
|
||||
checkpoint.yml: → .claudedocs/summaries/checkpoint-*.md
|
||||
```
|
||||
|
||||
## Output Notifications
|
||||
```yaml
|
||||
Report_Created:
|
||||
Format: "📄 Report saved to: <path>"
|
||||
Example: "📄 Analysis report saved to: .claudedocs/reports/analysis-security-20240115-143022.md"
|
||||
|
||||
Documentation_Created:
|
||||
Format: "📚 Documentation created: <path>"
|
||||
Example: "📚 API documentation created: /docs/api/endpoints.md"
|
||||
|
||||
Directory_Created:
|
||||
Format: "📁 Created directory: <path>"
|
||||
Show: Only on first creation
|
||||
```
|
||||
|
||||
## Gitignore Recommendations
|
||||
```yaml
|
||||
# Add to .gitignore:
|
||||
.claudedocs/audit/ # Operational logs
|
||||
.claudedocs/metrics/ # Performance data
|
||||
.claudedocs/incidents/ # Sensitive RCAs
|
||||
|
||||
# Keep in git:
|
||||
.claudedocs/reports/ # Useful analysis reports
|
||||
.claudedocs/summaries/ # Important summaries
|
||||
/docs/ # All project documentation
|
||||
```
|
||||
|
||||
---
|
||||
*Documentation Directory Standards: Organizing Claude's output professionally*
|
||||
224
.claude/commands/shared/error-recovery-enhanced.yml
Normal file
224
.claude/commands/shared/error-recovery-enhanced.yml
Normal file
@@ -0,0 +1,224 @@
|
||||
# Enhanced Error Recovery System
|
||||
|
||||
## Legend
|
||||
| Symbol | Meaning | | Abbrev | Meaning |
|
||||
|--------|---------|---|--------|---------|
|
||||
| 🔄 | retry/recovery | | err | error |
|
||||
| ⚠ | warning/caution | | rec | recovery |
|
||||
| ✅ | success/fixed | | fail | failure |
|
||||
| 🔧 | repair/fix | | ctx | context |
|
||||
|
||||
## Intelligent Retry Strategies
|
||||
|
||||
```yaml
|
||||
Error_Classification:
|
||||
Transient_Errors:
|
||||
Network_Timeouts: "MCP server unreachable, API timeouts"
|
||||
Resource_Busy: "File locked, system overloaded"
|
||||
Rate_Limits: "API quota exceeded, temporary blocks"
|
||||
|
||||
Permanent_Errors:
|
||||
Syntax_Errors: "Invalid code, malformed input"
|
||||
Permission_Denied: "Access restrictions, auth failures"
|
||||
Not_Found: "Missing files, invalid paths"
|
||||
|
||||
Context_Errors:
|
||||
Configuration: "Invalid settings, missing dependencies"
|
||||
State_Conflicts: "Dirty working tree, merge conflicts"
|
||||
Version_Mismatch: "Incompatible versions, deprecated APIs"
|
||||
|
||||
Retry_Logic:
|
||||
Exponential_Backoff:
|
||||
Base_Delay: "1 second"
|
||||
Max_Delay: "60 seconds"
|
||||
Max_Attempts: "3 for transient, 1 for permanent"
|
||||
Jitter: "±25% randomization to avoid thundering herd"
|
||||
|
||||
Adaptive_Strategy:
|
||||
Network_Errors: "Retry w/ longer timeout"
|
||||
Rate_Limits: "Wait for reset period + retry"
|
||||
Resource_Busy: "Short delay + retry w/ alternative"
|
||||
Permanent: "No retry, immediate fallback"
|
||||
```
|
||||
|
||||
## MCP Server Failover
|
||||
|
||||
```yaml
|
||||
Failover_Hierarchy:
|
||||
Context7_Failure:
|
||||
Primary: "C7 documentation lookup"
|
||||
Fallback_1: "WebSearch official docs"
|
||||
Fallback_2: "Local cache if available"
|
||||
Fallback_3: "Continue w/ warning + note limitation"
|
||||
|
||||
Sequential_Failure:
|
||||
Primary: "Sequential thinking server"
|
||||
Fallback_1: "Native step-by-step analysis"
|
||||
Fallback_2: "Simplified linear approach"
|
||||
Fallback_3: "Manual breakdown w/ user input"
|
||||
|
||||
Magic_Failure:
|
||||
Primary: "Magic UI component generation"
|
||||
Fallback_1: "Search existing components in project"
|
||||
Fallback_2: "Generate basic template manually"
|
||||
Fallback_3: "Provide implementation guidance"
|
||||
|
||||
Puppeteer_Failure:
|
||||
Primary: "Browser automation & testing"
|
||||
Fallback_1: "Manual test instructions"
|
||||
Fallback_2: "Static analysis alternatives"
|
||||
Fallback_3: "Skip browser-specific operations"
|
||||
|
||||
Server_Health_Monitoring:
|
||||
Availability_Check:
|
||||
Frequency: "Every 5 minutes during active use"
|
||||
Timeout: "3 seconds per check"
|
||||
Circuit_Breaker: "Disable after 3 consecutive failures"
|
||||
Recovery_Check: "Re-enable after 5 minutes"
|
||||
|
||||
Performance_Degradation:
|
||||
Slow_Response: ">30s response time"
|
||||
Action: "Switch to faster alternative if available"
|
||||
Notification: "Inform user of performance impact"
|
||||
```
|
||||
|
||||
## Context Preservation
|
||||
|
||||
```yaml
|
||||
Operation_Checkpoints:
|
||||
Before_Risky_Operations:
|
||||
Create_Checkpoint: "Save current state before destructive ops"
|
||||
Include: "File states, working directory, command context"
|
||||
Location: ".claudedocs/checkpoints/checkpoint-<timestamp>"
|
||||
|
||||
During_Command_Chains:
|
||||
Intermediate_Results: "Save results after each successful step"
|
||||
Context_Handoff: "Pass validated context to next command"
|
||||
Rollback_Points: "Mark safe restoration points"
|
||||
|
||||
Failure_Recovery:
|
||||
Partial_Completion: "Preserve completed work"
|
||||
State_Analysis: "Determine safe rollback point"
|
||||
User_Options: "Present recovery choices"
|
||||
|
||||
Context_Resilience:
|
||||
Session_State:
|
||||
Persistent_Storage: "Maintain state across interruptions"
|
||||
Auto_Save: "Periodic context snapshots"
|
||||
Recovery: "Restore from last known good state"
|
||||
|
||||
Command_Chain_Recovery:
|
||||
Failed_Step_Isolation: "Don't lose previous successful steps"
|
||||
Alternative_Paths: "Suggest different approaches for failed step"
|
||||
Partial_Results: "Use completed work in recovery strategy"
|
||||
```
|
||||
|
||||
## Proactive Error Prevention
|
||||
|
||||
```yaml
|
||||
Pre_Execution_Validation:
|
||||
Environment_Check:
|
||||
Required_Tools: "Verify dependencies before starting"
|
||||
Permissions: "Check access rights for planned operations"
|
||||
Disk_Space: "Ensure adequate space for outputs"
|
||||
Network: "Verify connectivity for remote operations"
|
||||
|
||||
Conflict_Detection:
|
||||
File_Locks: "Check for locked files before editing"
|
||||
Git_State: "Verify clean working tree for git ops"
|
||||
Process_Conflicts: "Detect conflicting background processes"
|
||||
|
||||
Resource_Availability:
|
||||
Memory_Usage: "Ensure adequate RAM for large operations"
|
||||
CPU_Load: "Warn if system under heavy load"
|
||||
Token_Budget: "Estimate token usage vs available quota"
|
||||
|
||||
Risk_Assessment:
|
||||
Operation_Scoring:
|
||||
Data_Loss_Risk: "1-10 scale based on destructiveness"
|
||||
Reversibility: "Can operation be undone?"
|
||||
Scope_Impact: "How many files/systems affected?"
|
||||
|
||||
Mitigation_Requirements:
|
||||
High_Risk: "Require explicit confirmation + backup"
|
||||
Medium_Risk: "Warn user + create checkpoint"
|
||||
Low_Risk: "Proceed w/ monitoring"
|
||||
```
|
||||
|
||||
## Enhanced Error Reporting
|
||||
|
||||
```yaml
|
||||
Intelligent_Error_Messages:
|
||||
Root_Cause_Analysis:
|
||||
Technical_Details: "Specific error codes, stack traces"
|
||||
User_Context: "What user was trying to accomplish"
|
||||
Environmental_Factors: "System state, recent changes"
|
||||
|
||||
Actionable_Guidance:
|
||||
Immediate_Steps: "What user can do right now"
|
||||
Alternative_Approaches: "Different ways to achieve goal"
|
||||
Prevention: "How to avoid this error in future"
|
||||
|
||||
Context_Preservation:
|
||||
Session_Info: "Command history, current state"
|
||||
Relevant_Files: "Which files were being processed"
|
||||
System_State: "Git status, dependency versions"
|
||||
|
||||
Error_Learning:
|
||||
Pattern_Recognition:
|
||||
Frequent_Issues: "Track commonly occurring errors"
|
||||
User_Patterns: "Learn user-specific failure modes"
|
||||
System_Patterns: "Identify environment-specific issues"
|
||||
|
||||
Adaptive_Responses:
|
||||
Personalized_Suggestions: "Based on user's history"
|
||||
Proactive_Warnings: "Predict likely issues"
|
||||
Automated_Fixes: "Apply known solutions automatically"
|
||||
```
|
||||
|
||||
## Implementation Integration
|
||||
|
||||
```yaml
|
||||
Command_Wrapper_Enhancement:
|
||||
Error_Boundary:
|
||||
Catch_All_Errors: "Wrap every operation in try/catch"
|
||||
Classify_Error: "Determine error type & appropriate response"
|
||||
Apply_Strategy: "Retry, failover, or graceful degradation"
|
||||
|
||||
Context_Management:
|
||||
Save_State: "Before each significant operation"
|
||||
Track_Progress: "Monitor completion of multi-step processes"
|
||||
Restore_State: "On failure, return to last good state"
|
||||
|
||||
Recovery_Commands:
|
||||
Manual_Recovery: "/user:recover --from-checkpoint"
|
||||
Status_Check: "/user:recovery-status"
|
||||
Clear_State: "/user:recovery-clear"
|
||||
|
||||
Integration_Points:
|
||||
All_Commands: "Enhanced error handling built into every command"
|
||||
MCP_Servers: "Automatic failover & circuit breaker patterns"
|
||||
User_Experience: "Seamless recovery w/ minimal interruption"
|
||||
```
|
||||
|
||||
## Usage Examples
|
||||
|
||||
```yaml
|
||||
Network_Failure_Scenario:
|
||||
Error: "Context7 server timeout during docs lookup"
|
||||
Recovery: "Auto-fallback to WebSearch → local cache"
|
||||
User_Experience: "⚠ Using cached docs (Context7 unavailable)"
|
||||
|
||||
File_Lock_Scenario:
|
||||
Error: "Cannot edit file (locked by another process)"
|
||||
Recovery: "Wait 5s → retry → suggest alternatives"
|
||||
User_Experience: "Retrying in 5s... or try manual edit"
|
||||
|
||||
Command_Chain_Failure:
|
||||
Error: "Step 3 of 5 fails in build workflow"
|
||||
Recovery: "Preserve steps 1-2, suggest alternatives for 3"
|
||||
User_Experience: "Build partially complete. Alternative approaches: ..."
|
||||
```
|
||||
|
||||
---
|
||||
*Enhanced Error Recovery v1.0 - Intelligent resilience for SuperClaude operations*
|
||||
173
.claude/commands/shared/error-recovery.yml
Normal file
173
.claude/commands/shared/error-recovery.yml
Normal file
@@ -0,0 +1,173 @@
|
||||
# Error Recovery & Resilience Patterns
|
||||
|
||||
## Error Classification & Response
|
||||
|
||||
```yaml
|
||||
Error Severity Levels:
|
||||
CRITICAL [10]: Data loss, security breach, prod down
|
||||
Response: Immediate stop, alert, rollback, incident response
|
||||
Recovery: Manual intervention required, full investigation
|
||||
|
||||
HIGH [7-9]: Build failure, test failure, deployment issues
|
||||
Response: Stop workflow, notify user, suggest fixes
|
||||
Recovery: Automated retry w/ backoff, alternative paths
|
||||
|
||||
MEDIUM [4-6]: Warning conditions, perf degradation
|
||||
Response: Continue w/ warning, log for later review
|
||||
Recovery: Attempt optimization, monitor for escalation
|
||||
|
||||
LOW [1-3]: Info messages, style violations, minor optimizations
|
||||
Response: Note in output, continue execution
|
||||
Recovery: Background fixes, cleanup on completion
|
||||
|
||||
Error Categories:
|
||||
Transient: Network timeouts, temp resource unavailability
|
||||
Strategy: Exponential backoff retry, circuit breaker pattern
|
||||
|
||||
Config: Missing env vars, incorrect settings, permissions
|
||||
Strategy: Validation, helpful error msgs, setup guidance
|
||||
|
||||
Logic: Code bugs, algorithm errors, edge cases
|
||||
Strategy: Fallback implementations, graceful degradation
|
||||
|
||||
Resource: Out of memory, disk space, API rate limits
|
||||
Strategy: Resource monitoring, cleanup, queue management
|
||||
```
|
||||
|
||||
## Recovery Strategies
|
||||
|
||||
```yaml
|
||||
Automatic Recovery:
|
||||
Retry Mechanisms:
|
||||
Simple: Up to 3 attempts with 1s delay
|
||||
Exponential: 1s, 2s, 4s, 8s delays with jitter
|
||||
Circuit Breaker: Stop retries after threshold failures
|
||||
|
||||
Fallback Patterns:
|
||||
Alternative Commands: Use native tools if MCP fails
|
||||
Degraded Functionality: Skip non-essential features
|
||||
Cached Results: Use previous successful outputs
|
||||
|
||||
State Management:
|
||||
Checkpoints: Save state before risky operations
|
||||
Rollback: Automatic revert to last known good state
|
||||
Cleanup: Remove partial results on failure
|
||||
|
||||
Manual Recovery:
|
||||
User Guidance:
|
||||
Clear Error Messages: What failed, why, how to fix
|
||||
Action Items: Specific steps user can take
|
||||
Documentation Links: Relevant help resources
|
||||
|
||||
Intervention Points:
|
||||
Confirmation: Ask before destructive operations
|
||||
Override: Allow user to skip validation warnings
|
||||
Custom: Accept user-provided alternative approaches
|
||||
|
||||
Recovery Tools:
|
||||
Diagnostic: Commands to investigate failures
|
||||
Repair: Automated fixes for common issues
|
||||
Reset: Return to clean state for fresh start
|
||||
```
|
||||
|
||||
## Command-Specific Recovery
|
||||
|
||||
```yaml
|
||||
Build Failures:
|
||||
Clean & Retry: Remove artifacts, clear cache, rebuild
|
||||
Dependency Issues: Update lockfiles, reinstall packages
|
||||
Compilation Errors: Suggest fixes, alternative approaches
|
||||
|
||||
Test Failures:
|
||||
Flaky Tests: Retry failed tests, identify unstable tests
|
||||
Environment Issues: Reset test state, check prerequisites
|
||||
Coverage Gaps: Generate missing tests, update thresholds
|
||||
|
||||
Deploy Failures:
|
||||
Health Check Failures: Rollback, investigate logs
|
||||
Resource Constraints: Scale up, optimize deployment
|
||||
Configuration Issues: Validate settings, check secrets
|
||||
|
||||
Analysis Failures:
|
||||
Tool Unavailable: Fallback to alternative analysis tools
|
||||
Large Codebase: Reduce scope, batch processing
|
||||
Permission Issues: Guide user through access setup
|
||||
|
||||
MCP Server Failures:
|
||||
Connection Issues: Retry with exponential backoff
|
||||
Timeout: Reduce request complexity, use native tools
|
||||
Rate Limiting: Queue requests, implement backoff
|
||||
Service Unavailable: Fallback to cached results or native tools
|
||||
```
|
||||
|
||||
## Error Monitoring & Learning
|
||||
|
||||
```yaml
|
||||
Error Tracking:
|
||||
Frequency: Count occurrence of specific error types
|
||||
Patterns: Identify common failure sequences
|
||||
Trends: Monitor error rates over time
|
||||
Context: Track environmental factors during failures
|
||||
|
||||
Failure Analysis:
|
||||
Root Cause: Automated analysis of failure chains
|
||||
Prevention: Suggest preventive measures
|
||||
Optimization: Identify improvement opportunities
|
||||
Documentation: Update guides based on common issues
|
||||
|
||||
Learning System:
|
||||
Success Patterns: Learn from successful recovery strategies
|
||||
User Preferences: Remember user's preferred recovery methods
|
||||
Environment Adaptation: Adjust strategies based on project context
|
||||
Continuous Improvement: Update recovery logic based on outcomes
|
||||
```
|
||||
|
||||
## Integration with Commands
|
||||
|
||||
```yaml
|
||||
Pre-Execution Validation:
|
||||
Prerequisites: Check required tools, permissions, resources
|
||||
Environment: Validate configuration, network connectivity
|
||||
State: Ensure clean starting state, no conflicts
|
||||
|
||||
During Execution:
|
||||
Monitoring: Track progress, resource usage, early warnings
|
||||
Checkpointing: Save state at critical milestones
|
||||
Health Checks: Validate system state during long operations
|
||||
|
||||
Post-Execution:
|
||||
Verification: Confirm expected outcomes achieved
|
||||
Cleanup: Remove temporary files, release resources
|
||||
Reporting: Document successes, failures, lessons learned
|
||||
|
||||
Error Reporting Format:
|
||||
Structured: Consistent error message format across commands
|
||||
Actionable: Include specific steps for resolution
|
||||
Contextual: Provide relevant system and environment information
|
||||
Traceable: Include operation ID for troubleshooting
|
||||
```
|
||||
|
||||
## Configuration & Customization
|
||||
|
||||
```yaml
|
||||
User Preferences:
|
||||
Recovery Style: Conservative (safe) vs Aggressive (fast)
|
||||
Retry Limits: Maximum attempts for different error types
|
||||
Notification: How and when to alert user of issues
|
||||
Automation Level: How much recovery to attempt automatically
|
||||
|
||||
Project Settings:
|
||||
Critical Operations: Commands that require extra safety
|
||||
Acceptable Risk: Tolerance for failures in development vs production
|
||||
Resource Limits: Maximum time, memory, network usage
|
||||
Dependencies: Critical external services that must be available
|
||||
|
||||
Environment Adaptation:
|
||||
Development: More aggressive retries, helpful error messages
|
||||
Staging: Balanced approach, thorough logging
|
||||
Production: Conservative recovery, immediate alerting
|
||||
CI/CD: Fast failure, detailed diagnostic information
|
||||
```
|
||||
|
||||
---
|
||||
*Error recovery: Resilient command execution with intelligent failure handling*
|
||||
75
.claude/commands/shared/evidence.yml
Normal file
75
.claude/commands/shared/evidence.yml
Normal file
@@ -0,0 +1,75 @@
|
||||
# Evidence & Verification Patterns
|
||||
|
||||
## Measurement Standards
|
||||
|
||||
```yaml
|
||||
Replace Hard Values:
|
||||
Bad: "75% perf improvement"
|
||||
Good: "<measured>% improvement"
|
||||
Best: "<baseline>→<current> (<delta>%)"
|
||||
|
||||
Placeholders:
|
||||
<measured_value>: Actual measurement
|
||||
<calculated_result>: Computed outcome
|
||||
<baseline>: Starting point
|
||||
<current>: Current state
|
||||
<delta>: Change amount
|
||||
<threshold>: Target value
|
||||
```
|
||||
|
||||
## Verification Requirements
|
||||
|
||||
```yaml
|
||||
Perf Claims:
|
||||
Required: Measurement method
|
||||
Format: "Measured via <tool>: <metric>"
|
||||
Example: "Measured via Lighthouse: FCP <value>ms"
|
||||
|
||||
Quality Metrics:
|
||||
Coverage: "Test coverage: <measured>%"
|
||||
Complexity: "Cyclomatic: <calculated>"
|
||||
Duplication: "DRY score: <measured>%"
|
||||
|
||||
Time Estimates:
|
||||
Format: "<min>-<max> <unit> (±<uncertainty>%)"
|
||||
Based on: Historical data|Complexity analysis
|
||||
|
||||
Implementation Sources:
|
||||
Required: Documentation reference for external libraries
|
||||
Format: "Source: <official docs URL or reference>"
|
||||
Placement: Above implementation using pattern
|
||||
|
||||
Examples:
|
||||
Good: "// Source: React docs - useState hook"
|
||||
Bad: "// Common React pattern"
|
||||
|
||||
No Source = Block: External library usage without documentation
|
||||
```
|
||||
|
||||
## Evidence Collection
|
||||
|
||||
```yaml
|
||||
Before: Baseline measurement
|
||||
During: Progress tracking
|
||||
After: Final measurement
|
||||
Delta: Calculate improvement
|
||||
|
||||
Tools:
|
||||
Performance: Lighthouse|DevTools|APM
|
||||
Code: Coverage reports|Linters|Analyzers
|
||||
Time: Git history|Task tracking
|
||||
```
|
||||
|
||||
## Reporting Format
|
||||
|
||||
```yaml
|
||||
Pattern:
|
||||
Claim: What improved
|
||||
Evidence: How measured
|
||||
Result: Specific values
|
||||
|
||||
Example:
|
||||
Claim: "Optimized query performance"
|
||||
Evidence: "EXPLAIN ANALYZE before/after"
|
||||
Result: "<before>ms → <after>ms (<delta>% faster)"
|
||||
```
|
||||
217
.claude/commands/shared/git-operations.yml
Normal file
217
.claude/commands/shared/git-operations.yml
Normal file
@@ -0,0 +1,217 @@
|
||||
# Git Ops Config
|
||||
|
||||
## Command Workflows
|
||||
```yaml
|
||||
Status_Workflow:
|
||||
1. Check working tree: git status --porcelain
|
||||
2. Current branch: git branch --show-current
|
||||
3. Upstream tracking: git rev-parse --abbrev-ref @{u}
|
||||
4. Stash list: git stash list
|
||||
5. Recent commits: git log --oneline -5
|
||||
6. Unpushed commits: git log @{u}..HEAD --oneline
|
||||
7. Remote status: git remote -v && git fetch --dry-run
|
||||
|
||||
Commit_Workflow:
|
||||
Pre_checks:
|
||||
- Working tree status
|
||||
- Branch protection rules
|
||||
- Pre-commit hooks available
|
||||
Staging:
|
||||
- Interactive: git add -p
|
||||
- All tracked: git add -u
|
||||
- Specific: git add <paths>
|
||||
Message:
|
||||
- Check conventions: conventional commits, gitmoji
|
||||
- Generate from changes if not provided
|
||||
- Include issue refs
|
||||
Post_commit:
|
||||
- Run tests if cfg'd
|
||||
- Update checkpoint manifest
|
||||
- Show commit confirmation
|
||||
|
||||
Branch_Workflow:
|
||||
Create:
|
||||
- From current: git checkout -b <name>
|
||||
- From base: git checkout -b <name> <base>
|
||||
- Set upstream: git push -u origin <name>
|
||||
Switch:
|
||||
- Check uncommitted changes
|
||||
- Stash if needed
|
||||
- git checkout <branch>
|
||||
Delete:
|
||||
- Check if merged: git branch --merged
|
||||
- Local: git branch -d <name>
|
||||
- Remote: git push origin --delete <name>
|
||||
Protection:
|
||||
- Never delete: main, master, develop
|
||||
- Warn on: release/*, hotfix/*
|
||||
|
||||
Sync_Workflow:
|
||||
Fetch:
|
||||
- All remotes: git fetch --all --prune
|
||||
- Tags: git fetch --tags
|
||||
Pull:
|
||||
- With rebase: git pull --rebase
|
||||
- Preserve merges: git pull --rebase=preserve
|
||||
- Autostash: git pull --autostash
|
||||
Push:
|
||||
- Current branch: git push
|
||||
- With lease: git push --force-with-lease
|
||||
- Tags: git push --tags
|
||||
Submodules:
|
||||
- Update: git submodule update --init --recursive
|
||||
- Sync: git submodule sync --recursive
|
||||
|
||||
Merge_Workflow:
|
||||
Pre_merge:
|
||||
- Create checkpoint
|
||||
- Fetch target branch
|
||||
- Check for conflicts: git merge --no-commit --no-ff
|
||||
Merge_strategies:
|
||||
- Fast-forward: git merge --ff-only
|
||||
- No fast-forward: git merge --no-ff
|
||||
- Squash: git merge --squash
|
||||
Conflict_resolution:
|
||||
- List conflicts: git diff --name-only --diff-filter=U
|
||||
- Use theirs: git checkout --theirs <file>
|
||||
- Use ours: git checkout --ours <file>
|
||||
- Manual resolution with markers
|
||||
Post_merge:
|
||||
- Verify: git log --graph --oneline
|
||||
- Run tests
|
||||
- Update documentation
|
||||
```
|
||||
|
||||
## Safety Mechanisms
|
||||
```yaml
|
||||
Checkpoints:
|
||||
Auto_create:
|
||||
- Before merge
|
||||
- Before rebase
|
||||
- Before reset --hard
|
||||
- Before force push
|
||||
Format: checkpoint/git-<operation>-<timestamp>
|
||||
|
||||
Confirmations:
|
||||
Required_for:
|
||||
- Force push to remote
|
||||
- Delete unmerged branch
|
||||
- Reset --hard
|
||||
- Rebase published commits
|
||||
- Checkout with uncommitted changes
|
||||
|
||||
Validations:
|
||||
Pre_commit:
|
||||
- No secrets or API keys
|
||||
- No large files (>100MB)
|
||||
- No merge conflict markers
|
||||
- Code passes linting
|
||||
Pre_push:
|
||||
- Tests pass
|
||||
- No WIP commits
|
||||
- Branch naming conventions
|
||||
- Protected branch rules
|
||||
```
|
||||
|
||||
## Conflict Resolution Patterns
|
||||
```yaml
|
||||
Common_Conflicts:
|
||||
Package_files:
|
||||
- package-lock.json: Regenerate after merge
|
||||
- yarn.lock: Run yarn install
|
||||
- Gemfile.lock: Run bundle install
|
||||
|
||||
Generated_files:
|
||||
- Build artifacts: Regenerate
|
||||
- Compiled assets: Recompile
|
||||
- Documentation: Regenerate
|
||||
|
||||
Code_conflicts:
|
||||
- Imports: Combine both sets
|
||||
- Function signatures: Communicate with team
|
||||
- Feature flags: Usually keep both
|
||||
|
||||
Resolution_Strategy:
|
||||
1. Understand both changes
|
||||
2. Communicate with authors
|
||||
3. Test both functionalities
|
||||
4. Document resolution
|
||||
5. Consider refactoring
|
||||
```
|
||||
|
||||
## Branch Patterns
|
||||
```yaml
|
||||
Naming_Conventions:
|
||||
Feature: feature/<ticket>-<description>
|
||||
Bugfix: bugfix/<ticket>-<description>
|
||||
Hotfix: hotfix/<ticket>-<description>
|
||||
Release: release/<version>
|
||||
Experimental: exp/<description>
|
||||
|
||||
Protection_Rules:
|
||||
main/master:
|
||||
- No direct commits
|
||||
- Require PR reviews
|
||||
- Must pass CI/CD
|
||||
- No force push
|
||||
develop:
|
||||
- Require PR for features
|
||||
- Allow hotfix direct merge
|
||||
- Must pass tests
|
||||
release/*:
|
||||
- Only fixes allowed
|
||||
- Version bumps only
|
||||
- Tag on completion
|
||||
```
|
||||
|
||||
## Commit Patterns
|
||||
```yaml
|
||||
Message_Format:
|
||||
Conventional: <type>(<scope>): <subject>
|
||||
Gitmoji: <emoji> <type>: <subject>
|
||||
Simple: <Type>: <Subject>
|
||||
|
||||
Types:
|
||||
feat: New feature
|
||||
fix: Bug fix
|
||||
docs: Documentation
|
||||
style: Code style (no logic change)
|
||||
refactor: Code restructuring
|
||||
test: Test additions/changes
|
||||
chore: Build process/tools
|
||||
perf: Performance improvements
|
||||
ci: CI/CD changes
|
||||
|
||||
Best_Practices:
|
||||
- Atomic commits (one change per commit)
|
||||
- Present tense, imperative mood
|
||||
- Reference issues/tickets
|
||||
- Explain why, not what
|
||||
- Keep subject line < 50 chars
|
||||
- Wrap body at 72 chars
|
||||
```
|
||||
|
||||
## Automation Hooks
|
||||
```yaml
|
||||
Pre_commit:
|
||||
- Lint staged files
|
||||
- Run type checking
|
||||
- Format code
|
||||
- Check for secrets
|
||||
- Validate commit message
|
||||
|
||||
Pre_push:
|
||||
- Run full test suite
|
||||
- Check code coverage
|
||||
- Validate branch name
|
||||
- Check for WIP commits
|
||||
|
||||
Post_merge:
|
||||
- Install new dependencies
|
||||
- Run database migrations
|
||||
- Update documentation
|
||||
- Notify team members
|
||||
```
|
||||
|
||||
---
|
||||
*Git Operations: Comprehensive git workflow management*
|
||||
37
.claude/commands/shared/git-workflow.yml
Normal file
37
.claude/commands/shared/git-workflow.yml
Normal file
@@ -0,0 +1,37 @@
|
||||
# Git Workflow Integration
|
||||
|
||||
## Auto-Check
|
||||
```yaml
|
||||
Before Major Changes:
|
||||
- git status | Check for uncommitted changes
|
||||
- git branch | Verify correct branch
|
||||
- git fetch | Check for remote updates
|
||||
|
||||
Suggest Commits:
|
||||
- After feature completion
|
||||
- Before switching branches
|
||||
- At logical breakpoints
|
||||
|
||||
Conflict Detection:
|
||||
- Scan for merge conflict markers
|
||||
- Offer resolution patterns
|
||||
- Guide through conflict resolution
|
||||
```
|
||||
|
||||
## Workflow Patterns
|
||||
```yaml
|
||||
Feature Work:
|
||||
New feature→Suggest feature branch
|
||||
Multiple changes→Suggest incremental commits
|
||||
Experimental→Suggest separate branch
|
||||
|
||||
Clean State:
|
||||
Uncommitted changes→"Commit first?" or "Stash?"
|
||||
Wrong branch→"Switch→feature branch?"
|
||||
Conflicts → "Resolve conflicts first"
|
||||
|
||||
Branch Awareness:
|
||||
main/master → Warn about direct changes
|
||||
feature/* → Encourage commits
|
||||
hotfix/* → Emphasize testing
|
||||
```
|
||||
199
.claude/commands/shared/implementation.yml
Normal file
199
.claude/commands/shared/implementation.yml
Normal file
@@ -0,0 +1,199 @@
|
||||
# Impl Hooks
|
||||
|
||||
## How Claude Code Uses These Patterns
|
||||
|
||||
```yaml
|
||||
Pattern Loading:
|
||||
On Start: Load CLAUDE.md→RULES.md (core behavioral rules)
|
||||
On /persona:: Check if PERSONAS.md loaded→Load if needed→Cache session
|
||||
On MCP ref: Check if MCP.md loaded→Load if needed→Cache session
|
||||
Commands: Parse .claude/commands/*.md on /user: trigger→Cache recent 5
|
||||
Shared: Include shared/*.yml when referenced by active commands
|
||||
|
||||
Severity Enforcement:
|
||||
CRITICAL[10]: Block op & explain why
|
||||
HIGH[7-9]: Warn user & require confirmation
|
||||
MEDIUM[4-6]: Suggest improvement & continue
|
||||
LOW[1-3]: Note in output & proceed
|
||||
|
||||
Auto-Triggers:
|
||||
File Open: Check extension→Load PERSONAS.md if needed→Activate persona
|
||||
Command Start: Load command def→Check ambiguity→Clarify if needed
|
||||
MCP Usage: Load MCP.md if needed→Select appropriate tool
|
||||
Risky Op: Create checkpoint→Log audit→Validate
|
||||
Error: Activate analyzer→Debug workflow
|
||||
```
|
||||
|
||||
## Pattern Integration
|
||||
|
||||
```yaml
|
||||
Todo Management:
|
||||
3+ steps → TodoWrite() with tasks
|
||||
Status → Update immediately on change
|
||||
Complete → Mark done & suggest next
|
||||
|
||||
MCP Selection:
|
||||
Parse request → Check complexity → Select tool
|
||||
Simple → Use native | Complex → Use MCP
|
||||
Monitor tokens → Switch/abort if exceeded
|
||||
|
||||
Context Management:
|
||||
Track % → Warn at 60% → Force compact at 90%
|
||||
Task complete → Auto-compact context
|
||||
Project switch → Clear context
|
||||
```
|
||||
|
||||
## Command Execution
|
||||
|
||||
```yaml
|
||||
Pre-Execution:
|
||||
1. Parse command & args
|
||||
2. Check thinking mode flags:
|
||||
- --think: Activate standard thinking mode (4K tokens)
|
||||
- --think-hard: Activate deep analysis mode (10K tokens)
|
||||
- --ultrathink: Activate critical analysis mode (32K tokens)
|
||||
- Default: Basic mode if no thinking flag present
|
||||
3. Check MCP control flags:
|
||||
- --c7/--no-c7: Control Context7 documentation server
|
||||
- --seq/--no-seq: Control Sequential thinking server
|
||||
- --magic/--no-magic: Control Magic UI builder
|
||||
- --pup/--no-pup: Control Puppeteer browser automation
|
||||
- --all-mcp: Enable all MCP servers
|
||||
- --no-mcp: Disable all MCP servers
|
||||
4. Check risk level (shared/planning-mode.yml)
|
||||
5. If --plan flag → Show plan → await approval
|
||||
6. Check ambiguity (shared/ambiguity-check.yml)
|
||||
7. Research verification (shared/research-first.yml):
|
||||
- External library detected → C7 resolve + get-docs REQUIRED
|
||||
- New UI component needed → Magic search or WebSearch patterns
|
||||
- API integration found → Official docs lookup REQUIRED
|
||||
- Unknown pattern detected → Sequential analysis + research
|
||||
- Block if: No research performed for external dependencies
|
||||
- Cache: Store researched patterns for session reuse
|
||||
8. Preemptive validation:
|
||||
- Dependencies: package.json vs node_modules | Required tools installed
|
||||
- Permissions: File write access | Command availability
|
||||
- State: Clean git status for risky ops | No conflicting processes
|
||||
- Environment: Correct versions | Required env vars set
|
||||
9. Validate permissions (shared/validation.yml)
|
||||
10. Create checkpoint if risky
|
||||
11. Log start (shared/audit.yml)
|
||||
12. Documentation directory check (shared/documentation-dirs.yml):
|
||||
- Report generation? → Ensure .claudedocs/[subdirs] exist
|
||||
- Project docs? → Ensure /docs/[category] exists
|
||||
- Create directories if missing with proper permissions (755)
|
||||
- Validate write permissions to target directories
|
||||
13. UltraCompressed check (shared/ultracompressed.yml):
|
||||
- --uc flag? → Apply compression rules to all output
|
||||
- Context >70%? → Suggest --uc mode
|
||||
- Token budget? → Auto-enable compression
|
||||
- Generate legend at start of compressed docs
|
||||
|
||||
During:
|
||||
- Update todo status
|
||||
- Show progress indicators
|
||||
- Handle errors gracefully
|
||||
- Keep user informed
|
||||
|
||||
Post-Execution:
|
||||
- Log completion/failure
|
||||
- Update todos
|
||||
- If report generated → Note location in output: "📄 Report saved to: [path]"
|
||||
- If docs created → Update /docs/index.md with new entries
|
||||
- Suggest next steps
|
||||
- Compact context if needed
|
||||
```
|
||||
|
||||
## Persona Activation
|
||||
|
||||
```yaml
|
||||
File-Based:
|
||||
*.tsx opened → frontend persona active
|
||||
*.sql opened → data persona active
|
||||
Dockerfile → devops persona active
|
||||
|
||||
Keyword-Based:
|
||||
"optimize" in request → performance persona
|
||||
"secure" mentioned → security persona
|
||||
"refactor" → refactorer persona
|
||||
|
||||
Context-Based:
|
||||
Error trace → analyzer persona
|
||||
Architecture question → architect persona
|
||||
Learning request → mentor persona
|
||||
|
||||
Multi-Persona:
|
||||
Complex task → Sequential activation
|
||||
Parallel work → Concurrent personas
|
||||
Handoff → Share context between
|
||||
```
|
||||
|
||||
## Error Handling
|
||||
|
||||
```yaml
|
||||
Pattern Detection:
|
||||
Match error → Error type in patterns.yml
|
||||
Syntax → Check syntax highlighting
|
||||
Runtime → Validate inputs & types
|
||||
Logic → Trace execution flow
|
||||
|
||||
Recovery:
|
||||
Try operation → Catch error → Check pattern
|
||||
Known → Apply fix pattern
|
||||
Unknown → Activate analyzer → Debug
|
||||
Can't fix → Explain & suggest manual fix
|
||||
```
|
||||
|
||||
## Token Optimization
|
||||
|
||||
```yaml
|
||||
Real-Time:
|
||||
Count tokens → Apply reduction patterns
|
||||
Remove listed words → Use symbols
|
||||
YAML format → Compress output
|
||||
Reference > repeat → Link to existing
|
||||
|
||||
Batch Operations:
|
||||
Group similar → Single operation
|
||||
Parallel when possible → Reduce time
|
||||
Cache results → Avoid re-computation
|
||||
```
|
||||
|
||||
## Unified Behaviors
|
||||
|
||||
```yaml
|
||||
Error Format:
|
||||
All commands: [COMMAND] Error: What→Why→Fix
|
||||
Example: [BUILD] Error: Module X failed→Missing dep Y→Run npm install Y
|
||||
|
||||
Result Format:
|
||||
Success: ✓ Action (Xms) | Details
|
||||
Warning: ⚠ Issue | Impact | Suggestion
|
||||
Failure: ✗ Error | Reason | Recovery
|
||||
|
||||
Command Memory:
|
||||
Store: After each command → .claude/session/[command].cache
|
||||
Reuse: Check cache → Use if valid → Note "using prior analysis"
|
||||
Clear: On file change → Invalidate related caches
|
||||
|
||||
## Loading Optimization
|
||||
```yaml
|
||||
Component Loading:
|
||||
Core: CLAUDE.md + RULES.md loaded on startup (~3500 tokens)
|
||||
Personas: Load on /persona: trigger → Cache for session
|
||||
MCP: Load on MCP tool reference → Cache for session
|
||||
Commands: Load on /user: trigger → Cache recent 5
|
||||
|
||||
Token Savings:
|
||||
Simple tasks: 43% reduction (6100→3500 tokens)
|
||||
With personas: 33% reduction (6100→4100 tokens)
|
||||
With commands: 20-30% reduction (varies by usage)
|
||||
|
||||
Cache Strategy:
|
||||
Session-based: Keep loaded components until session ends
|
||||
LRU: Evict least recently used when memory limits reached
|
||||
Preload: Common patterns loaded proactively
|
||||
```
|
||||
|
||||
---
|
||||
*Implementation: How patterns become actions*
|
||||
73
.claude/commands/shared/loading-config.yml
Normal file
73
.claude/commands/shared/loading-config.yml
Normal file
@@ -0,0 +1,73 @@
|
||||
# Loading Config for Token Optimization & Perf
|
||||
|
||||
## Core Config (Always Load)
|
||||
```yaml
|
||||
Core:
|
||||
Always: [CLAUDE.md, RULES.md, PERSONAS.md, MCP.md]
|
||||
Priority: Critical behavioral rules, personas & MCP patterns
|
||||
Size: ~4600 tokens
|
||||
Reason: Essential for all Claude Code behavior, personas globally available
|
||||
|
||||
Global Availability:
|
||||
PERSONAS.md: All 9 cognitive archetypes available via /persona:
|
||||
MCP.md: All MCP patterns available automatically
|
||||
|
||||
Commands:
|
||||
Trigger: /user:
|
||||
Path: .claude/commands/
|
||||
Size: ~50 tokens per command
|
||||
Cache: Most recent 5 commands
|
||||
Index: command names & risk levels only
|
||||
|
||||
SharedResources:
|
||||
LoadWith: Associated commands
|
||||
Path: .claude/commands/shared/
|
||||
Size: ~150 tokens per YAML
|
||||
Examples:
|
||||
- cleanup-patterns.yml→loads w/ /user:cleanup
|
||||
- git-workflow.yml→loads w/ git ops
|
||||
- planning-mode.yml→loads w/ risky commands
|
||||
```
|
||||
|
||||
## Advanced Loading Optimization
|
||||
```yaml
|
||||
Smart Loading Strategies:
|
||||
Predictive: Anticipate likely-needed resources based on command patterns
|
||||
Contextual: Load resources based on project type and user behavior
|
||||
Lazy: Defer loading non-critical resources until explicitly needed
|
||||
Incremental: Load minimal first, expand as complexity increases
|
||||
|
||||
Intelligent Caching:
|
||||
Command Frequency: Cache most-used commands permanently
|
||||
Workflow Patterns: Preload resources for common command sequences
|
||||
User Preferences: Remember and preload user's preferred tools
|
||||
Session Context: Keep relevant context across related operations
|
||||
|
||||
Token Efficiency:
|
||||
Base load: 4600 tokens (CLAUDE.md + RULES.md + PERSONAS.md + MCP.md)
|
||||
Optimized commands: 4650-4700 tokens (~50 tokens per command)
|
||||
Smart shared resources: Load only when needed, avg 150-300 tokens
|
||||
Performance gain: ~20-30% reduction through intelligent loading
|
||||
Trade-off: Higher base load for consistent global functionality
|
||||
|
||||
Context Compression:
|
||||
Auto UltraCompressed: Enable when context approaches limits
|
||||
Selective Detail: Keep summaries, load detail on demand
|
||||
Result Caching: Store and reuse expensive analysis results
|
||||
Pattern Recognition: Learn and optimize based on usage patterns
|
||||
```
|
||||
|
||||
## Performance Monitoring Integration
|
||||
```yaml
|
||||
Loading Metrics:
|
||||
Time to Load: Track component loading speed
|
||||
Cache Hit Rate: Measure effectiveness of caching strategies
|
||||
Memory Usage: Monitor total context size and optimization opportunities
|
||||
User Satisfaction: Track command completion success rates
|
||||
|
||||
Adaptive Optimization:
|
||||
Slow Loading: Automatically switch to lighter alternatives
|
||||
High Memory: Trigger context compression and cleanup
|
||||
Cache Misses: Adjust caching strategy based on usage patterns
|
||||
Performance Degradation: Fall back to minimal loading mode
|
||||
```
|
||||
109
.claude/commands/shared/mcp-flags.yml
Normal file
109
.claude/commands/shared/mcp-flags.yml
Normal file
@@ -0,0 +1,109 @@
|
||||
# MCP Server Flag Config
|
||||
|
||||
## MCP Control Flags
|
||||
```yaml
|
||||
Command_Flags:
|
||||
# Context7 Docs Server
|
||||
--c7: "Enable Context7→lib docs lookup"
|
||||
--no-c7: "Disable Context7 (native tools only)"
|
||||
|
||||
# Sequential Thinking Server
|
||||
--seq: "Enable Sequential thinking→complex analysis"
|
||||
--no-seq: "Disable Sequential thinking"
|
||||
|
||||
# Magic UI Builder Server
|
||||
--magic: "Enable Magic UI component generation"
|
||||
--no-magic: "Disable Magic UI builder"
|
||||
|
||||
# Puppeteer Browser Control Server
|
||||
--pup: "Enable Puppeteer→browser testing"
|
||||
--no-pup: "Disable Puppeteer"
|
||||
|
||||
# Combined Controls
|
||||
--all-mcp: "Enable all MCP servers"
|
||||
--no-mcp: "Disable all MCP servers (native tools only)"
|
||||
|
||||
Usage_Examples:
|
||||
- /user:analyze --code --c7 # Use Context7 for library docs
|
||||
- /user:design --api --seq # Use Sequential for architecture
|
||||
- /user:build --react --magic # Use Magic for UI components
|
||||
- /user:test --e2e --pup # Use Puppeteer for browser tests
|
||||
- /user:troubleshoot --no-mcp # Native tools only for debugging
|
||||
```
|
||||
|
||||
## MCP Server Capabilities
|
||||
```yaml
|
||||
Context7 (--c7):
|
||||
Purpose: Library documentation and code examples
|
||||
Best_for: API usage, framework patterns, library integration
|
||||
Token_cost: Low-Medium (100-2000 tokens)
|
||||
|
||||
Sequential (--seq):
|
||||
Purpose: Step-by-step complex problem solving
|
||||
Best_for: Architecture, debugging, system design
|
||||
Token_cost: Medium-High (500-10000 tokens)
|
||||
|
||||
Magic (--magic):
|
||||
Purpose: UI component generation with 21st.dev
|
||||
Best_for: React/Vue components, UI patterns
|
||||
Token_cost: Medium (500-2000 tokens)
|
||||
|
||||
Puppeteer (--pup):
|
||||
Purpose: Browser automation and testing
|
||||
Best_for: E2E tests, screenshots, web scraping
|
||||
Token_cost: Low (minimal tokens)
|
||||
```
|
||||
|
||||
## Smart Defaults & Recommendations
|
||||
```yaml
|
||||
Command_Defaults:
|
||||
# Commands that benefit from specific MCP servers
|
||||
analyze + --architecture: Suggest --seq for system analysis
|
||||
build + --react: Suggest --magic for UI components
|
||||
test + --e2e: Suggest --pup for browser testing
|
||||
explain + library_name: Suggest --c7 for documentation
|
||||
design + --api: Suggest --seq --c7 for comprehensive design
|
||||
troubleshoot + --investigate: Suggest --seq for root cause analysis
|
||||
improve + --performance: Suggest --seq --pup for optimization analysis
|
||||
|
||||
Intelligent Combinations:
|
||||
--magic + --pup: Generate UI components and test them immediately
|
||||
--seq + --c7: Complex analysis with authoritative documentation
|
||||
--seq + --think-hard: Deep architectural analysis with documentation
|
||||
--c7 + --uc: Research with compressed output for token efficiency
|
||||
|
||||
Conflict_Resolution:
|
||||
--no-mcp overrides: All individual MCP flags
|
||||
Explicit beats implicit: --no-c7 overrides auto-activation
|
||||
Cost awareness: Warn if multiple high-cost MCPs selected
|
||||
Token budget: Auto-suggest --uc when approaching limits
|
||||
```
|
||||
|
||||
## Integration with Other Flags
|
||||
```yaml
|
||||
Synergies:
|
||||
--think + --seq: Enhanced analysis with Sequential thinking
|
||||
--ultrathink + --all-mcp: Maximum capability for critical tasks
|
||||
--plan + --seq: Better planning with Sequential analysis
|
||||
--magic + --pup: Generate and test UI components
|
||||
|
||||
Anti-patterns:
|
||||
--no-mcp + --c7: Conflicting flags (no-mcp wins)
|
||||
Multiple costly: --seq --ultrathink (warn about token usage)
|
||||
```
|
||||
|
||||
## Auto-Activation Override
|
||||
```yaml
|
||||
Flag_Priority:
|
||||
1. Explicit flags (--c7, --no-c7) → Highest priority
|
||||
2. Command defaults → Medium priority
|
||||
3. Context triggers → Lowest priority
|
||||
|
||||
Examples:
|
||||
"React hooks" + --no-c7 → Skip Context7 despite keyword
|
||||
/user:build --react --no-magic → Skip Magic UI despite React
|
||||
/user:analyze --no-mcp → Pure native tools analysis
|
||||
```
|
||||
|
||||
---
|
||||
*MCP Flags: Explicit control over Model Context Protocol servers*
|
||||
155
.claude/commands/shared/patterns.yml
Normal file
155
.claude/commands/shared/patterns.yml
Normal file
@@ -0,0 +1,155 @@
|
||||
# Shared Patterns & Deliverables
|
||||
|
||||
## Core Workflows
|
||||
```yaml
|
||||
Dev:
|
||||
Full Stack: load→analyze→design→build→test→scan→deploy
|
||||
Feature: analyze→build→test→improve→commit
|
||||
Bug Fix: troubleshoot→fix→test→verify→commit
|
||||
|
||||
Quality:
|
||||
Code Review: analyze→improve→scan→test
|
||||
Perf: analyze→improve→test→measure
|
||||
Security: scan→improve→validate→test
|
||||
|
||||
Maintenance:
|
||||
Cleanup: cleanup→analyze→improve→test
|
||||
Update: migrate→test→validate→deploy
|
||||
Refactor: analyze→design→improve→test
|
||||
```
|
||||
|
||||
## Universal Flags
|
||||
```yaml
|
||||
Planning: --plan (show execution plan first)
|
||||
Thinking: --think (4K) | --think-hard (10K) | --ultrathink (32K)
|
||||
Docs: --uc (ultracompressed 70% reduction)
|
||||
MCP: --c7 --seq --magic --pup | --all-mcp | --no-mcp
|
||||
Execution: --dry-run | --watch | --interactive
|
||||
Quality: --tdd | --iterate | --threshold N%
|
||||
```
|
||||
|
||||
## Error Types
|
||||
```yaml
|
||||
Syntax: Typos|brackets|quotes → Check syntax
|
||||
Runtime: Null|undefined|types → Validate inputs
|
||||
Logic: Conditions|loops|state → Trace flow
|
||||
Performance: N+1|memory|blocking → Profile
|
||||
Integration: API|auth|format → Check contracts
|
||||
```
|
||||
|
||||
## MCP Usage
|
||||
```yaml
|
||||
Sequential: Complex analysis|Architecture|Debug
|
||||
Context7: Docs|Examples|Patterns
|
||||
Magic: UI components|Prototypes
|
||||
Puppeteer: E2E|Visual|Performance
|
||||
```
|
||||
|
||||
## Research Patterns
|
||||
```yaml
|
||||
Library Usage: Detect import→C7 lookup→Cache pattern→Implement with citation
|
||||
Component Creation: Identify need→Search existing→Magic builder→Document source
|
||||
API Integration: Find docs→Check auth→Review limits→Implement→Note constraints
|
||||
Unknown Pattern: Sequential thinking→WebSearch→Multiple sources→Choose best
|
||||
|
||||
Research Cache:
|
||||
Session-based: Keep patterns until session end
|
||||
Cite previous: "Using researched pattern from earlier"
|
||||
Invalidate: On version change or conflicting info
|
||||
```
|
||||
|
||||
## Deliverables
|
||||
|
||||
### Code
|
||||
```yaml
|
||||
Commits: type: description | feat|fix|refactor|perf|test|docs | Why>What
|
||||
Docs: API(endpoints|params|examples) | Code(JSDoc|README) | User(guides|FAQs)
|
||||
Tests: Unit(functions|logic) | Integration(APIs|services) | E2E(flows|paths)
|
||||
```
|
||||
|
||||
### Reports
|
||||
```yaml
|
||||
Performance: Baseline→Current→Improvement% | Time|memory|CPU|network
|
||||
Security: Vulnerabilities→Risk→Fixes | OWASP|deps|auth|data
|
||||
Quality: Coverage|complexity|duplication → Issues→Severity→Resolution
|
||||
```
|
||||
|
||||
### Artifacts
|
||||
```yaml
|
||||
Configs: .env|settings|deployment | Scripts: build|test|deploy|migrate
|
||||
Schemas: Database|API|validation | Assets: Images|styles|components
|
||||
```
|
||||
|
||||
## Accelerated Workflows
|
||||
```yaml
|
||||
Fast Chains:
|
||||
Fix Known: /user:improve --quality [uses prior analyze]
|
||||
Quick Deploy: /user:deploy [uses prior test+scan]
|
||||
Smart Build: /user:build [skips unchanged modules]
|
||||
|
||||
Auto Skip:
|
||||
Unchanged files → Skip re-analysis
|
||||
Passed tests → Skip re-test
|
||||
Clean scan → Skip re-scan
|
||||
```
|
||||
|
||||
## Clean Workflows
|
||||
```yaml
|
||||
Pre-Operations: cleanup→build→test→deploy
|
||||
Maintenance: analyze→cleanup→improve→test
|
||||
Development: cleanup→code→commit→push
|
||||
Release: cleanup→build→test→scan→deploy
|
||||
|
||||
Clean-First Patterns:
|
||||
Build: Remove old artifacts → Clean cache → Fresh build
|
||||
Deploy: Clean previous version → Validate config → Deploy new
|
||||
Test: Clean test outputs → Reset state → Run tests
|
||||
Develop: Clean workspace → Remove debug code → Commit clean
|
||||
```
|
||||
|
||||
## Command Integration Patterns
|
||||
```yaml
|
||||
Sequential Chains:
|
||||
Full Development: load → analyze → design → build → test → deploy
|
||||
Bug Investigation: troubleshoot --investigate → troubleshoot --fix → test
|
||||
Quality Pipeline: analyze → improve --quality → scan --validate → test
|
||||
|
||||
Parallel Operations:
|
||||
Multi-Stack: build --react & build --api & test --e2e
|
||||
Quality Gates: scan --security & test --coverage & analyze --performance
|
||||
|
||||
Conditional Flows:
|
||||
Safe Deploy: scan --validate && test --e2e && deploy --env prod
|
||||
Rollback: deploy --rollback || troubleshoot --investigate
|
||||
|
||||
Context Sharing:
|
||||
Analysis → Implementation: analyze → build (uses analysis context)
|
||||
Design → Development: design → build (uses design patterns)
|
||||
Investigation → Fix: troubleshoot --investigate → improve (uses findings)
|
||||
```
|
||||
|
||||
## UltraCompressed Patterns
|
||||
```yaml
|
||||
Activation Patterns:
|
||||
Manual: --uc flag | "ultracompressed" keyword
|
||||
Auto: Context >70% | Token budget specified
|
||||
Smart: Large docs → Suggest compression
|
||||
|
||||
Documentation Patterns:
|
||||
Start: Legend table | Only used symbols/abbrevs
|
||||
Structure: Lists>prose | Tables>paragraphs | YAML>text
|
||||
Content: Direct info | No fluff | Telegram-style
|
||||
|
||||
Example Transformations:
|
||||
Normal: "Configure the authentication system by setting environment variables"
|
||||
Compressed: "Auth cfg: set env vars"
|
||||
|
||||
Normal: "This function processes user input and returns validation result"
|
||||
Compressed: "fn: process usr input→validation"
|
||||
|
||||
Token Savings:
|
||||
Headers: 60-80% reduction
|
||||
Paragraphs: 70-75% reduction
|
||||
Lists: 50-60% reduction
|
||||
Overall: ~70% average reduction
|
||||
```
|
||||
86
.claude/commands/shared/performance-monitoring.yml
Normal file
86
.claude/commands/shared/performance-monitoring.yml
Normal file
@@ -0,0 +1,86 @@
|
||||
# Perf Self-Monitoring & Optimization
|
||||
|
||||
## Tracking Metrics
|
||||
```yaml
|
||||
Op Duration: Track time per command | Average vs current | Trend analysis
|
||||
Token Consumption: Monitor usage per op | Compare→baselines | Efficiency ratios
|
||||
Success Rates: Command completion % | Error frequency | Retry patterns
|
||||
User Satisfaction: Interruption frequency | Correction patterns | Positive signals
|
||||
```
|
||||
|
||||
## Perf Thresholds
|
||||
```yaml
|
||||
Time Limits:
|
||||
>30s ops→Consider alternatives | Switch→faster method
|
||||
>60s→Force timeout | Explain delay | Offer cancellation
|
||||
|
||||
Token Limits:
|
||||
>2K tokens single op→Simplify approach | Break→smaller parts
|
||||
>5K session→Suggest /compact | Warn about context size
|
||||
|
||||
Error Patterns:
|
||||
3+ retries same op→Switch strategy | Try different tool
|
||||
Repeated failures→Escalate→manual approach | Ask→guidance
|
||||
```
|
||||
|
||||
## Adaptive Strategies
|
||||
```yaml
|
||||
When Slow:
|
||||
File operations → Use faster tools (rg vs grep)
|
||||
Large codebases → Focus on specific areas
|
||||
Complex analysis → Progressive refinement
|
||||
|
||||
When High Token Usage:
|
||||
Verbose output → Switch to concise mode
|
||||
Repeated content → Use references instead
|
||||
Large responses → Summarize key points
|
||||
|
||||
When Errors Occur:
|
||||
Tool failures → Try alternative tools
|
||||
Permission issues → Suggest fixes
|
||||
Missing dependencies → Guide installation
|
||||
```
|
||||
|
||||
## Advanced Performance Optimization
|
||||
|
||||
```yaml
|
||||
Token Usage Optimization:
|
||||
Smart Context: Keep only essential information between commands
|
||||
Compression: Auto-enable --uc mode when context >70%
|
||||
Caching: Store and reuse expensive analysis results
|
||||
Selective MCP: Use most efficient MCP tool for each task
|
||||
|
||||
Command Optimization:
|
||||
Parallel Execution: Run independent operations concurrently
|
||||
Early Returns: Complete when objectives achieved
|
||||
Progressive Refinement: Start broad, narrow focus as needed
|
||||
Smart Defaults: Reduce configuration overhead
|
||||
|
||||
Workflow Acceleration:
|
||||
Pattern Recognition: Learn from successful command sequences
|
||||
Predictive Context: Preload likely-needed resources
|
||||
Skip Redundant: Avoid re-analysis of unchanged files
|
||||
Chain Optimization: Optimize common workflow patterns
|
||||
```
|
||||
|
||||
## Performance Reporting
|
||||
```yaml
|
||||
Real-Time Feedback:
|
||||
Transparency: "Operation taking longer than expected, switching to faster method"
|
||||
Updates: "Optimizing approach to reduce token usage"
|
||||
Alternatives: "Primary method failed, trying backup approach"
|
||||
Success: "Completed efficiently using optimized strategy"
|
||||
|
||||
Metrics Collection:
|
||||
Location: .claudedocs/metrics/performance-<date>.md
|
||||
Frequency: Daily aggregation + real-time monitoring
|
||||
Content: Operation times | Token usage | Success rates | Error patterns | Optimization wins
|
||||
Format: Markdown with tables and charts
|
||||
Auto-create: mkdir -p .claudedocs/metrics/
|
||||
|
||||
Performance Insights:
|
||||
Bottleneck Identification: Which operations consume most resources
|
||||
Efficiency Trends: Performance improvement over time
|
||||
User Patterns: Most effective workflows and flag combinations
|
||||
Optimization Recommendations: Specific suggestions for improvement
|
||||
```
|
||||
223
.claude/commands/shared/performance-tracker.yml
Normal file
223
.claude/commands/shared/performance-tracker.yml
Normal file
@@ -0,0 +1,223 @@
|
||||
# Performance Tracking System
|
||||
|
||||
## Legend
|
||||
| Symbol | Meaning | | Abbrev | Meaning |
|
||||
|--------|---------|---|--------|---------|
|
||||
| ⚡ | fast/optimized | | perf | performance |
|
||||
| 📊 | metrics/data | | exec | execution |
|
||||
| ⏱ | timing/duration | | tok | token |
|
||||
| 🔄 | continuous | | opt | optimization |
|
||||
|
||||
## Metrics Collection
|
||||
|
||||
```yaml
|
||||
Command_Performance:
|
||||
Timing_Metrics:
|
||||
Start_Time: "Record command initiation timestamp"
|
||||
End_Time: "Record command completion timestamp"
|
||||
Duration: "end_time - start_time"
|
||||
Phases: "breakdown by major operations"
|
||||
|
||||
Token_Metrics:
|
||||
Input_Tokens: "Tokens in user command + context"
|
||||
Output_Tokens: "Tokens in response + tool calls"
|
||||
MCP_Tokens: "Tokens consumed by MCP servers"
|
||||
Efficiency_Ratio: "output_value / total_tokens"
|
||||
|
||||
Operation_Metrics:
|
||||
Tools_Used: "List of tools called (Read, Edit, Bash, etc)"
|
||||
Files_Accessed: "Number of files read/written"
|
||||
MCP_Calls: "Which MCP servers used + frequency"
|
||||
Error_Count: "Number of errors encountered"
|
||||
|
||||
Success_Metrics:
|
||||
Completion_Status: "success|partial|failure"
|
||||
User_Satisfaction: "interruptions, corrections, positive signals"
|
||||
Retry_Count: "Number of retry attempts needed"
|
||||
Quality_Score: "estimated output quality (1-10)"
|
||||
```
|
||||
|
||||
## Performance Baselines
|
||||
|
||||
```yaml
|
||||
Command_Benchmarks:
|
||||
Simple_Commands:
|
||||
analyze_file: "<5s, <500 tokens"
|
||||
read_file: "<2s, <200 tokens"
|
||||
edit_file: "<3s, <300 tokens"
|
||||
|
||||
Medium_Commands:
|
||||
build_component: "<30s, <2000 tokens"
|
||||
test_execution: "<45s, <1500 tokens"
|
||||
security_scan: "<60s, <3000 tokens"
|
||||
|
||||
Complex_Commands:
|
||||
full_analysis: "<120s, <5000 tokens"
|
||||
architecture_design: "<180s, <8000 tokens"
|
||||
comprehensive_scan: "<300s, <10000 tokens"
|
||||
|
||||
MCP_Server_Performance:
|
||||
Context7: "<5s response, 100-2000 tokens typical"
|
||||
Sequential: "<30s analysis, 500-10000 tokens typical"
|
||||
Magic: "<10s generation, 500-2000 tokens typical"
|
||||
Puppeteer: "<15s operation, minimal tokens"
|
||||
```
|
||||
|
||||
## Adaptive Optimization
|
||||
|
||||
```yaml
|
||||
Real_Time_Optimization:
|
||||
Slow_Operations:
|
||||
Threshold: ">30s execution time"
|
||||
Actions:
|
||||
- Switch to faster tools (rg vs grep)
|
||||
- Reduce scope (specific files vs full scan)
|
||||
- Enable parallel processing
|
||||
- Suggest --uc mode for token efficiency
|
||||
|
||||
High_Token_Usage:
|
||||
Threshold: ">70% context or >5K tokens"
|
||||
Actions:
|
||||
- Auto-suggest UltraCompressed mode
|
||||
- Cache repeated content
|
||||
- Use cross-references vs repetition
|
||||
- Summarize large outputs
|
||||
|
||||
Error_Patterns:
|
||||
Repeated_Failures:
|
||||
Threshold: "3+ failures same operation"
|
||||
Actions:
|
||||
- Switch to alternative tool
|
||||
- Adjust approach/strategy
|
||||
- Request user guidance
|
||||
- Document known issue
|
||||
|
||||
Success_Pattern_Learning:
|
||||
Track_Effective_Combinations:
|
||||
- Which persona + command + flags work best
|
||||
- Which MCP combinations are most efficient
|
||||
- Which file patterns lead to success
|
||||
- User preference patterns over time
|
||||
```
|
||||
|
||||
## Monitoring Implementation
|
||||
|
||||
```yaml
|
||||
Data_Collection:
|
||||
Lightweight_Tracking:
|
||||
- Minimal overhead (<1% performance impact)
|
||||
- Background collection (no user interruption)
|
||||
- Local storage only (privacy-preserving)
|
||||
- Configurable (can be disabled)
|
||||
|
||||
Storage_Format:
|
||||
Location: ".claudedocs/metrics/performance-YYYY-MM-DD.jsonl"
|
||||
Format: "JSON Lines (one record per command)"
|
||||
Retention: "30 days rolling, aggregated monthly"
|
||||
Size_Limit: "10MB max per day"
|
||||
|
||||
Data_Structure:
|
||||
timestamp: "ISO 8601 format"
|
||||
command: "Full command w/ flags"
|
||||
persona: "Active persona (if any)"
|
||||
duration_ms: "Execution time in milliseconds"
|
||||
tokens_input: "Input token count"
|
||||
tokens_output: "Output token count"
|
||||
tools_used: "Array of tool names"
|
||||
mcp_servers: "Array of MCP servers used"
|
||||
success: "boolean completion status"
|
||||
error_count: "Number of errors encountered"
|
||||
user_corrections: "Number of user interruptions/corrections"
|
||||
```
|
||||
|
||||
## Reporting & Analysis
|
||||
|
||||
```yaml
|
||||
Performance_Reports:
|
||||
Daily_Summary:
|
||||
Location: ".claudedocs/metrics/daily-summary-YYYY-MM-DD.md"
|
||||
Content:
|
||||
- Command execution statistics
|
||||
- Token efficiency metrics
|
||||
- Error frequency analysis
|
||||
- Optimization recommendations
|
||||
|
||||
Weekly_Trends:
|
||||
Location: ".claudedocs/metrics/weekly-trends-YYYY-WW.md"
|
||||
Content:
|
||||
- Performance trend analysis
|
||||
- Usage pattern identification
|
||||
- Efficiency improvements over time
|
||||
- Bottleneck identification
|
||||
|
||||
Optimization_Insights:
|
||||
Identify_Patterns:
|
||||
- Most efficient command combinations
|
||||
- Highest impact optimizations
|
||||
- User workflow improvements
|
||||
- System resource utilization
|
||||
|
||||
Alerts:
|
||||
Performance_Degradation: "If avg response time >2x baseline"
|
||||
High_Error_Rate: "If error rate >10% over 24h"
|
||||
Token_Inefficiency: "If efficiency ratio drops >50%"
|
||||
```
|
||||
|
||||
## Integration Points
|
||||
|
||||
```yaml
|
||||
Command_Wrapper:
|
||||
Pre_Execution:
|
||||
- Record start timestamp
|
||||
- Capture input context size
|
||||
- Note active persona & flags
|
||||
|
||||
During_Execution:
|
||||
- Track tool usage
|
||||
- Monitor MCP server calls
|
||||
- Count errors & retries
|
||||
|
||||
Post_Execution:
|
||||
- Record completion time
|
||||
- Calculate token usage
|
||||
- Assess success metrics
|
||||
- Store performance record
|
||||
|
||||
Auto_Optimization:
|
||||
Context_Size_Management:
|
||||
- Suggest /compact when context >70%
|
||||
- Auto-enable --uc for large responses
|
||||
- Cache expensive operations
|
||||
|
||||
Tool_Selection:
|
||||
- Prefer faster tools for routine operations
|
||||
- Use parallel execution when possible
|
||||
- Skip redundant operations
|
||||
|
||||
User_Experience:
|
||||
- Proactive performance feedback
|
||||
- Optimization suggestions
|
||||
- Alternative approach recommendations
|
||||
```
|
||||
|
||||
## Usage Examples
|
||||
|
||||
```yaml
|
||||
Basic_Monitoring:
|
||||
Automatic: "Built into all SuperClaude commands"
|
||||
Manual_Report: "/user:analyze --performance"
|
||||
Custom_Query: "Show metrics for last 7 days"
|
||||
|
||||
Performance_Tuning:
|
||||
Identify_Bottlenecks: "Which commands are consistently slow?"
|
||||
Token_Optimization: "Which operations use most tokens?"
|
||||
Success_Patterns: "What combinations work best?"
|
||||
|
||||
Continuous_Improvement:
|
||||
Weekly_Review: "Automated performance trend analysis"
|
||||
Optimization_Alerts: "Proactive performance degradation warnings"
|
||||
Usage_Insights: "Learn user patterns for better defaults"
|
||||
```
|
||||
|
||||
---
|
||||
*Performance Tracker v1.0 - Intelligent monitoring & optimization for SuperClaude operations*
|
||||
51
.claude/commands/shared/planning-mode.yml
Normal file
51
.claude/commands/shared/planning-mode.yml
Normal file
@@ -0,0 +1,51 @@
|
||||
# Planning Mode Config
|
||||
|
||||
## Flag-Based Planning Control
|
||||
```yaml
|
||||
Planning_Flags:
|
||||
--plan: "Force planning mode for any command"
|
||||
--skip-plan: "Skip planning mode (execute immediately)"
|
||||
default: "Execute immediately unless --plan flag is present"
|
||||
|
||||
Risk_Assessment:
|
||||
description: "Users control planning through explicit flags"
|
||||
recommendation: "Use --plan for risky ops that modify system state"
|
||||
```
|
||||
|
||||
## Risk Assessment Patterns
|
||||
```yaml
|
||||
Risk Triggers:
|
||||
Prod: deploy --env prod | migrate --rollback false
|
||||
Data Loss: cleanup --all | migrate w/o --dry-run
|
||||
System Wide: spawn --task | improve --iterate
|
||||
Arch: design --api | troubleshoot --prod
|
||||
|
||||
Checkpoint Required:
|
||||
- Before: deploy, migrate, cleanup --all
|
||||
- During: Long-running improve --iterate
|
||||
- After: Any operation with warnings
|
||||
|
||||
Safety Overrides:
|
||||
--no-plan: Skip planning only for SKIP_PLANNING commands
|
||||
--plan: Force planning for any command
|
||||
--dry-run: Safe preview mode, skip planning
|
||||
```
|
||||
|
||||
## Planning Workflow
|
||||
```yaml
|
||||
Pre-Execution Check:
|
||||
1. Parse command name and flags
|
||||
2. Check REQUIRED_PLANNING list
|
||||
3. Check special conditions (build --init)
|
||||
4. If planning required → exit_plan_mode → await approval
|
||||
5. Create checkpoint if risky
|
||||
6. Proceed with execution
|
||||
|
||||
Planning Content:
|
||||
Required: Command intent, affected resources, risks, rollback plan
|
||||
Optional: Time estimate, dependencies, validation steps
|
||||
Format: Structured plan using exit_plan_mode tool
|
||||
```
|
||||
|
||||
---
|
||||
*Planning mode configuration for systematic risk management*
|
||||
278
.claude/commands/shared/research-first.yml
Normal file
278
.claude/commands/shared/research-first.yml
Normal file
@@ -0,0 +1,278 @@
|
||||
# Research-First Professional Standards
|
||||
|
||||
## Mandatory Research Triggers [C:10]
|
||||
|
||||
```yaml
|
||||
External_Libraries:
|
||||
Detection_Patterns:
|
||||
- import .* from ['"][^./]['"] # Non-relative imports
|
||||
- require\(['"][^./]['"] # CommonJS non-relative
|
||||
- from (\w+) import # Python imports
|
||||
- using \w+; # C# namespaces
|
||||
- implementation ['"].*:.*['"] # Gradle dependencies
|
||||
|
||||
Required_Research:
|
||||
JS/TS:
|
||||
- React: hooks, components, state mgmt
|
||||
- Vue: composition API, directives, reactivity
|
||||
- Angular: services, DI, modules
|
||||
- Express: middleware, routing, error handling
|
||||
- Next.js: SSR, SSG, API routes, app dir
|
||||
- Node.js: built-in modules, streams, cluster
|
||||
|
||||
Python:
|
||||
- Django: models, views, middleware, admin
|
||||
- Flask: blueprints, extensions, request handling
|
||||
- FastAPI: dependency injection, async, pydantic
|
||||
- NumPy/Pandas: array operations, dataframes
|
||||
- TensorFlow/PyTorch: models, training, deployment
|
||||
|
||||
Other:
|
||||
- Database: SQL syntax, ORM patterns, migrations
|
||||
- Cloud: AWS/GCP/Azure service APIs
|
||||
- Testing: framework-specific assertions, mocks
|
||||
- Build tools: webpack, vite, rollup configs
|
||||
|
||||
Component_Creation:
|
||||
UI_Keywords:
|
||||
- button, form, modal, dialog, dropdown
|
||||
- table, list, grid, card, accordion
|
||||
- nav, menu, sidebar, header, footer
|
||||
- chart, graph, visualization, dashboard
|
||||
|
||||
Required_Actions:
|
||||
- Check existing components in project
|
||||
- Search design system if available
|
||||
- Use Magic builder for new components
|
||||
- WebSearch for accessibility patterns
|
||||
- Verify responsive design requirements
|
||||
|
||||
API_Integration:
|
||||
Patterns:
|
||||
- REST: endpoints, methods, authentication
|
||||
- GraphQL: queries, mutations, schemas
|
||||
- WebSocket: events, connections, protocols
|
||||
- SDK/Client: initialization, methods, errors
|
||||
|
||||
Required_Checks:
|
||||
- Official API documentation
|
||||
- Authentication methods
|
||||
- Rate limits and quotas
|
||||
- Error response formats
|
||||
- Versioning and deprecations
|
||||
```
|
||||
|
||||
## Implementation Blockers
|
||||
|
||||
```yaml
|
||||
Guessing_Indicators:
|
||||
Phrases_To_Block:
|
||||
- "might work"
|
||||
- "should probably"
|
||||
- "I think this"
|
||||
- "typically would"
|
||||
- "usually looks like"
|
||||
- "common pattern is"
|
||||
- "often implemented as"
|
||||
|
||||
Required_Instead:
|
||||
- "According to [source]"
|
||||
- "Documentation states"
|
||||
- "Official example shows"
|
||||
- "Verified pattern from"
|
||||
- "Testing confirms"
|
||||
|
||||
Confidence_Requirements:
|
||||
Minimum_Score: 90%
|
||||
|
||||
Evidence_Types:
|
||||
Official_Docs: 100%
|
||||
Tutorial_From_Maintainer: 95%
|
||||
Recent_Blog_Post: 85%
|
||||
Stack_Overflow_Accepted: 80%
|
||||
GitHub_Issue_Resolution: 85%
|
||||
No_Evidence: 0% (BLOCK)
|
||||
|
||||
Score_Calculation:
|
||||
- Must have at least one 95%+ source
|
||||
- Multiple 80%+ sources can combine
|
||||
- Age penalty: -5% per year old
|
||||
- Verification: Test/example adds +10%
|
||||
```
|
||||
|
||||
## Research Workflows
|
||||
|
||||
```yaml
|
||||
Library_Research_Flow:
|
||||
1. Detect library reference in code/request
|
||||
2. Check if already in package.json/requirements
|
||||
3. C7 resolve-library-id → get-docs
|
||||
4. If C7 fails → WebSearch "library official docs"
|
||||
5. Extract key patterns:
|
||||
- Installation method
|
||||
- Basic usage examples
|
||||
- Common patterns
|
||||
- Error handling
|
||||
- Best practices
|
||||
6. Cache results for session
|
||||
7. Cite sources in implementation
|
||||
|
||||
Component_Research_Flow:
|
||||
1. Identify UI component need
|
||||
2. Search existing codebase first
|
||||
3. Check project's component library
|
||||
4. Magic builder search with keywords
|
||||
5. If no match → WebSearch "component accessibility"
|
||||
6. Implement with citations
|
||||
7. Note any deviations from patterns
|
||||
|
||||
API_Research_Flow:
|
||||
1. Identify API/service to integrate
|
||||
2. WebSearch "service official API docs"
|
||||
3. Find authentication documentation
|
||||
4. Locate endpoint references
|
||||
5. Check for SDK/client library
|
||||
6. Review error handling patterns
|
||||
7. Note rate limits and constraints
|
||||
```
|
||||
|
||||
## Professional Standards
|
||||
|
||||
```yaml
|
||||
Source_Attribution:
|
||||
Required_Format: "// Source: [URL or Doc Reference]"
|
||||
|
||||
Placement:
|
||||
- Above implementation using pattern
|
||||
- In function documentation
|
||||
- In commit messages for new patterns
|
||||
|
||||
Citation_Examples:
|
||||
Good:
|
||||
- "// Source: React docs - https://react.dev/reference/react/useState"
|
||||
- "// Pattern from: Express.js error handling guide"
|
||||
- "// Based on: AWS S3 SDK documentation v3"
|
||||
|
||||
Bad:
|
||||
- "// Common pattern"
|
||||
- "// Standard approach"
|
||||
- "// Typical implementation"
|
||||
|
||||
Uncertainty_Handling:
|
||||
When_Docs_Unavailable:
|
||||
- State explicitly: "Documentation not found for X"
|
||||
- Provide rationale: "Using pattern similar to Y because..."
|
||||
- Mark as provisional: "// TODO: Verify when docs available"
|
||||
- Suggest alternatives: "Consider using documented library Z"
|
||||
|
||||
When_Multiple_Patterns:
|
||||
- Show options: "Documentation shows 3 approaches:"
|
||||
- Explain tradeoffs: "Option A is simpler but less flexible"
|
||||
- Recommend based on context: "For this use case, B is optimal"
|
||||
- Cite each source
|
||||
```
|
||||
|
||||
## Enforcement Mechanisms
|
||||
|
||||
```yaml
|
||||
Pre_Implementation_Checks:
|
||||
Parse_Code_For:
|
||||
- Import statements
|
||||
- Function calls to external libs
|
||||
- Component definitions
|
||||
- API endpoint references
|
||||
|
||||
Block_If:
|
||||
- External library with no research
|
||||
- New component type without pattern check
|
||||
- API usage without documentation
|
||||
- Confidence score below 90%
|
||||
|
||||
Warning_If:
|
||||
- Documentation is >2 years old
|
||||
- Using deprecated patterns
|
||||
- Multiple conflicting sources
|
||||
- Community solution vs official
|
||||
|
||||
Session_Research_Cache:
|
||||
Store:
|
||||
- Library: version, patterns, examples
|
||||
- Components: accessibility, variants
|
||||
- APIs: endpoints, auth, limits
|
||||
|
||||
Reuse:
|
||||
- Same library → use cached patterns
|
||||
- Note: "Using previously researched pattern"
|
||||
- Invalidate on version change
|
||||
|
||||
Integration_Points:
|
||||
Commands:
|
||||
- build: Check all imports
|
||||
- improve: Verify optimization patterns
|
||||
- troubleshoot: Search known issues first
|
||||
- design: Research architectural patterns
|
||||
|
||||
Personas:
|
||||
- frontend: Extra UI/UX research
|
||||
- backend: API/database patterns
|
||||
- architect: System design patterns
|
||||
- security: Vulnerability databases
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
```yaml
|
||||
Good_Implementation:
|
||||
Request: "Add user authentication to Express app"
|
||||
|
||||
Research_Steps:
|
||||
1. C7 resolve-library-id("express")
|
||||
2. C7 get-docs(topic: "authentication middleware")
|
||||
3. WebSearch "express session best practices 2024"
|
||||
4. Check project for existing auth patterns
|
||||
|
||||
Implementation:
|
||||
```javascript
|
||||
// Source: Express.js docs - https://expressjs.com/en/guide/using-middleware.html
|
||||
// Pattern: Session-based authentication with secure defaults
|
||||
|
||||
const session = require('express-session');
|
||||
const MongoStore = require('connect-mongo');
|
||||
|
||||
// Source: OWASP session management cheat sheet
|
||||
app.use(session({
|
||||
secret: process.env.SESSION_SECRET,
|
||||
resave: false,
|
||||
saveUninitialized: false,
|
||||
cookie: {
|
||||
secure: process.env.NODE_ENV === 'production',
|
||||
httpOnly: true,
|
||||
maxAge: 1000 * 60 * 60 * 24 // 24 hours
|
||||
},
|
||||
store: MongoStore.create({
|
||||
mongoUrl: process.env.MONGODB_URI
|
||||
})
|
||||
}));
|
||||
```
|
||||
|
||||
Bad_Implementation_Blocked:
|
||||
Request: "Add user authentication to Express app"
|
||||
|
||||
Without_Research:
|
||||
```javascript
|
||||
// BLOCKED: No documentation reference
|
||||
// This might work for authentication
|
||||
app.use((req, res, next) => {
|
||||
if (req.session && req.session.user) {
|
||||
next();
|
||||
} else {
|
||||
res.redirect('/login');
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
Error: "External library usage requires documentation. Please research Express.js authentication patterns first."
|
||||
```
|
||||
|
||||
---
|
||||
*Research-First: Ensuring professional, evidence-based implementations*
|
||||
61
.claude/commands/shared/thinking-modes.yml
Normal file
61
.claude/commands/shared/thinking-modes.yml
Normal file
@@ -0,0 +1,61 @@
|
||||
# Thinking Mode Config
|
||||
|
||||
## Thinking Mode Flags
|
||||
```yaml
|
||||
Command_Flags:
|
||||
--think: "Standard thinking mode - Multi-file analysis (4K tokens)"
|
||||
--think-hard: "Deep analysis mode - Arch level (10K tokens)"
|
||||
--ultrathink: "Critical analysis mode - System redesign (32K tokens)"
|
||||
|
||||
Default_Behavior:
|
||||
No_flag: "Basic mode - Single file, simple tasks"
|
||||
|
||||
Flag_Combinations:
|
||||
With_planning: "--plan --think" # Plan w/ deeper analysis
|
||||
With_other_flags: Compatible w/ all command-specific flags
|
||||
|
||||
Usage_Examples:
|
||||
- /user:analyze --code --think # Standard code analysis
|
||||
- /user:design --api --think-hard # Deep architectural design
|
||||
- /user:troubleshoot --ultrathink # Critical debugging session
|
||||
- /user:improve --perf --think # Perf analysis w/ context
|
||||
```
|
||||
|
||||
## Mode Characteristics
|
||||
```yaml
|
||||
Basic (no flag):
|
||||
Scope: Single file, <10 lines
|
||||
Use_case: Quick fixes, simple edits, direct answers
|
||||
Token_usage: Minimal
|
||||
|
||||
Standard (--think):
|
||||
Scope: Multi-file coordination
|
||||
Use_case: Feature implementation, moderate complexity
|
||||
Token_usage: ~4K tokens
|
||||
|
||||
Deep (--think-hard):
|
||||
Scope: System architecture, complex patterns
|
||||
Use_case: Design decisions, optimization strategies
|
||||
Token_usage: ~10K tokens
|
||||
|
||||
Critical (--ultrathink):
|
||||
Scope: Complete system analysis
|
||||
Use_case: Redesigns, security audits, critical issues
|
||||
Token_usage: ~32K tokens
|
||||
```
|
||||
|
||||
## Auto-Activation Rules
|
||||
```yaml
|
||||
Command_Triggers:
|
||||
design + --api: Suggest --think-hard for architecture
|
||||
troubleshoot + production: Suggest --ultrathink for critical issues
|
||||
analyze + --security: Auto-apply --think for comprehensive review
|
||||
|
||||
Complexity_Detection:
|
||||
Multi-file_reference: Upgrade to --think
|
||||
Architecture_keywords: Suggest --think-hard
|
||||
Critical_terms: Recommend --ultrathink
|
||||
```
|
||||
|
||||
---
|
||||
*Thinking modes: Control analysis depth through command flags*
|
||||
97
.claude/commands/shared/ultracompressed.yml
Normal file
97
.claude/commands/shared/ultracompressed.yml
Normal file
@@ -0,0 +1,97 @@
|
||||
# UltraCompressed Docs Mode
|
||||
# ~70% token reduction via telegram-style+symbols+abbrevs
|
||||
|
||||
Activation:
|
||||
Flags: --ultracompressed | --uc
|
||||
Natural: "ultracompressed" | "minimal tokens" | "telegram style"
|
||||
Auto: Context>70% | Token budget specified | User preference
|
||||
|
||||
Core_Rules:
|
||||
Remove_Words:
|
||||
Articles: the|a|an
|
||||
Conjunctions: and|or|but|however|therefore
|
||||
Prepositions: of|in|on|at|to|for|with|from|by
|
||||
Fillers: that|which|who|very|really|quite|just
|
||||
Verbose: "in order to"→to | "make sure"→ensure | "as well as"→&
|
||||
|
||||
Symbol_Map:
|
||||
→: to/leads to/results in
|
||||
&: and/with/plus
|
||||
@: at/located at
|
||||
w/: with/including
|
||||
w/o: without/excluding
|
||||
+: add/plus/include
|
||||
-: remove/minus/exclude
|
||||
∴: therefore/thus
|
||||
∵: because/since
|
||||
≈: approximately/about
|
||||
∀: for all/every
|
||||
∃: exists/there is
|
||||
⊂: subset of/part of
|
||||
≡: equivalent to/same as
|
||||
|
||||
Abbreviations:
|
||||
cfg: configuration fn: function
|
||||
impl: implementation req: require/request
|
||||
resp: response auth: authentication
|
||||
db: database api: API/interface
|
||||
env: environment dev: development
|
||||
prod: production deps: dependencies
|
||||
arg: argument param: parameter
|
||||
val: value obj: object
|
||||
arr: array str: string
|
||||
num: number bool: boolean
|
||||
err: error msg: message
|
||||
usr: user sys: system
|
||||
lib: library pkg: package
|
||||
ctx: context ref: reference
|
||||
docs: documentation spec: specification
|
||||
|
||||
Structure_Rules:
|
||||
Headings: <20 chars | No articles | Symbols OK
|
||||
Sentences: <50 chars | Telegram style | No punctuation if clear
|
||||
Paragraphs: <100 chars | 3 sentences max | Lists preferred
|
||||
Lists: Bullets>numbers | No full sentences | Key info only
|
||||
Tables: Headers abbreviated | Cell content minimal | Symbols OK
|
||||
|
||||
Format_Hierarchy:
|
||||
1. YAML/JSON (structured data)
|
||||
2. Tables (comparison/reference)
|
||||
3. Bullet lists (enumeration)
|
||||
4. Numbered lists (sequences)
|
||||
5. Prose (avoid when possible)
|
||||
|
||||
Content_Rules:
|
||||
NO: Introductions|Conclusions|Transitions|Explanations of obvious
|
||||
NO: "Getting Started"|"Overview"|"Introduction" sections
|
||||
NO: Filler phrases|Politeness|Redundancy
|
||||
YES: Direct information|Code>text|Examples>description
|
||||
YES: Symbols>words|Abbreviations>full terms|Active>passive
|
||||
|
||||
Legend_Generation:
|
||||
When: Start of each doc | When new symbols/abbrevs used
|
||||
Format: Compact table | Only used items | Sort by frequency
|
||||
Location: After title | Before content | Collapsible if supported
|
||||
Example: |
|
||||
## Legend
|
||||
| Symbol | Meaning | | Abbrev | Meaning |
|
||||
|--------|---------|---|--------|---------|
|
||||
| → | leads to | | cfg | configuration |
|
||||
| & | and/with | | fn | function |
|
||||
| w/ | with | | impl | implementation |
|
||||
|
||||
Example_Transformations:
|
||||
Before: "This section provides an introduction to getting started with the authentication system"
|
||||
After: "Auth Setup"
|
||||
|
||||
Before: "In order to configure the database connection, you need to set the following environment variables"
|
||||
After: "DB cfg: Set env vars:"
|
||||
|
||||
Before: "The function takes three parameters and returns a boolean value"
|
||||
After: "fn(3 params)→bool"
|
||||
|
||||
Quality_Checks:
|
||||
Token_Reduction: Target 70% | Measure before/after
|
||||
Clarity_Score: Must remain >80% | Test w/ context
|
||||
Info_Density: Maximize bits/token | No info loss
|
||||
Legend_Required: Always include for symbols & abbreviations
|
||||
208
.claude/commands/shared/user-experience.yml
Normal file
208
.claude/commands/shared/user-experience.yml
Normal file
@@ -0,0 +1,208 @@
|
||||
# UX & Interface Patterns
|
||||
|
||||
## User Interaction Principles
|
||||
|
||||
```yaml
|
||||
Clarity & Communication:
|
||||
Clear Intent: Every command should have obvious purpose
|
||||
Immediate Feedback: Show what's happening in real-time
|
||||
Progress Indicators: Display completion % & ETA
|
||||
Result Summary: Concise overview→what was accomplished
|
||||
|
||||
Predictability:
|
||||
Consistent Behavior: Same flags work same way across commands
|
||||
Expected Outputs: Users should know what→expect
|
||||
Stable Interface: Minimize breaking changes
|
||||
Docs: Always up-to-date & comprehensive
|
||||
|
||||
Efficiency:
|
||||
Smart Defaults: Most common options should be default
|
||||
Minimal Typing: Short, memorable command names & flags
|
||||
Context Awareness: Remember previous ops & preferences
|
||||
Workflow Optimization: Common sequences should be streamlined
|
||||
```
|
||||
|
||||
## Progressive Disclosure
|
||||
|
||||
```yaml
|
||||
Beginner Mode:
|
||||
Guided Experience: Step-by-step instructions
|
||||
Explanatory Output: Why each step is needed
|
||||
Safety Rails: Prevent destructive operations
|
||||
Learning Resources: Links to documentation and tutorials
|
||||
|
||||
Intermediate Mode:
|
||||
Balanced Output: Key information without overwhelming detail
|
||||
Useful Shortcuts: Common flag combinations and aliases
|
||||
Context Hints: Suggestions based on current state
|
||||
Flexible Options: More configuration choices available
|
||||
|
||||
Expert Mode:
|
||||
Minimal Output: Just essential information
|
||||
Advanced Features: Full power and customization
|
||||
Direct Control: Override safety checks when needed
|
||||
Performance Focus: Optimized for speed and efficiency
|
||||
|
||||
Adaptive Interface:
|
||||
Usage Detection: Automatically adjust based on user behavior
|
||||
Preference Learning: Remember user's preferred interaction style
|
||||
Context Switching: Different modes for different project types
|
||||
Customization: Allow users to configure their experience
|
||||
```
|
||||
|
||||
## Workflow Discovery & Guidance
|
||||
|
||||
```yaml
|
||||
Command Suggestions:
|
||||
Context-Aware: Suggest next logical steps based on current state
|
||||
Common Patterns: Recommend proven workflow sequences
|
||||
Problem-Specific: Tailored suggestions for specific issues
|
||||
Learning Opportunities: Introduce new features when relevant
|
||||
|
||||
Interactive Help:
|
||||
Command Help: Detailed usage for specific commands
|
||||
Flag Explanations: What each flag does and when to use it
|
||||
Example Library: Real-world usage examples
|
||||
Troubleshooting: Common issues and solutions
|
||||
|
||||
Workflow Templates:
|
||||
Project Types: Predefined workflows for different project types
|
||||
Use Cases: Common scenarios with step-by-step guides
|
||||
Best Practices: Recommended approaches for quality and safety
|
||||
Customization: Allow users to create and share their own templates
|
||||
```
|
||||
|
||||
## Error Prevention & Recovery
|
||||
|
||||
```yaml
|
||||
Proactive Prevention:
|
||||
Validation: Check prerequisites before execution
|
||||
Warnings: Alert about potential issues or risks
|
||||
Confirmation: Require explicit approval for destructive operations
|
||||
Simulation: Dry-run mode to preview changes
|
||||
|
||||
Graceful Degradation:
|
||||
Partial Success: Continue with what's possible when some parts fail
|
||||
Alternative Paths: Suggest different approaches when primary fails
|
||||
Fallback Options: Automatic switches to backup methods
|
||||
Recovery Guidance: Clear steps to resolve issues and continue
|
||||
|
||||
Learning from Errors:
|
||||
Pattern Recognition: Identify common user mistakes
|
||||
Preventive Measures: Add checks for frequently encountered issues
|
||||
Documentation Updates: Improve help based on common confusion
|
||||
Interface Improvements: Redesign confusing or error-prone interactions
|
||||
```
|
||||
|
||||
## Performance & Responsiveness
|
||||
|
||||
```yaml
|
||||
Response Time Expectations:
|
||||
Immediate (<100ms): Command acknowledgment, simple queries
|
||||
Fast (<1s): File operations, simple analysis
|
||||
Moderate (<10s): Complex analysis, building, testing
|
||||
Long (>10s): Deployment, migration, comprehensive operations
|
||||
|
||||
Progress Communication:
|
||||
Quick Start: Show immediate activity indicator
|
||||
Detailed Progress: Break down long operations into steps
|
||||
Time Estimates: Provide realistic completion predictions
|
||||
Cancellation: Allow users to interrupt long operations
|
||||
|
||||
Resource Management:
|
||||
Token Awareness: Monitor and display context usage
|
||||
Memory Efficiency: Optimize for large codebases
|
||||
Network Usage: Minimize unnecessary requests
|
||||
Caching: Reuse results when appropriate
|
||||
```
|
||||
|
||||
## Accessibility & Inclusivity
|
||||
|
||||
```yaml
|
||||
Output Formatting:
|
||||
Screen Readers: Structured output that reads well
|
||||
Color Blind: Don't rely solely on color for information
|
||||
Low Vision: High contrast, clear typography
|
||||
Motor Impairments: Keyboard shortcuts, minimal mouse requirements
|
||||
|
||||
Language & Terminology:
|
||||
Clear Language: Avoid jargon when possible
|
||||
Consistent Terms: Use same words for same concepts
|
||||
Internationalization: Support for multiple languages
|
||||
Cultural Sensitivity: Inclusive examples and references
|
||||
|
||||
Learning Styles:
|
||||
Visual Learners: Diagrams, charts, visual representations
|
||||
Auditory Learners: Clear explanations, logical flow
|
||||
Kinesthetic Learners: Interactive exercises, hands-on examples
|
||||
Reading/Writing: Comprehensive documentation, examples
|
||||
```
|
||||
|
||||
## Customization & Personalization
|
||||
|
||||
```yaml
|
||||
User Preferences:
|
||||
Output Verbosity: Detailed, normal, minimal
|
||||
Color Schemes: Support for different terminal themes
|
||||
Confirmation Levels: When to ask for approval
|
||||
Default Flags: Commonly used flags for each command
|
||||
|
||||
Project Configuration:
|
||||
Workflow Presets: Saved command sequences for project
|
||||
Quality Gates: Project-specific standards and thresholds
|
||||
Tool Preferences: Choice of testing frameworks, linters, etc.
|
||||
Environment Settings: Development, staging, production configs
|
||||
|
||||
Team Settings:
|
||||
Shared Workflows: Common patterns across team members
|
||||
Code Standards: Enforced quality and style requirements
|
||||
Review Processes: Required steps before deployment
|
||||
Communication: How and when to notify team members
|
||||
```
|
||||
|
||||
## Feedback & Improvement
|
||||
|
||||
```yaml
|
||||
Usage Analytics:
|
||||
Command Frequency: Which commands are used most often
|
||||
Error Patterns: Common failure points and user confusion
|
||||
Workflow Analysis: How users combine commands
|
||||
Performance Metrics: Response times and user satisfaction
|
||||
|
||||
User Feedback:
|
||||
In-App Feedback: Quick way to report issues or suggestions
|
||||
Feature Requests: Channel for users to propose improvements
|
||||
Bug Reports: Structured way to report problems
|
||||
Success Stories: Positive feedback and use cases
|
||||
|
||||
Continuous Improvement:
|
||||
Regular Updates: Frequent improvements based on feedback
|
||||
A/B Testing: Try different approaches with different users
|
||||
Community Input: Involve users in design decisions
|
||||
Documentation: Keep help and examples current and useful
|
||||
```
|
||||
|
||||
## Integration Points
|
||||
|
||||
```yaml
|
||||
Command Integration:
|
||||
Consistent Patterns: Same UX principles across all commands
|
||||
Shared Components: Common UI elements and behaviors
|
||||
Context Preservation: Maintain user state across commands
|
||||
Workflow Continuity: Smooth transitions between operations
|
||||
|
||||
External Tools:
|
||||
IDE Integration: Work well within development environments
|
||||
Terminal Enhancement: Support for modern terminal features
|
||||
Documentation Tools: Generate and maintain help content
|
||||
Monitoring Systems: Track user experience metrics
|
||||
|
||||
Platform Adaptation:
|
||||
Operating Systems: Optimize for Windows, macOS, Linux
|
||||
Shell Environments: Work well with bash, zsh, PowerShell
|
||||
Cloud Platforms: Integration with cloud development environments
|
||||
Container Systems: Effective operation within containers
|
||||
```
|
||||
|
||||
---
|
||||
*User experience: Human-centered design for developer productivity*
|
||||
54
.claude/commands/shared/validation.yml
Normal file
54
.claude/commands/shared/validation.yml
Normal file
@@ -0,0 +1,54 @@
|
||||
# Validation Patterns
|
||||
|
||||
## Pre-Execution Checks
|
||||
|
||||
```yaml
|
||||
Always Validate:
|
||||
- Risky ops (delete, overwrite, deploy)
|
||||
- Prod changes
|
||||
- Permission escalations
|
||||
- External API calls
|
||||
|
||||
Check Sequence:
|
||||
1. Ambiguity: shared/ambiguity-check.yml
|
||||
2. Security: Path validation, secrets scan
|
||||
3. Deps: Required tools/libs exist
|
||||
4. Permissions: User has required access
|
||||
5. State: Clean working tree, no conflicts
|
||||
```
|
||||
|
||||
## Risk Assessment
|
||||
|
||||
```yaml
|
||||
Risk Score (1-10):
|
||||
Factors:
|
||||
Data loss potential: +3
|
||||
Irreversibility: +2
|
||||
Scope of impact: +2
|
||||
Security impact: +3
|
||||
|
||||
Mitigations:
|
||||
Backup available: -2
|
||||
Test coverage: -1
|
||||
Sandbox mode: -2
|
||||
|
||||
Actions by Score:
|
||||
1-3: Proceed with note
|
||||
4-6: Warn and confirm
|
||||
7-9: Require explicit approval
|
||||
10: Block execution
|
||||
```
|
||||
|
||||
## Integration
|
||||
|
||||
```yaml
|
||||
Commands:
|
||||
Include: shared/validation.yml
|
||||
Call: validate_pre_execution()
|
||||
|
||||
Auto-Trigger:
|
||||
- Git push/force operations
|
||||
- File deletions
|
||||
- Database migrations
|
||||
- Production deployments
|
||||
```
|
||||
138
.claude/commands/shared/workflow-chains.yml
Normal file
138
.claude/commands/shared/workflow-chains.yml
Normal file
@@ -0,0 +1,138 @@
|
||||
# Workflow Chain Patterns
|
||||
|
||||
## Command Chaining & Orchestration
|
||||
|
||||
```yaml
|
||||
Chain Types:
|
||||
Sequential: A→B→C (linear progression)
|
||||
Parallel: A&B&C (concurrent execution)
|
||||
Conditional: A&&B||C (success/failure paths)
|
||||
Loop: A→B→(condition)→A (iterative workflows)
|
||||
|
||||
Context Propagation:
|
||||
Analysis Results: analyze→build|design|improve (use findings)
|
||||
Design Patterns: design→build|document (apply arch)
|
||||
Test Results: test→improve|deploy (use coverage/results)
|
||||
Error Context: troubleshoot→improve|fix (use root cause)
|
||||
```
|
||||
|
||||
## Predefined Workflow Chains
|
||||
|
||||
```yaml
|
||||
Dev Workflows:
|
||||
New Feature:
|
||||
Chain: load→analyze→design→build→test→scan→deploy
|
||||
Flags: --think for analysis, --magic for UI, --pup for E2E
|
||||
Context: Each step uses previous outputs
|
||||
|
||||
Bug Fix:
|
||||
Chain: troubleshoot --investigate → troubleshoot --fix → test → commit
|
||||
Flags: --think-hard for complex bugs, --seq for root cause
|
||||
Context: Investigation findings guide fix implementation
|
||||
|
||||
Code Review:
|
||||
Chain: analyze --code → improve --quality → scan --validate → test
|
||||
Flags: --think for comprehensive review
|
||||
Context: Analysis results guide improvements
|
||||
|
||||
Quality Workflows:
|
||||
Performance Optimization:
|
||||
Chain: analyze --profile → improve --performance → test → measure
|
||||
Flags: --iterate --threshold 90% for continuous improvement
|
||||
Context: Profile results guide optimization targets
|
||||
|
||||
Security Hardening:
|
||||
Chain: scan --security → improve --quality → scan --validate → test
|
||||
Flags: --owasp for comprehensive security scanning
|
||||
Context: Security findings drive improvements
|
||||
|
||||
Tech Debt Reduction:
|
||||
Chain: analyze --architecture → improve --quality → design → refactor
|
||||
Flags: --think-hard for architectural analysis
|
||||
Context: Debt analysis guides refactoring strategy
|
||||
|
||||
Deployment Workflows:
|
||||
Safe Production Deploy:
|
||||
Chain: test --coverage → scan --validate → deploy --env staging → deploy --env prod
|
||||
Flags: --plan for production deployment
|
||||
Context: All gates must pass before production
|
||||
|
||||
Emergency Rollback:
|
||||
Chain: deploy --rollback → troubleshoot --investigate → git --checkpoint
|
||||
Flags: --ultrathink for critical analysis
|
||||
Context: Preserve state for post-incident analysis
|
||||
|
||||
Blue-Green Deployment:
|
||||
Chain: build → test → deploy --env blue → validate → switch-traffic → monitor
|
||||
Flags: --think-hard for deployment strategy
|
||||
Context: Health checks determine traffic switching
|
||||
```
|
||||
|
||||
## Chain Execution Rules
|
||||
|
||||
```yaml
|
||||
Success Propagation:
|
||||
Continue: If command succeeds, pass context to next
|
||||
Enhanced: Successful results enhance subsequent commands
|
||||
Cache: Store intermediate results for reuse
|
||||
|
||||
Failure Handling:
|
||||
Stop: Critical failures halt the chain
|
||||
Retry: Transient failures trigger retry with backoff
|
||||
Fallback: Use alternative command or skip non-critical steps
|
||||
Recovery: Automatic rollback for deployments
|
||||
|
||||
Context Management:
|
||||
Session: Keep context for entire workflow chain
|
||||
Handoff: Pass specific results between commands
|
||||
Cleanup: Clear context after chain completion
|
||||
Checkpoint: Save state at critical points
|
||||
|
||||
Performance Optimization:
|
||||
Parallel: Execute independent commands concurrently
|
||||
Skip: Avoid redundant operations based on context
|
||||
Cache: Reuse expensive analysis results
|
||||
Smart: Use previous results to inform decisions
|
||||
```
|
||||
|
||||
## Chain Monitoring & Reporting
|
||||
|
||||
```yaml
|
||||
Progress Tracking:
|
||||
Status: Show current step and overall progress
|
||||
Time: Estimate remaining time based on historical data
|
||||
Bottlenecks: Identify slow steps for optimization
|
||||
|
||||
Error Reporting:
|
||||
Point of Failure: Exact command and context where chain failed
|
||||
Recovery Options: Available retry, rollback, or manual intervention
|
||||
Impact Assessment: What was completed vs. what failed
|
||||
|
||||
Metrics Collection:
|
||||
Duration: Total and per-step execution time
|
||||
Success Rate: Chain completion percentage by workflow type
|
||||
Resource Usage: Token consumption and tool utilization
|
||||
Quality Gates: Pass/fail rates for validation steps
|
||||
```
|
||||
|
||||
## Usage Examples
|
||||
|
||||
```yaml
|
||||
CLI Usage:
|
||||
Single Chain: /user:chain "new-feature" --think
|
||||
Custom Chain: /user:analyze → /user:build → /user:test
|
||||
Conditional: /user:test && /user:deploy || /user:troubleshoot
|
||||
|
||||
Flag Inheritance:
|
||||
Global: /user:chain "deploy" --plan --think-hard
|
||||
Specific: /user:analyze --code → /user:build --magic
|
||||
Override: Chain defaults can be overridden per command
|
||||
|
||||
Context Queries:
|
||||
Status: /user:chain-status (show current chain progress)
|
||||
Results: /user:chain-results (show accumulated context)
|
||||
History: /user:chain-history (show previous chain executions)
|
||||
```
|
||||
|
||||
---
|
||||
*Workflow chains: Orchestrated command execution with intelligent context sharing*
|
||||
Reference in New Issue
Block a user