# 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]-.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*