mirror of
https://github.com/wshobson/agents.git
synced 2026-03-18 09:37:15 +00:00
fix: eliminate cross-plugin dependencies and modernize plugin.json across marketplace
Rewrites 14 commands across 11 plugins to remove all cross-plugin subagent_type references (e.g., "unit-testing::test-automator"), which break when plugins are installed standalone. Each command now uses only local bundled agents or general-purpose with role context in the prompt. All rewritten commands follow conductor-style patterns: - CRITICAL BEHAVIORAL RULES with strong directives - State files for session tracking and resume support - Phase checkpoints requiring explicit user approval - File-based context passing between steps Also fixes 4 plugin.json files missing version/license fields and adds plugin.json for dotnet-contribution. Closes #433
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "application-performance",
|
||||
"version": "1.2.1",
|
||||
"version": "1.3.0",
|
||||
"description": "Application profiling, performance optimization, and observability for frontend and backend systems",
|
||||
"author": {
|
||||
"name": "Seth Hobson",
|
||||
|
||||
@@ -1,124 +1,681 @@
|
||||
Optimize application performance end-to-end using specialized performance and optimization agents:
|
||||
---
|
||||
description: "Orchestrate end-to-end application performance optimization from profiling to monitoring"
|
||||
argument-hint: "<application or service> [--focus latency|throughput|cost|balanced] [--depth quick-wins|comprehensive|enterprise]"
|
||||
---
|
||||
|
||||
[Extended thinking: This workflow orchestrates a comprehensive performance optimization process across the entire application stack. Starting with deep profiling and baseline establishment, the workflow progresses through targeted optimizations in each system layer, validates improvements through load testing, and establishes continuous monitoring for sustained performance. Each phase builds on insights from previous phases, creating a data-driven optimization strategy that addresses real bottlenecks rather than theoretical improvements. The workflow emphasizes modern observability practices, user-centric performance metrics, and cost-effective optimization strategies.]
|
||||
# Performance Optimization Orchestrator
|
||||
|
||||
## Phase 1: Performance Profiling & Baseline
|
||||
## CRITICAL BEHAVIORAL RULES
|
||||
|
||||
### 1. Comprehensive Performance Profiling
|
||||
You MUST follow these rules exactly. Violating any of them is a failure.
|
||||
|
||||
- Use Task tool with subagent_type="performance-engineer"
|
||||
- Prompt: "Profile application performance comprehensively for: $ARGUMENTS. Generate flame graphs for CPU usage, heap dumps for memory analysis, trace I/O operations, and identify hot paths. Use APM tools like DataDog or New Relic if available. Include database query profiling, API response times, and frontend rendering metrics. Establish performance baselines for all critical user journeys."
|
||||
- Context: Initial performance investigation
|
||||
- Output: Detailed performance profile with flame graphs, memory analysis, bottleneck identification, baseline metrics
|
||||
1. **Execute steps in order.** Do NOT skip ahead, reorder, or merge steps.
|
||||
2. **Write output files.** Each step MUST produce its output file in `.performance-optimization/` before the next step begins. Read from prior step files — do NOT rely on context window memory.
|
||||
3. **Stop at checkpoints.** When you reach a `PHASE CHECKPOINT`, you MUST stop and wait for explicit user approval before continuing. Use the AskUserQuestion tool with clear options.
|
||||
4. **Halt on failure.** If any step fails (agent error, test failure, missing dependency), STOP immediately. Present the error and ask the user how to proceed. Do NOT silently continue.
|
||||
5. **Use only local agents.** All `subagent_type` references use agents bundled with this plugin or `general-purpose`. No cross-plugin dependencies.
|
||||
6. **Never enter plan mode autonomously.** Do NOT use EnterPlanMode. This command IS the plan — execute it.
|
||||
|
||||
### 2. Observability Stack Assessment
|
||||
## Pre-flight Checks
|
||||
|
||||
- Use Task tool with subagent_type="observability-engineer"
|
||||
- Prompt: "Assess current observability setup for: $ARGUMENTS. Review existing monitoring, distributed tracing with OpenTelemetry, log aggregation, and metrics collection. Identify gaps in visibility, missing metrics, and areas needing better instrumentation. Recommend APM tool integration and custom metrics for business-critical operations."
|
||||
- Context: Performance profile from step 1
|
||||
- Output: Observability assessment report, instrumentation gaps, monitoring recommendations
|
||||
Before starting, perform these checks:
|
||||
|
||||
### 3. User Experience Analysis
|
||||
### 1. Check for existing session
|
||||
|
||||
- Use Task tool with subagent_type="performance-engineer"
|
||||
- Prompt: "Analyze user experience metrics for: $ARGUMENTS. Measure Core Web Vitals (LCP, FID, CLS), page load times, time to interactive, and perceived performance. Use Real User Monitoring (RUM) data if available. Identify user journeys with poor performance and their business impact."
|
||||
- Context: Performance baselines from step 1
|
||||
- Output: UX performance report, Core Web Vitals analysis, user impact assessment
|
||||
Check if `.performance-optimization/state.json` exists:
|
||||
|
||||
## Phase 2: Database & Backend Optimization
|
||||
- If it exists and `status` is `"in_progress"`: Read it, display the current step, and ask the user:
|
||||
|
||||
### 4. Database Performance Optimization
|
||||
```
|
||||
Found an in-progress performance optimization session:
|
||||
Target: [name from state]
|
||||
Current step: [step from state]
|
||||
|
||||
- Use Task tool with subagent_type="database-cloud-optimization::database-optimizer"
|
||||
- Prompt: "Optimize database performance for: $ARGUMENTS based on profiling data: {context_from_phase_1}. Analyze slow query logs, create missing indexes, optimize execution plans, implement query result caching with Redis/Memcached. Review connection pooling, prepared statements, and batch processing opportunities. Consider read replicas and database sharding if needed."
|
||||
- Context: Performance bottlenecks from phase 1
|
||||
- Output: Optimized queries, new indexes, caching strategy, connection pool configuration
|
||||
1. Resume from where we left off
|
||||
2. Start fresh (archives existing session)
|
||||
```
|
||||
|
||||
### 5. Backend Code & API Optimization
|
||||
- If it exists and `status` is `"complete"`: Ask whether to archive and start fresh.
|
||||
|
||||
- Use Task tool with subagent_type="backend-development::backend-architect"
|
||||
- Prompt: "Optimize backend services for: $ARGUMENTS targeting bottlenecks: {context_from_phase_1}. Implement efficient algorithms, add application-level caching, optimize N+1 queries, use async/await patterns effectively. Implement pagination, response compression, GraphQL query optimization, and batch API operations. Add circuit breakers and bulkheads for resilience."
|
||||
- Context: Database optimizations from step 4, profiling data from phase 1
|
||||
- Output: Optimized backend code, caching implementation, API improvements, resilience patterns
|
||||
### 2. Initialize state
|
||||
|
||||
### 6. Microservices & Distributed System Optimization
|
||||
Create `.performance-optimization/` directory and `state.json`:
|
||||
|
||||
- Use Task tool with subagent_type="performance-engineer"
|
||||
- Prompt: "Optimize distributed system performance for: $ARGUMENTS. Analyze service-to-service communication, implement service mesh optimizations, optimize message queue performance (Kafka/RabbitMQ), reduce network hops. Implement distributed caching strategies and optimize serialization/deserialization."
|
||||
- Context: Backend optimizations from step 5
|
||||
- Output: Service communication improvements, message queue optimization, distributed caching setup
|
||||
```json
|
||||
{
|
||||
"target": "$ARGUMENTS",
|
||||
"status": "in_progress",
|
||||
"focus": "balanced",
|
||||
"depth": "comprehensive",
|
||||
"current_step": 1,
|
||||
"current_phase": 1,
|
||||
"completed_steps": [],
|
||||
"files_created": [],
|
||||
"started_at": "ISO_TIMESTAMP",
|
||||
"last_updated": "ISO_TIMESTAMP"
|
||||
}
|
||||
```
|
||||
|
||||
## Phase 3: Frontend & CDN Optimization
|
||||
Parse `$ARGUMENTS` for `--focus` and `--depth` flags. Use defaults if not specified.
|
||||
|
||||
### 7. Frontend Bundle & Loading Optimization
|
||||
### 3. Parse target description
|
||||
|
||||
- Use Task tool with subagent_type="frontend-developer"
|
||||
- Prompt: "Optimize frontend performance for: $ARGUMENTS targeting Core Web Vitals: {context_from_phase_1}. Implement code splitting, tree shaking, lazy loading, and dynamic imports. Optimize bundle sizes with webpack/rollup analysis. Implement resource hints (prefetch, preconnect, preload). Optimize critical rendering path and eliminate render-blocking resources."
|
||||
- Context: UX analysis from phase 1, backend optimizations from phase 2
|
||||
- Output: Optimized bundles, lazy loading implementation, improved Core Web Vitals
|
||||
Extract the target description from `$ARGUMENTS` (everything before the flags). This is referenced as `$TARGET` in prompts below.
|
||||
|
||||
### 8. CDN & Edge Optimization
|
||||
---
|
||||
|
||||
- Use Task tool with subagent_type="cloud-infrastructure::cloud-architect"
|
||||
- Prompt: "Optimize CDN and edge performance for: $ARGUMENTS. Configure CloudFlare/CloudFront for optimal caching, implement edge functions for dynamic content, set up image optimization with responsive images and WebP/AVIF formats. Configure HTTP/2 and HTTP/3, implement Brotli compression. Set up geographic distribution for global users."
|
||||
- Context: Frontend optimizations from step 7
|
||||
- Output: CDN configuration, edge caching rules, compression setup, geographic optimization
|
||||
## Phase 1: Performance Profiling & Baseline (Steps 1–3)
|
||||
|
||||
### 9. Mobile & Progressive Web App Optimization
|
||||
### Step 1: Comprehensive Performance Profiling
|
||||
|
||||
- Use Task tool with subagent_type="frontend-mobile-development::mobile-developer"
|
||||
- Prompt: "Optimize mobile experience for: $ARGUMENTS. Implement service workers for offline functionality, optimize for slow networks with adaptive loading. Reduce JavaScript execution time for mobile CPUs. Implement virtual scrolling for long lists. Optimize touch responsiveness and smooth animations. Consider React Native/Flutter specific optimizations if applicable."
|
||||
- Context: Frontend optimizations from steps 7-8
|
||||
- Output: Mobile-optimized code, PWA implementation, offline functionality
|
||||
Use the Task tool to launch the performance engineer:
|
||||
|
||||
## Phase 4: Load Testing & Validation
|
||||
```
|
||||
Task:
|
||||
subagent_type: "performance-engineer"
|
||||
description: "Profile application performance for $TARGET"
|
||||
prompt: |
|
||||
Profile application performance comprehensively for: $TARGET.
|
||||
|
||||
### 10. Comprehensive Load Testing
|
||||
Generate flame graphs for CPU usage, heap dumps for memory analysis, trace I/O operations,
|
||||
and identify hot paths. Use APM tools like DataDog or New Relic if available. Include database
|
||||
query profiling, API response times, and frontend rendering metrics. Establish performance
|
||||
baselines for all critical user journeys.
|
||||
|
||||
- Use Task tool with subagent_type="performance-engineer"
|
||||
- Prompt: "Conduct comprehensive load testing for: $ARGUMENTS using k6/Gatling/Artillery. Design realistic load scenarios based on production traffic patterns. Test normal load, peak load, and stress scenarios. Include API testing, browser-based testing, and WebSocket testing if applicable. Measure response times, throughput, error rates, and resource utilization at various load levels."
|
||||
- Context: All optimizations from phases 1-3
|
||||
- Output: Load test results, performance under load, breaking points, scalability analysis
|
||||
## Deliverables
|
||||
1. Performance profile with flame graphs and memory analysis
|
||||
2. Bottleneck identification ranked by impact
|
||||
3. Baseline metrics for critical user journeys
|
||||
4. Database query profiling results
|
||||
5. API response time measurements
|
||||
|
||||
### 11. Performance Regression Testing
|
||||
Write your complete profiling report as a single markdown document.
|
||||
```
|
||||
|
||||
- Use Task tool with subagent_type="performance-testing-review::test-automator"
|
||||
- Prompt: "Create automated performance regression tests for: $ARGUMENTS. Set up performance budgets for key metrics, integrate with CI/CD pipeline using GitHub Actions or similar. Create Lighthouse CI tests for frontend, API performance tests with Artillery, and database performance benchmarks. Implement automatic rollback triggers for performance regressions."
|
||||
- Context: Load test results from step 10, baseline metrics from phase 1
|
||||
- Output: Performance test suite, CI/CD integration, regression prevention system
|
||||
Save the agent's output to `.performance-optimization/01-profiling.md`.
|
||||
|
||||
## Phase 5: Monitoring & Continuous Optimization
|
||||
Update `state.json`: set `current_step` to 2, add step 1 to `completed_steps`.
|
||||
|
||||
### 12. Production Monitoring Setup
|
||||
### Step 2: Observability Stack Assessment
|
||||
|
||||
- Use Task tool with subagent_type="observability-engineer"
|
||||
- Prompt: "Implement production performance monitoring for: $ARGUMENTS. Set up APM with DataDog/New Relic/Dynatrace, configure distributed tracing with OpenTelemetry, implement custom business metrics. Create Grafana dashboards for key metrics, set up PagerDuty alerts for performance degradation. Define SLIs/SLOs for critical services with error budgets."
|
||||
- Context: Performance improvements from all previous phases
|
||||
- Output: Monitoring dashboards, alert rules, SLI/SLO definitions, runbooks
|
||||
Read `.performance-optimization/01-profiling.md` to load profiling context.
|
||||
|
||||
### 13. Continuous Performance Optimization
|
||||
Use the Task tool:
|
||||
|
||||
- Use Task tool with subagent_type="performance-engineer"
|
||||
- Prompt: "Establish continuous optimization process for: $ARGUMENTS. Create performance budget tracking, implement A/B testing for performance changes, set up continuous profiling in production. Document optimization opportunities backlog, create capacity planning models, and establish regular performance review cycles."
|
||||
- Context: Monitoring setup from step 12, all previous optimization work
|
||||
- Output: Performance budget tracking, optimization backlog, capacity planning, review process
|
||||
```
|
||||
Task:
|
||||
subagent_type: "observability-engineer"
|
||||
description: "Assess observability setup for $TARGET"
|
||||
prompt: |
|
||||
Assess current observability setup for: $TARGET.
|
||||
|
||||
## Configuration Options
|
||||
## Performance Profile
|
||||
[Insert full contents of .performance-optimization/01-profiling.md]
|
||||
|
||||
- **performance_focus**: "latency" | "throughput" | "cost" | "balanced" (default: "balanced")
|
||||
- **optimization_depth**: "quick-wins" | "comprehensive" | "enterprise" (default: "comprehensive")
|
||||
- **tools_available**: ["datadog", "newrelic", "prometheus", "grafana", "k6", "gatling"]
|
||||
- **budget_constraints**: Set maximum acceptable costs for infrastructure changes
|
||||
- **user_impact_tolerance**: "zero-downtime" | "maintenance-window" | "gradual-rollout"
|
||||
Review existing monitoring, distributed tracing with OpenTelemetry, log aggregation,
|
||||
and metrics collection. Identify gaps in visibility, missing metrics, and areas needing
|
||||
better instrumentation. Recommend APM tool integration and custom metrics for
|
||||
business-critical operations.
|
||||
|
||||
## Deliverables
|
||||
1. Current observability assessment
|
||||
2. Instrumentation gaps identified
|
||||
3. Monitoring recommendations
|
||||
4. Recommended metrics and dashboards
|
||||
|
||||
Write your complete assessment as a single markdown document.
|
||||
```
|
||||
|
||||
Save the agent's output to `.performance-optimization/02-observability.md`.
|
||||
|
||||
Update `state.json`: set `current_step` to 3, add step 2 to `completed_steps`.
|
||||
|
||||
### Step 3: User Experience Analysis
|
||||
|
||||
Read `.performance-optimization/01-profiling.md`.
|
||||
|
||||
Use the Task tool:
|
||||
|
||||
```
|
||||
Task:
|
||||
subagent_type: "performance-engineer"
|
||||
description: "Analyze user experience metrics for $TARGET"
|
||||
prompt: |
|
||||
Analyze user experience metrics for: $TARGET.
|
||||
|
||||
## Performance Baselines
|
||||
[Insert contents of .performance-optimization/01-profiling.md]
|
||||
|
||||
Measure Core Web Vitals (LCP, FID, CLS), page load times, time to interactive,
|
||||
and perceived performance. Use Real User Monitoring (RUM) data if available.
|
||||
Identify user journeys with poor performance and their business impact.
|
||||
|
||||
## Deliverables
|
||||
1. Core Web Vitals analysis
|
||||
2. User journey performance report
|
||||
3. Business impact assessment
|
||||
4. Prioritized improvement opportunities
|
||||
|
||||
Write your complete analysis as a single markdown document.
|
||||
```
|
||||
|
||||
Save the agent's output to `.performance-optimization/03-ux-analysis.md`.
|
||||
|
||||
Update `state.json`: set `current_step` to "checkpoint-1", add step 3 to `completed_steps`.
|
||||
|
||||
---
|
||||
|
||||
## PHASE CHECKPOINT 1 — User Approval Required
|
||||
|
||||
You MUST stop here and present the profiling results for review.
|
||||
|
||||
Display a summary from `.performance-optimization/01-profiling.md`, `.performance-optimization/02-observability.md`, and `.performance-optimization/03-ux-analysis.md` (key bottlenecks, observability gaps, UX findings) and ask:
|
||||
|
||||
```
|
||||
Performance profiling complete. Please review:
|
||||
- .performance-optimization/01-profiling.md
|
||||
- .performance-optimization/02-observability.md
|
||||
- .performance-optimization/03-ux-analysis.md
|
||||
|
||||
Key bottlenecks: [summary]
|
||||
Observability gaps: [summary]
|
||||
UX findings: [summary]
|
||||
|
||||
1. Approve — proceed to optimization
|
||||
2. Request changes — tell me what to adjust
|
||||
3. Pause — save progress and stop here
|
||||
```
|
||||
|
||||
Do NOT proceed to Phase 2 until the user selects option 1. If they select option 2, revise and re-checkpoint. If option 3, update `state.json` status and stop.
|
||||
|
||||
---
|
||||
|
||||
## Phase 2: Database & Backend Optimization (Steps 4–6)
|
||||
|
||||
### Step 4: Database Performance Optimization
|
||||
|
||||
Read `.performance-optimization/01-profiling.md` and `.performance-optimization/03-ux-analysis.md`.
|
||||
|
||||
Use the Task tool:
|
||||
|
||||
```
|
||||
Task:
|
||||
subagent_type: "general-purpose"
|
||||
description: "Optimize database performance for $TARGET"
|
||||
prompt: |
|
||||
You are a database optimization expert. Optimize database performance for: $TARGET.
|
||||
|
||||
## Profiling Data
|
||||
[Insert contents of .performance-optimization/01-profiling.md]
|
||||
|
||||
## UX Analysis
|
||||
[Insert contents of .performance-optimization/03-ux-analysis.md]
|
||||
|
||||
Analyze slow query logs, create missing indexes, optimize execution plans, implement
|
||||
query result caching with Redis/Memcached. Review connection pooling, prepared statements,
|
||||
and batch processing opportunities. Consider read replicas and database sharding if needed.
|
||||
|
||||
## Deliverables
|
||||
1. Optimized queries with before/after performance
|
||||
2. New indexes with justification
|
||||
3. Caching strategy recommendation
|
||||
4. Connection pool configuration
|
||||
5. Implementation plan with priority order
|
||||
|
||||
Write your complete optimization plan as a single markdown document.
|
||||
```
|
||||
|
||||
Save output to `.performance-optimization/04-database.md`.
|
||||
|
||||
Update `state.json`: set `current_step` to 5, add step 4 to `completed_steps`.
|
||||
|
||||
### Step 5: Backend Code & API Optimization
|
||||
|
||||
Read `.performance-optimization/01-profiling.md` and `.performance-optimization/04-database.md`.
|
||||
|
||||
Use the Task tool:
|
||||
|
||||
```
|
||||
Task:
|
||||
subagent_type: "general-purpose"
|
||||
description: "Optimize backend services for $TARGET"
|
||||
prompt: |
|
||||
You are a backend performance architect. Optimize backend services for: $TARGET.
|
||||
|
||||
## Profiling Data
|
||||
[Insert contents of .performance-optimization/01-profiling.md]
|
||||
|
||||
## Database Optimizations
|
||||
[Insert contents of .performance-optimization/04-database.md]
|
||||
|
||||
Implement efficient algorithms, add application-level caching, optimize N+1 queries,
|
||||
use async/await patterns effectively. Implement pagination, response compression,
|
||||
GraphQL query optimization, and batch API operations. Add circuit breakers and
|
||||
bulkheads for resilience.
|
||||
|
||||
## Deliverables
|
||||
1. Optimized backend code with before/after metrics
|
||||
2. Caching implementation plan
|
||||
3. API improvements with expected impact
|
||||
4. Resilience patterns added
|
||||
5. Implementation priority order
|
||||
|
||||
Write your complete optimization plan as a single markdown document.
|
||||
```
|
||||
|
||||
Save output to `.performance-optimization/05-backend.md`.
|
||||
|
||||
Update `state.json`: set `current_step` to 6, add step 5 to `completed_steps`.
|
||||
|
||||
### Step 6: Microservices & Distributed System Optimization
|
||||
|
||||
Read `.performance-optimization/01-profiling.md` and `.performance-optimization/05-backend.md`.
|
||||
|
||||
Use the Task tool:
|
||||
|
||||
```
|
||||
Task:
|
||||
subagent_type: "performance-engineer"
|
||||
description: "Optimize distributed system performance for $TARGET"
|
||||
prompt: |
|
||||
Optimize distributed system performance for: $TARGET.
|
||||
|
||||
## Profiling Data
|
||||
[Insert contents of .performance-optimization/01-profiling.md]
|
||||
|
||||
## Backend Optimizations
|
||||
[Insert contents of .performance-optimization/05-backend.md]
|
||||
|
||||
Analyze service-to-service communication, implement service mesh optimizations,
|
||||
optimize message queue performance (Kafka/RabbitMQ), reduce network hops. Implement
|
||||
distributed caching strategies and optimize serialization/deserialization.
|
||||
|
||||
## Deliverables
|
||||
1. Service communication improvements
|
||||
2. Message queue optimization plan
|
||||
3. Distributed caching setup
|
||||
4. Network optimization recommendations
|
||||
5. Expected latency improvements
|
||||
|
||||
Write your complete optimization plan as a single markdown document.
|
||||
```
|
||||
|
||||
Save output to `.performance-optimization/06-distributed.md`.
|
||||
|
||||
Update `state.json`: set `current_step` to "checkpoint-2", add step 6 to `completed_steps`.
|
||||
|
||||
---
|
||||
|
||||
## PHASE CHECKPOINT 2 — User Approval Required
|
||||
|
||||
Display a summary of optimization plans from steps 4-6 and ask:
|
||||
|
||||
```
|
||||
Backend optimization plans complete. Please review:
|
||||
- .performance-optimization/04-database.md
|
||||
- .performance-optimization/05-backend.md
|
||||
- .performance-optimization/06-distributed.md
|
||||
|
||||
1. Approve — proceed to frontend & CDN optimization
|
||||
2. Request changes — tell me what to adjust
|
||||
3. Pause — save progress and stop here
|
||||
```
|
||||
|
||||
Do NOT proceed to Phase 3 until the user approves.
|
||||
|
||||
---
|
||||
|
||||
## Phase 3: Frontend & CDN Optimization (Steps 7–9)
|
||||
|
||||
### Step 7: Frontend Bundle & Loading Optimization
|
||||
|
||||
Read `.performance-optimization/03-ux-analysis.md` and `.performance-optimization/05-backend.md`.
|
||||
|
||||
Use the Task tool:
|
||||
|
||||
```
|
||||
Task:
|
||||
subagent_type: "frontend-developer"
|
||||
description: "Optimize frontend performance for $TARGET"
|
||||
prompt: |
|
||||
Optimize frontend performance for: $TARGET targeting Core Web Vitals improvements.
|
||||
|
||||
## UX Analysis
|
||||
[Insert contents of .performance-optimization/03-ux-analysis.md]
|
||||
|
||||
## Backend Optimizations
|
||||
[Insert contents of .performance-optimization/05-backend.md]
|
||||
|
||||
Implement code splitting, tree shaking, lazy loading, and dynamic imports. Optimize bundle
|
||||
sizes with webpack/rollup analysis. Implement resource hints (prefetch, preconnect, preload).
|
||||
Optimize critical rendering path and eliminate render-blocking resources.
|
||||
|
||||
## Deliverables
|
||||
1. Bundle optimization with size reductions
|
||||
2. Lazy loading implementation plan
|
||||
3. Resource hint configuration
|
||||
4. Critical rendering path optimizations
|
||||
5. Expected Core Web Vitals improvements
|
||||
|
||||
Write your complete optimization plan as a single markdown document.
|
||||
```
|
||||
|
||||
Save output to `.performance-optimization/07-frontend.md`.
|
||||
|
||||
Update `state.json`: set `current_step` to 8, add step 7 to `completed_steps`.
|
||||
|
||||
### Step 8: CDN & Edge Optimization
|
||||
|
||||
Read `.performance-optimization/07-frontend.md`.
|
||||
|
||||
Use the Task tool:
|
||||
|
||||
```
|
||||
Task:
|
||||
subagent_type: "general-purpose"
|
||||
description: "Optimize CDN and edge performance for $TARGET"
|
||||
prompt: |
|
||||
You are a cloud infrastructure and CDN optimization expert. Optimize CDN and edge
|
||||
performance for: $TARGET.
|
||||
|
||||
## Frontend Optimizations
|
||||
[Insert contents of .performance-optimization/07-frontend.md]
|
||||
|
||||
Configure CloudFlare/CloudFront for optimal caching, implement edge functions for
|
||||
dynamic content, set up image optimization with responsive images and WebP/AVIF formats.
|
||||
Configure HTTP/2 and HTTP/3, implement Brotli compression. Set up geographic
|
||||
distribution for global users.
|
||||
|
||||
## Deliverables
|
||||
1. CDN configuration recommendations
|
||||
2. Edge caching rules
|
||||
3. Image optimization strategy
|
||||
4. Compression setup
|
||||
5. Geographic distribution plan
|
||||
|
||||
Write your complete optimization plan as a single markdown document.
|
||||
```
|
||||
|
||||
Save output to `.performance-optimization/08-cdn.md`.
|
||||
|
||||
Update `state.json`: set `current_step` to 9, add step 8 to `completed_steps`.
|
||||
|
||||
### Step 9: Mobile & Progressive Web App Optimization
|
||||
|
||||
Read `.performance-optimization/07-frontend.md` and `.performance-optimization/08-cdn.md`.
|
||||
|
||||
Use the Task tool:
|
||||
|
||||
```
|
||||
Task:
|
||||
subagent_type: "general-purpose"
|
||||
description: "Optimize mobile experience for $TARGET"
|
||||
prompt: |
|
||||
You are a mobile performance optimization expert. Optimize mobile experience for: $TARGET.
|
||||
|
||||
## Frontend Optimizations
|
||||
[Insert contents of .performance-optimization/07-frontend.md]
|
||||
|
||||
## CDN Optimizations
|
||||
[Insert contents of .performance-optimization/08-cdn.md]
|
||||
|
||||
Implement service workers for offline functionality, optimize for slow networks with
|
||||
adaptive loading. Reduce JavaScript execution time for mobile CPUs. Implement virtual
|
||||
scrolling for long lists. Optimize touch responsiveness and smooth animations. Consider
|
||||
React Native/Flutter specific optimizations if applicable.
|
||||
|
||||
## Deliverables
|
||||
1. Mobile-optimized code recommendations
|
||||
2. PWA implementation plan
|
||||
3. Offline functionality strategy
|
||||
4. Adaptive loading configuration
|
||||
5. Expected mobile performance improvements
|
||||
|
||||
Write your complete optimization plan as a single markdown document.
|
||||
```
|
||||
|
||||
Save output to `.performance-optimization/09-mobile.md`.
|
||||
|
||||
Update `state.json`: set `current_step` to "checkpoint-3", add step 9 to `completed_steps`.
|
||||
|
||||
---
|
||||
|
||||
## PHASE CHECKPOINT 3 — User Approval Required
|
||||
|
||||
Display a summary of frontend/CDN/mobile optimization plans and ask:
|
||||
|
||||
```
|
||||
Frontend optimization plans complete. Please review:
|
||||
- .performance-optimization/07-frontend.md
|
||||
- .performance-optimization/08-cdn.md
|
||||
- .performance-optimization/09-mobile.md
|
||||
|
||||
1. Approve — proceed to load testing & validation
|
||||
2. Request changes — tell me what to adjust
|
||||
3. Pause — save progress and stop here
|
||||
```
|
||||
|
||||
Do NOT proceed to Phase 4 until the user approves.
|
||||
|
||||
---
|
||||
|
||||
## Phase 4: Load Testing & Validation (Steps 10–11)
|
||||
|
||||
### Step 10: Comprehensive Load Testing
|
||||
|
||||
Read `.performance-optimization/01-profiling.md`.
|
||||
|
||||
Use the Task tool:
|
||||
|
||||
```
|
||||
Task:
|
||||
subagent_type: "performance-engineer"
|
||||
description: "Conduct comprehensive load testing for $TARGET"
|
||||
prompt: |
|
||||
Conduct comprehensive load testing for: $TARGET using k6/Gatling/Artillery.
|
||||
|
||||
## Original Baselines
|
||||
[Insert contents of .performance-optimization/01-profiling.md]
|
||||
|
||||
Design realistic load scenarios based on production traffic patterns. Test normal load,
|
||||
peak load, and stress scenarios. Include API testing, browser-based testing, and WebSocket
|
||||
testing if applicable. Measure response times, throughput, error rates, and resource
|
||||
utilization at various load levels.
|
||||
|
||||
## Deliverables
|
||||
1. Load test scripts and configurations
|
||||
2. Results at normal, peak, and stress loads
|
||||
3. Response time and throughput measurements
|
||||
4. Breaking points and scalability analysis
|
||||
5. Comparison against original baselines
|
||||
|
||||
Write your complete load test report as a single markdown document.
|
||||
```
|
||||
|
||||
Save output to `.performance-optimization/10-load-testing.md`.
|
||||
|
||||
Update `state.json`: set `current_step` to 11, add step 10 to `completed_steps`.
|
||||
|
||||
### Step 11: Performance Regression Testing
|
||||
|
||||
Read `.performance-optimization/10-load-testing.md` and `.performance-optimization/01-profiling.md`.
|
||||
|
||||
Use the Task tool:
|
||||
|
||||
```
|
||||
Task:
|
||||
subagent_type: "general-purpose"
|
||||
description: "Create performance regression tests for $TARGET"
|
||||
prompt: |
|
||||
You are a test automation expert specializing in performance testing. Create automated
|
||||
performance regression tests for: $TARGET.
|
||||
|
||||
## Load Test Results
|
||||
[Insert contents of .performance-optimization/10-load-testing.md]
|
||||
|
||||
## Original Baselines
|
||||
[Insert contents of .performance-optimization/01-profiling.md]
|
||||
|
||||
Set up performance budgets for key metrics, integrate with CI/CD pipeline using GitHub
|
||||
Actions or similar. Create Lighthouse CI tests for frontend, API performance tests with
|
||||
Artillery, and database performance benchmarks. Implement automatic rollback triggers
|
||||
for performance regressions.
|
||||
|
||||
## Deliverables
|
||||
1. Performance test suite with scripts
|
||||
2. CI/CD integration configuration
|
||||
3. Performance budgets and thresholds
|
||||
4. Regression detection rules
|
||||
5. Automatic rollback triggers
|
||||
|
||||
Write your complete regression testing plan as a single markdown document.
|
||||
```
|
||||
|
||||
Save output to `.performance-optimization/11-regression-testing.md`.
|
||||
|
||||
Update `state.json`: set `current_step` to "checkpoint-4", add step 11 to `completed_steps`.
|
||||
|
||||
---
|
||||
|
||||
## PHASE CHECKPOINT 4 — User Approval Required
|
||||
|
||||
Display a summary of testing results and ask:
|
||||
|
||||
```
|
||||
Load testing and validation complete. Please review:
|
||||
- .performance-optimization/10-load-testing.md
|
||||
- .performance-optimization/11-regression-testing.md
|
||||
|
||||
1. Approve — proceed to monitoring & continuous optimization
|
||||
2. Request changes — tell me what to adjust
|
||||
3. Pause — save progress and stop here
|
||||
```
|
||||
|
||||
Do NOT proceed to Phase 5 until the user approves.
|
||||
|
||||
---
|
||||
|
||||
## Phase 5: Monitoring & Continuous Optimization (Steps 12–13)
|
||||
|
||||
### Step 12: Production Monitoring Setup
|
||||
|
||||
Read `.performance-optimization/02-observability.md` and `.performance-optimization/10-load-testing.md`.
|
||||
|
||||
Use the Task tool:
|
||||
|
||||
```
|
||||
Task:
|
||||
subagent_type: "observability-engineer"
|
||||
description: "Implement production performance monitoring for $TARGET"
|
||||
prompt: |
|
||||
Implement production performance monitoring for: $TARGET.
|
||||
|
||||
## Observability Assessment
|
||||
[Insert contents of .performance-optimization/02-observability.md]
|
||||
|
||||
## Load Test Results
|
||||
[Insert contents of .performance-optimization/10-load-testing.md]
|
||||
|
||||
Set up APM with DataDog/New Relic/Dynatrace, configure distributed tracing with
|
||||
OpenTelemetry, implement custom business metrics. Create Grafana dashboards for key
|
||||
metrics, set up PagerDuty alerts for performance degradation. Define SLIs/SLOs for
|
||||
critical services with error budgets.
|
||||
|
||||
## Deliverables
|
||||
1. Monitoring dashboard configurations
|
||||
2. Alert rules and thresholds
|
||||
3. SLI/SLO definitions
|
||||
4. Runbooks for common performance issues
|
||||
5. Error budget tracking setup
|
||||
|
||||
Write your complete monitoring plan as a single markdown document.
|
||||
```
|
||||
|
||||
Save output to `.performance-optimization/12-monitoring.md`.
|
||||
|
||||
Update `state.json`: set `current_step` to 13, add step 12 to `completed_steps`.
|
||||
|
||||
### Step 13: Continuous Performance Optimization
|
||||
|
||||
Read all previous `.performance-optimization/*.md` files.
|
||||
|
||||
Use the Task tool:
|
||||
|
||||
```
|
||||
Task:
|
||||
subagent_type: "performance-engineer"
|
||||
description: "Establish continuous optimization process for $TARGET"
|
||||
prompt: |
|
||||
Establish continuous optimization process for: $TARGET.
|
||||
|
||||
## Monitoring Setup
|
||||
[Insert contents of .performance-optimization/12-monitoring.md]
|
||||
|
||||
## All Previous Optimization Work
|
||||
[Insert summary of key findings from all previous steps]
|
||||
|
||||
Create performance budget tracking, implement A/B testing for performance changes,
|
||||
set up continuous profiling in production. Document optimization opportunities backlog,
|
||||
create capacity planning models, and establish regular performance review cycles.
|
||||
|
||||
## Deliverables
|
||||
1. Performance budget tracking system
|
||||
2. Optimization backlog with priorities
|
||||
3. Capacity planning model
|
||||
4. Review cycle schedule and process
|
||||
5. A/B testing framework for performance changes
|
||||
|
||||
Write your complete continuous optimization plan as a single markdown document.
|
||||
```
|
||||
|
||||
Save output to `.performance-optimization/13-continuous.md`.
|
||||
|
||||
Update `state.json`: set `current_step` to "complete", add step 13 to `completed_steps`.
|
||||
|
||||
---
|
||||
|
||||
## Completion
|
||||
|
||||
Update `state.json`:
|
||||
|
||||
- Set `status` to `"complete"`
|
||||
- Set `last_updated` to current timestamp
|
||||
|
||||
Present the final summary:
|
||||
|
||||
```
|
||||
Performance optimization complete: $TARGET
|
||||
|
||||
## Files Created
|
||||
[List all .performance-optimization/ output files]
|
||||
|
||||
## Optimization Summary
|
||||
- Profiling: .performance-optimization/01-profiling.md
|
||||
- Observability: .performance-optimization/02-observability.md
|
||||
- UX Analysis: .performance-optimization/03-ux-analysis.md
|
||||
- Database: .performance-optimization/04-database.md
|
||||
- Backend: .performance-optimization/05-backend.md
|
||||
- Distributed: .performance-optimization/06-distributed.md
|
||||
- Frontend: .performance-optimization/07-frontend.md
|
||||
- CDN: .performance-optimization/08-cdn.md
|
||||
- Mobile: .performance-optimization/09-mobile.md
|
||||
- Load Testing: .performance-optimization/10-load-testing.md
|
||||
- Regression Testing: .performance-optimization/11-regression-testing.md
|
||||
- Monitoring: .performance-optimization/12-monitoring.md
|
||||
- Continuous: .performance-optimization/13-continuous.md
|
||||
|
||||
## Success Criteria
|
||||
- Response Time: P50 < 200ms, P95 < 1s, P99 < 2s for critical endpoints
|
||||
- Core Web Vitals: LCP < 2.5s, FID < 100ms, CLS < 0.1
|
||||
- Throughput: Support 2x current peak load with <1% error rate
|
||||
- Database Performance: Query P95 < 100ms, no queries > 1s
|
||||
- Resource Utilization: CPU < 70%, Memory < 80% under normal load
|
||||
- Cost Efficiency: Performance per dollar improved by minimum 30%
|
||||
- Monitoring Coverage: 100% of critical paths instrumented with alerting
|
||||
|
||||
- **Response Time**: P50 < 200ms, P95 < 1s, P99 < 2s for critical endpoints
|
||||
- **Core Web Vitals**: LCP < 2.5s, FID < 100ms, CLS < 0.1
|
||||
- **Throughput**: Support 2x current peak load with <1% error rate
|
||||
- **Database Performance**: Query P95 < 100ms, no queries > 1s
|
||||
- **Resource Utilization**: CPU < 70%, Memory < 80% under normal load
|
||||
- **Cost Efficiency**: Performance per dollar improved by minimum 30%
|
||||
- **Monitoring Coverage**: 100% of critical paths instrumented with alerting
|
||||
|
||||
Performance optimization target: $ARGUMENTS
|
||||
## Next Steps
|
||||
1. Implement optimizations in priority order from each phase
|
||||
2. Run regression tests after each optimization
|
||||
3. Monitor production metrics against baselines
|
||||
4. Review performance budgets in weekly cycles
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user