performance-optimization
Full-stack performance analysis, optimization patterns, and monitoring strategies
Best use case
performance-optimization is best used when you need a repeatable AI agent workflow instead of a one-off prompt. It is especially useful for teams working in multi. Full-stack performance analysis, optimization patterns, and monitoring strategies
Full-stack performance analysis, optimization patterns, and monitoring strategies
Users should expect a more consistent workflow output, faster repeated execution, and less time spent rewriting prompts from scratch.
Practical example
Example input
Use the "performance-optimization" skill to help with this workflow task. Context: Full-stack performance analysis, optimization patterns, and monitoring strategies
Example output
A structured workflow result with clearer steps, more consistent formatting, and an output that is easier to reuse in the next run.
When to use this skill
- Use this skill when you want a reusable workflow rather than writing the same prompt again and again.
When not to use this skill
- Do not use this when you only need a one-off answer and do not need a reusable workflow.
- Do not use it if you cannot install or maintain the related files, repository context, or supporting tools.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/performance-optimization/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How performance-optimization Compares
| Feature / Agent | performance-optimization | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Full-stack performance analysis, optimization patterns, and monitoring strategies
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Performance Optimization Skill Comprehensive frameworks for analyzing and optimizing application performance across the entire stack. ## When to Use - Application feels slow or unresponsive - Database queries taking too long - Frontend bundle size too large - API response times exceed targets - Core Web Vitals need improvement - Preparing for scale or high traffic ## Performance Targets ### Core Web Vitals (Frontend) | Metric | Good | Needs Work | |--------|------|------------| | **LCP** (Largest Contentful Paint) | < 2.5s | < 4s | | **INP** (Interaction to Next Paint) | < 200ms | < 500ms | | **CLS** (Cumulative Layout Shift) | < 0.1 | < 0.25 | | **TTFB** (Time to First Byte) | < 200ms | < 600ms | ### Backend Targets | Operation | Target | |-----------|--------| | Simple reads | < 100ms | | Complex queries | < 500ms | | Write operations | < 200ms | | Index lookups | < 10ms | ## Bottleneck Categories | Category | Symptoms | Tools | |----------|----------|-------| | **Network** | High TTFB, slow loading | Network tab, WebPageTest | | **Database** | Slow queries, pool exhaustion | EXPLAIN ANALYZE, pg_stat_statements | | **CPU** | High usage, slow compute | Profiler, flame graphs | | **Memory** | Leaks, GC pauses | Heap snapshots | | **Rendering** | Layout thrashing | React DevTools, Performance tab | ## Database Optimization ### Key Patterns 1. **Add Missing Indexes** - Turn `Seq Scan` into `Index Scan` 2. **Fix N+1 Queries** - Use JOINs or `include` instead of loops 3. **Cursor Pagination** - Never load all records 4. **Connection Pooling** - Manage connection lifecycle ### Quick Diagnostics ```sql -- Find slow queries (PostgreSQL) SELECT query, calls, mean_time / 1000 as mean_seconds FROM pg_stat_statements ORDER BY total_time DESC LIMIT 10; -- Verify index usage EXPLAIN ANALYZE SELECT * FROM orders WHERE user_id = 123; ``` > See `templates/database-optimization.ts` for N+1 fixes and pagination patterns ## Caching Strategy ### Cache Hierarchy ``` L1: In-Memory (LRU, memoization) - fastest L2: Distributed (Redis/Memcached) - shared L3: CDN (edge, static assets) - global L4: Database (materialized views) - fallback ``` ### Cache-Aside Pattern ```typescript const cached = await redis.get(key); if (cached) return JSON.parse(cached); const data = await db.query(...); await redis.setex(key, 3600, JSON.stringify(data)); return data; ``` > See `templates/caching-patterns.ts` for full implementation ## Frontend Optimization ### Bundle Optimization 1. **Code Splitting** - `lazy()` for route-based splitting 2. **Tree Shaking** - Import only what you need 3. **Image Optimization** - WebP/AVIF, lazy loading, proper sizing ### Rendering Optimization 1. **Memoization** - `memo()`, `useCallback()`, `useMemo()` 2. **Virtualization** - Render only visible items in long lists 3. **Batch DOM Operations** - Read all, then write all > See `templates/frontend-optimization.tsx` for patterns ### Analysis Commands ```bash # Lighthouse audit lighthouse http://localhost:3000 --output=json # Bundle analysis npx @next/bundle-analyzer # Next.js npx vite-bundle-visualizer # Vite ``` ## API Optimization ### Response Optimization 1. **Field Selection** - Return only requested fields 2. **Compression** - Enable gzip/brotli (threshold: 1KB) 3. **ETags** - Enable 304 responses for unchanged data 4. **Pagination** - Cursor-based for large datasets > See `templates/api-optimization.ts` for middleware examples ## Monitoring Checklist ### Before Launch - [ ] Lighthouse score > 90 - [ ] Core Web Vitals pass - [ ] Bundle size within budget - [ ] Database queries profiled - [ ] Compression enabled - [ ] CDN configured ### Ongoing - [ ] Performance monitoring active - [ ] Alerting for degradation - [ ] Lighthouse CI in pipeline - [ ] Weekly query analysis - [ ] Real User Monitoring (RUM) > See `templates/performance-metrics.ts` for Prometheus metrics setup ## Extended Thinking Triggers Use Opus 4.5 extended thinking for: - **Complex debugging** - Multiple potential causes - **Architecture decisions** - Caching strategy selection - **Trade-off analysis** - Memory vs CPU vs latency - **Root cause analysis** - Performance regression investigation ## Templates Reference | Template | Purpose | |----------|---------| | `database-optimization.ts` | N+1 fixes, pagination, pooling | | `caching-patterns.ts` | Redis cache-aside, memoization | | `frontend-optimization.tsx` | React memo, virtualization, code splitting | | `api-optimization.ts` | Compression, ETags, field selection | | `performance-metrics.ts` | Prometheus metrics, performance budget |
Related Skills
web-performance-seo
Fix PageSpeed Insights/Lighthouse accessibility "!" errors caused by contrast audit failures (CSS filters, OKLCH/OKLAB, low opacity, gradient text, image backgrounds). Use for accessibility-driven SEO/performance debugging and remediation.
web-performance-optimization
Optimize website and web application performance including loading speed, Core Web Vitals, bundle size, caching strategies, and runtime performance
sql-optimization-patterns
Master SQL query optimization, indexing strategies, and EXPLAIN analysis to dramatically improve database performance and eliminate slow queries. Use when debugging slow queries, designing database schemas, or optimizing application performance.
spark-optimization
Optimize Apache Spark jobs with partitioning, caching, shuffle optimization, and memory tuning. Use when improving Spark performance, debugging slow jobs, or scaling data processing pipelines.
postgresql-optimization
PostgreSQL database optimization workflow for query tuning, indexing strategies, performance analysis, and production database management.
performance-testing-review-multi-agent-review
Use when working with performance testing review multi agent review
performance-testing-review-ai-review
You are an expert AI-powered code review specialist combining automated static analysis, intelligent pattern recognition, and modern DevOps practices. Leverage AI tools (GitHub Copilot, Qodo, GPT-5, C
performance-profiling
Performance profiling principles. Measurement, analysis, and optimization techniques.
performance-engineer
Expert performance engineer specializing in modern observability, application optimization, and scalable system performance. Masters OpenTelemetry, distributed tracing, load testing, multi-tier caching, Core Web Vitals, and performance monitoring. Handles end-to-end optimization, real user monitoring, and scalability patterns. Use PROACTIVELY for performance optimization, observability, or scalability challenges.
database-cloud-optimization-cost-optimize
You are a cloud cost optimization expert specializing in reducing infrastructure expenses while maintaining performance and reliability. Analyze cloud spending, identify savings opportunities, and implement cost-effective architectures across AWS, Azure, and GCP.
cost-optimization
Optimize cloud costs through resource rightsizing, tagging strategies, reserved instances, and spending analysis. Use when reducing cloud expenses, analyzing infrastructure costs, or implementing cost governance policies.
bazel-build-optimization
Optimize Bazel builds for large-scale monorepos. Use when configuring Bazel, implementing remote execution, or optimizing build performance for enterprise codebases.