スキル一覧に戻る
yonatangross

performance-optimization

by yonatangross

The Complete AI Development Toolkit for Claude Code — 159 skills, 34 agents, 20 commands, 144 hooks. Production-ready patterns for FastAPI, React 19, LangGraph, security, and testing.

29🍴 4📅 2026年1月23日
GitHubで見るManusで実行

SKILL.md


name: Performance Optimization description: Use when application is slow, bundle is too large, or investigating performance issues. Performance optimization covers profiling, React concurrent features, bundle analysis, and optimization patterns. tags: [performance, optimization, profiling, caching] context: fork version: 1.2.0 category: Quality & Optimization agents: [backend-system-architect, frontend-ui-developer, code-quality-reviewer] keywords: [performance, optimization, speed, latency, throughput, caching, profiling, bundle, Core Web Vitals, react-19, virtualization, code-splitting, tree-shaking] author: OrchestKit user-invocable: false

Performance Optimization Skill

Comprehensive frameworks for analyzing and optimizing application performance across the entire stack.

Overview

  • 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)

MetricGoodNeeds 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

OperationTarget
Simple reads< 100ms
Complex queries< 500ms
Write operations< 200ms
Index lookups< 10ms

Bottleneck Categories

CategorySymptomsTools
NetworkHigh TTFB, slow loadingNetwork tab, WebPageTest
DatabaseSlow queries, pool exhaustionEXPLAIN ANALYZE, pg_stat_statements
CPUHigh usage, slow computeProfiler, flame graphs
MemoryLeaks, GC pausesHeap snapshots
RenderingLayout thrashingReact DevTools, Performance tab

Protocol References

Database Optimization

See: references/database-optimization.md

Key topics covered:

  • N+1 query detection and fixes with SQLAlchemy selectinload
  • Index selection strategies (B-tree, GIN, HNSW, Hash)
  • EXPLAIN ANALYZE interpretation
  • Connection pooling configuration
  • Cursor vs offset pagination

Caching Strategies

See: references/caching-strategies.md

Key topics covered:

  • Multi-level cache hierarchy (L1-L4)
  • Cache-aside and write-through patterns
  • Cache invalidation strategies (TTL, event-based, tag-based)
  • Redis patterns (strings, hashes, lists, sets)
  • Cache stampede prevention
  • HTTP caching headers and ETags

Core Web Vitals

See: references/core-web-vitals.md

Key topics covered:

  • LCP optimization (images, SSR, critical CSS)
  • INP optimization (debounce, Web Workers, task splitting)
  • CLS optimization (image dimensions, font loading)
  • Measuring with web-vitals library
  • Lighthouse auditing

Frontend Performance

See: references/frontend-performance.md

Key topics covered:

  • Code splitting with React.lazy()
  • Tree shaking and import optimization
  • Image optimization (WebP, AVIF, lazy loading)
  • Memoization (memo, useMemo, useCallback)
  • List virtualization with @tanstack/react-virtual
  • Bundle analysis tools

Profiling Tools

See: references/profiling.md

Key topics covered:

  • Python profiling (cProfile, py-spy, memory_profiler)
  • Chrome DevTools Performance and Memory tabs
  • React DevTools Profiler
  • PostgreSQL query profiling (pg_stat_statements)
  • Flame graph interpretation
  • Load testing with k6 and Locust

Quick Diagnostics

Database

-- 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;

Frontend

# Lighthouse audit
lighthouse http://localhost:3000 --output=json

# Bundle analysis
npx vite-bundle-visualizer  # Vite
ANALYZE=true npm run build  # Next.js

Backend

# Profile running FastAPI server
py-spy record --pid $(pgrep -f uvicorn) --output profile.svg

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)

Real-World Examples

Hybrid Search Optimization

Problem: Retrieval pass rate was 87.2%, needed >90%

Solution: Increased RRF fetch multiplier from 2x to 3x, added metadata boosting

Results:

  • Pass rate: 87.2% -> 91.6% (+5.1%)
  • MRR: 0.723 -> 0.777 (+7.4%)
  • Query time: 85ms -> 5ms (HNSW index)

