Performance Expert Skill
Backend, database, and infrastructure performance. This skill owns the
server-side and delivery-layer of a stack: request latency, data access,
caching, background work, and what ships over the wire.
Render-time work inside React components — re-renders, memoization,
virtualized lists, Profiler traces — is a different diagnosis with different
tooling. Route it to react-component-performance instead of duplicating it
here.
Contract
Inputs:
- A performance symptom with a surface: an endpoint, a query, a job, a build
output, or a metric that regressed.
Outputs:
- A ranked list of bottlenecks with the measurement that proves each one, plus
a targeted fix per bottleneck.
Creates/Modifies:
- None on its own. It diagnoses and prescribes; edits happen in the caller's
workflow.
External Side Effects:
- None. Profiling and load-testing commands are prescribed, not executed
unattended.
Delegates To:
react-component-performance for React render hotspots, re-render churn,
memoization, and Profiler-driven component work.
workspace-performance-audit when the target is a whole monorepo rather than
one surface.
When to Use
- Improving API response times
- Optimizing database queries, indexes, and aggregation pipelines
- Diagnosing N+1 query patterns
- Implementing caching strategies and invalidation
- Moving heavy work into background jobs or queues
- Profiling a server process or tracing a slow request
- Analyzing shipped bundle size and asset delivery
- Configuring CDN, cache headers, or edge caching
Project Context Discovery
- Check
.agents/memory/ for performance architecture context (e.g., any
*performance* or *architecture* files)
- Identify performance tools (APM, load-testing harness, profiler)
- Review existing optimizations and caching strategies
- Check for
[project]-performance-expert skill
Core Performance Principles
Backend
API Response Times: Target < 200ms (p95), caching, background jobs, connection pooling
Query Optimization: Indexes, projections, pagination, optimized aggregations
Background Processing: Queues for heavy operations, async for non-critical tasks, no blocking work in request handlers
Database
Indexes: On frequently queried fields, compound indexes, monitor usage
Queries: Filter early, project before expensive stages, sort with indexes, avoid full scans
Infrastructure
CDN: Edge caching, correct cache headers, static assets off the origin
Serverless: Cold start optimization, memory allocation, provisioned concurrency
Delivery Layer
Bundles: Code splitting by route, dynamic imports for heavy modules, tree shaking, drop unused dependencies
Assets: WebP images, subset fonts, minify CSS/JS, Gzip/Brotli compression
Server rendering: Static generation for static content, incremental revalidation, framework image and font pipelines
Performance Metrics
Backend
- API p50: < 100ms
- API p95: < 200ms
- DB Query p95: < 50ms
- Error Rate: < 0.1%
Delivery
- LCP: < 2.5s
- TTFB: < 800ms
- Initial bundle: < 200KB
Quick Checklist
Backend
Delivery
For database query optimization code, caching strategy implementation, N+1 query solutions, background-job patterns, infrastructure tuning, performance testing commands, and detailed checklists, see: references/full-guide.md
1---
2name: performance-expert
3description: >-
4 Backend, database, and infrastructure performance expert covering API
5 response times, query and index optimization, N+1 elimination, caching and
6 background jobs, server profiling, and build/asset delivery. Use when
7 improving API latency, optimizing database queries or indexes, designing a
8 caching layer, moving heavy work to a queue, profiling a server process,
9 shrinking a shipped bundle, or configuring CDN and edge caching. React render
10 and component work belongs to `react-component-performance`.
11metadata:
12 version: "1.1.0"
13 tags: "performance, optimization, backend, database, infrastructure"
14when_to_use: "slow API endpoint, high p95 latency, slow database query, missing index, N+1 queries, add caching, Redis cache strategy, move work to a background job, profile the server, connection pooling, bundle size too large, CDN and cache headers, cold starts, load testing"
15---
16
17# Performance Expert Skill
18
19Backend, database, and infrastructure performance. This skill owns the
20server-side and delivery-layer of a stack: request latency, data access,
21caching, background work, and what ships over the wire.
22
23Render-time work inside React components — re-renders, memoization,
24virtualized lists, Profiler traces — is a different diagnosis with different
25tooling. Route it to `react-component-performance` instead of duplicating it
26here.
27
28## Contract
29
30Inputs:
31
32- A performance symptom with a surface: an endpoint, a query, a job, a build
33 output, or a metric that regressed.
34
35Outputs:
36
37- A ranked list of bottlenecks with the measurement that proves each one, plus
38 a targeted fix per bottleneck.
39
40Creates/Modifies:
41
42- None on its own. It diagnoses and prescribes; edits happen in the caller's
43 workflow.
44
45External Side Effects:
46
47- None. Profiling and load-testing commands are prescribed, not executed
48 unattended.
49
50Delegates To:
51
52- `react-component-performance` for React render hotspots, re-render churn,
53 memoization, and Profiler-driven component work.
54- `workspace-performance-audit` when the target is a whole monorepo rather than
55 one surface.
56
57## When to Use
58
59- Improving API response times
60- Optimizing database queries, indexes, and aggregation pipelines
61- Diagnosing N+1 query patterns
62- Implementing caching strategies and invalidation
63- Moving heavy work into background jobs or queues
64- Profiling a server process or tracing a slow request
65- Analyzing shipped bundle size and asset delivery
66- Configuring CDN, cache headers, or edge caching
67
68## Project Context Discovery
69
701. Check `.agents/memory/` for performance architecture context (e.g., any
71 `*performance*` or `*architecture*` files)
722. Identify performance tools (APM, load-testing harness, profiler)
733. Review existing optimizations and caching strategies
744. Check for `[project]-performance-expert` skill
75
76## Core Performance Principles
77
78### Backend
79
80**API Response Times:** Target < 200ms (p95), caching, background jobs, connection pooling
81
82**Query Optimization:** Indexes, projections, pagination, optimized aggregations
83
84**Background Processing:** Queues for heavy operations, async for non-critical tasks, no blocking work in request handlers
85
86### Database
87
88**Indexes:** On frequently queried fields, compound indexes, monitor usage
89
90**Queries:** Filter early, project before expensive stages, sort with indexes, avoid full scans
91
92### Infrastructure
93
94**CDN:** Edge caching, correct cache headers, static assets off the origin
95
96**Serverless:** Cold start optimization, memory allocation, provisioned concurrency
97
98### Delivery Layer
99
100**Bundles:** Code splitting by route, dynamic imports for heavy modules, tree shaking, drop unused dependencies
101
102**Assets:** WebP images, subset fonts, minify CSS/JS, Gzip/Brotli compression
103
104**Server rendering:** Static generation for static content, incremental revalidation, framework image and font pipelines
105
106## Performance Metrics
107
108### Backend
109
110- **API p50:** < 100ms
111- **API p95:** < 200ms
112- **DB Query p95:** < 50ms
113- **Error Rate:** < 0.1%
114
115### Delivery
116
117- **LCP:** < 2.5s
118- **TTFB:** < 800ms
119- **Initial bundle:** < 200KB
120
121## Quick Checklist
122
123### Backend
124
125- [ ] Database queries optimized
126- [ ] Indexes created and used
127- [ ] Caching implemented
128- [ ] Background jobs for heavy operations
129- [ ] Connection pooling configured
130
131### Delivery
132
133- [ ] Bundle size < 200KB initial
134- [ ] Code splitting implemented
135- [ ] Images optimized and lazy loaded
136- [ ] Compression and cache headers configured
137
138---
139
140**For database query optimization code, caching strategy implementation, N+1 query solutions, background-job patterns, infrastructure tuning, performance testing commands, and detailed checklists, see:** `references/full-guide.md`