Execution Patterns
yaml Standard_Lifecycle: Pre_Execution: Risk_Assessment: Calculate: "Assess operation risk level" Factors: ["Da…
Claude CodeGeneric
# Execution Patterns
# Unified workflow system, MCP orchestration, git operations, and execution lifecycle
## Legend
@include universal-constants.yml#Universal_Legend
## Universal Execution Lifecycle
```yaml
Standard_Lifecycle:
Pre_Execution:
Risk_Assessment:
Calculate: "Assess operation risk level"
Factors: ["Data loss potential", "Irreversibility", "Scope", "Security"]
Actions:
Low: "Proceed w/ monitoring"
Medium: "Warn & log"
High: "Require confirmation"
Critical: "Block & alert"
Environment_Validation:
Check: ["Required tools", "Permissions", "Resources", "Dependencies"]
Verify: ["Git state", "Network access", "Disk space", "Memory"]
MCP_Health: "Test server connectivity & response"
State_Preparation:
TodoList_Triggers: "@include task-management-patterns.yml#Auto_Trigger_Rules"
Checkpoint: "@include recovery-state-patterns.yml#Automatic_Triggers"
Cache: "Previous results for efficiency"
Lock: "Prevent concurrent modifications"
MCP_Cache_Init: "@include mcp-cache-patterns.yml#Cache_Storage"
During_Execution:
Progress_Monitoring:
Track: ["Operation progress", "Resource usage", "Error rates", "Token consumption"]
Alert: ["Performance degradation", "Approaching limits", "Anomalies", "MCP failures"]
Dynamic_Optimization:
Adapt: ["Adjust parallelism", "Switch strategies", "Cache results", "Fallback to native"]
Fallback: ["Use alternatives if primary fails", "Degrade gracefully"]
Error_Handling:
"@include recovery-state-patterns.yml#Recovery_Framework"
Post_Execution:
Verification:
Confirm: ["Expected outcomes achieved", "No side effects", "State consistent"]
Validate: ["Output quality", "Performance metrics", "Security compliance"]
Cleanup:
Remove: ["Temp files", "Locks", "Cached data"]
Update: ["Audit logs", "Metrics", "Documentation"]
Reporting:
Generate: ["Success/failure report", "Performance metrics", "Recommendations"]
Store: ".claudedocs/lifecycle/execution-{timestamp}.md"
MCP Server Registry & Orchestration
Servers:
Context7:
Purpose: "Library documentation and code examples"
Best_For: ["API usage", "framework patterns", "library integration"]
Token_Cost: "Low-Medium usage"
Capabilities:
- resolve-library-id: "Find Context7-compatible library ID"
- get-library-docs: "Fetch up-to-date documentation"
Success_Rate: "Very high for popular libraries"
Fallback: "WebSearch official docs"
Sequential:
Purpose: "Step-by-step complex problem solving"
Best_For: ["Architecture", "debugging", "system design", "root cause analysis"]
Token_Cost: "Medium-High usage"
Capabilities:
- sequentialthinking: "Adaptive multi-step reasoning"
Success_Rate: "High for complex problems"
Fallback: "Native step-by-step analysis"
NextJS_Tailwind:
Purpose: "Next.js and Tailwind CSS component generation"
Best_For: ["React/Next.js components", "Responsive design", "Modern UI patterns", "Production apps"]
Token_Cost: "Low (local templates)"
Capabilities:
- nextjs_component_builder: "Generate Next.js components with TypeScript"
- shadcn_ui_integration: "Generate shadcn/ui components"
- tailwind_pattern_generator: "Create responsive Tailwind patterns"
- form_validation_generator: "Generate forms with Zod validation"
- layout_generator: "Create App Router layouts and pages"
- icon_integration: "Integrate Lucide and Heroicons"
Success_Rate: "Very high (local templates)"
Fallback: "Manual component creation with guidance"
Puppeteer:
Purpose: "Browser automation and testing"
Best_For: ["E2E tests", "screenshots", "web scraping", "performance testing"]
Token_Cost: "Low (minimal tokens, mostly actions)"
Capabilities:
- connect_active_tab: "Connect to Chrome debugging"
- navigate: "Navigate to URLs"
- screenshot: "Capture page/element screenshots"
- click: "Click elements"
- fill: "Fill form inputs"
- evaluate: "Execute JavaScript"
Success_Rate: "Very high for standard web interactions"
Fallback: "Manual testing guidance"
MCP_Parallel_Execution:
"@include mcp-cache-patterns.yml#Parallel_MCP_Execution"
MCP_Cache_Integration:
Context7_Caching: "@include mcp-cache-patterns.yml#Context7_Cache"
Sequential_Caching: "@include mcp-cache-patterns.yml#Sequential_Cache"
NextJS_Tailwind_Caching: "@include mcp-cache-patterns.yml#NextJS_Tailwind_Cache"
Performance: "@include mcp-cache-patterns.yml#Cache_Performance_Optimization"
MCP_Control_Flags:
Individual:
--c7: "Enable Context7 only"
--no-c7: "Disable Context7"
--seq: "Enable Sequential only"
--no-seq: "Disable Sequential"
--nextjs: "Enable Next.js + Tailwind only"
--no-nextjs: "Disable Next.js + Tailwind generation"
--pup: "Enable Puppeteer only"
--no-pup: "Disable Puppeteer"
Combined:
--all-mcp: "Enable all MCP servers"
--no-mcp: "Disable all MCP servers (native tools only)"
Priority: "Explicit flags > Command defaults > Context triggers"
Override: "--no-mcp overrides all individual flags"
Chain Execution Patterns
Execution_Types:
Sequential: "A→B→C | Linear progression w/ context handoff"
Parallel: "A&B&C | Concurrent execution w/ result aggregation"
Conditional: "A&&B||C | Success/failure branching paths"
Iterative: "A→B→check→A | Loop until condition met"
Chain_Control:
Success_Rules:
Continue: "Pass enriched context to next command"
Cache: "Store intermediate results for reuse"
Skip: "Skip redundant operations if cached"
Failure_Rules:
Critical: "STOP: Halt chain, preserve context"
Recoverable: "RETRY: 3 attempts w/ exponential backoff"
Non_Critical: "CONTINUE: Log warning, proceed degraded"
Validation: "BRANCH: A
Maintain Execution Patterns?
Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.
[Execution Patterns on getagentictools](https://getagentictools.com/loops/mikeqin-execution-patterns?ref=badge)