LLM Response Caching

Problem: LLM costs projected at $35k/year

Solution: Multi-level cache hierarchy (Claude prompt cache + Redis semantic cache)

Results:

  • Baseline: $35k/year -> With caching: $2-5k/year
  • Cost reduction: 85-95%
  • Latency: 2000ms -> 5-10ms (semantic cache hit)

Vector Index Selection

Problem: Vector searches taking 85ms, needed <10ms

Solution: Switched from IVFFlat to HNSW index

Results:

  • Query time: 85ms -> 5ms (17x faster)
  • Trade-off: Slower indexing (8s vs 2s) for faster queries

Templates Reference

TemplatePurpose
database-optimization.tsN+1 fixes, pagination, pooling
caching-patterns.tsRedis cache-aside, memoization
frontend-optimization.tsxReact memo, virtualization, code splitting
api-optimization.tsCompression, ETags, field selection
performance-metrics.tsPrometheus metrics, performance budget

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

  • caching-strategies - Detailed Redis caching patterns and cache invalidation
  • database-schema-designer - Indexing strategies and query optimization fundamentals
  • observability-monitoring - Performance monitoring and alerting integration
  • devops-deployment - CDN configuration and infrastructure optimization

Key Decisions

DecisionChoiceRationale
Pagination strategyCursor-based for large datasetsStable performance regardless of offset, handles concurrent inserts
Vector index typeHNSW over IVFFlat17x faster queries, worth slower indexing for read-heavy workloads
Cache hierarchyMulti-level (L1-L4)Optimizes hit rates, reduces load on expensive operations
Bundle splittingRoute-based code splittingReduces initial load, enables parallel downloads

Skill Version: 1.2.0 Last Updated: 2026-01-15 Maintained by: AI Agent Hub Team

Changelog

v1.2.0 (2026-01-15)

  • Refactored to reference-based structure
  • Moved detailed content to references/ directory
  • Reduced SKILL.md from 1079 to ~290 lines

v1.1.0 (2025-12-25)

  • Added comprehensive Frontend Bundle Analysis section
  • Added React 19 performance patterns
  • Added TanStack Virtual list virtualization

v1.0.0 (2025-12-14)

  • Initial skill with database optimization, caching, and profiling

Capability Details

database-optimization

Keywords: slow query, n+1, query optimization, explain analyze, index, postgres performance Solves:

  • How do I optimize slow database queries?
  • Fix N+1 query problems with eager loading
  • Use EXPLAIN ANALYZE to diagnose queries
  • Add missing indexes for performance

caching-strategies

Keywords: cache, redis, cdn, cache-aside, write-through, semantic cache Solves:

  • How do I implement multi-level caching?
  • Cache-aside vs write-through patterns
  • Semantic cache for LLM responses
  • Cache invalidation strategies

frontend-performance

Keywords: bundle size, lazy load, code splitting, tree shaking, lighthouse, web vitals Solves:

  • How do I reduce frontend bundle size?
  • Implement code splitting with React.lazy()
  • Optimize Lighthouse scores
  • Fix Core Web Vitals issues

core-web-vitals

Keywords: lcp, inp, cls, core web vitals, ttfb, fid Solves:

  • How do I improve Core Web Vitals?
  • Optimize LCP (Largest Contentful Paint)
  • Fix CLS (Cumulative Layout Shift)
  • Improve INP (Interaction to Next Paint)

profiling

Keywords: profile, flame graph, py-spy, chrome devtools, memory leak, cpu bottleneck Solves:

  • How do I profile my Python backend?
  • Generate flame graphs with py-spy
  • Profile React components with DevTools
  • Find memory leaks in frontend

bundle-analysis

Keywords: bundle analyzer, vite visualizer, webpack bundle, tree shaking Solves:

  • How do I analyze bundle size?
  • Use Vite bundle visualizer
  • Identify large dependencies
  • Optimize bundle with tree shaking

スコア

総合スコア

75/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

+10
人気

GitHub Stars 100以上

0/15
最近の活動

1ヶ月以内に更新

+10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

レビュー

💬

レビュー機能は近日公開予定です