[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6GSKWEFT5QBKKRFVD72BRSG":3,"skill-same:01M6GSKWEFT5QBKKRFVD72BRSG":75},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":26,"publishedAt":50,"linkOnly":51,"markdownContent":52,"markdownBody":53,"frontMatter":54,"refName":55,"commitSha":56,"skillDirectory":57,"forksCount":14,"repositoryHtmlUrl":58,"repositoryHomepageUrl":6,"ownerHtmlUrl":59,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":60,"install":61,"resources":74},"01M6GSKWEFT5QBKKRFVD72BRSG","addy-performance-optimization",null,"Optimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks.","japurcell\u002Fskills","japurcell","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F10947458?v=4","01M6GSJK1YAG95R6VHF47V30KY","Adam Purcell","01M6GSJK6817NVR5FVDMFFNJ6H",0,"MIT","https:\u002F\u002Fgithub.com\u002Fjapurcell\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fdefault\u002Faddy-performance-optimization\u002FSKILL.md",[18,23],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000009","前端开发","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000010","后端与接口",[27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49],"performance","Optimization","performance optimization","addy performance optimization","when","frontend","vitals","improvement","load","you","web vitals","requirements","across","query","patterns","queries","databases","backend","use","profiling","core web vitals","core","web","2026-11-10 10:12:30",false,"---\nname: addy-performance-optimization\ndescription: Optimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks.\n---\n\n# Performance Optimization\n\n## Overview\n\nMeasure before optimizing. Performance work without measurement is guessing — and guessing leads to premature optimization that adds complexity without improving what matters. Profile first, identify the actual bottleneck, fix it, measure again. Optimize only what measurements prove matters.\n\n## When to Use\n\n- Performance requirements exist in the spec (load time budgets, response time SLAs)\n- Users or monitoring report slow behavior\n- Core Web Vitals scores are below thresholds\n- You suspect a change introduced a regression\n- Building features that handle large datasets or high traffic\n\n**When NOT to use:** Don't optimize before you have evidence of a problem. Premature optimization adds complexity that costs more than the performance it gains.\n\n## Core Web Vitals Targets\n\n| Metric | Good | Needs Improvement | Poor |\n|--------|------|-------------------|------|\n| **LCP** (Largest Contentful Paint) | ≤ 2.5s | ≤ 4.0s | > 4.0s |\n| **INP** (Interaction to Next Paint) | ≤ 200ms | ≤ 500ms | > 500ms |\n| **CLS** (Cumulative Layout Shift) | ≤ 0.1 | ≤ 0.25 | > 0.25 |\n\n## The Optimization Workflow\n\n```\n1. MEASURE  → Establish baseline with real data\n2. IDENTIFY → Find the actual bottleneck (not assumed)\n3. FIX      → Address the specific bottleneck\n4. VERIFY   → Measure again; keep or revert\n5. GUARD    → Add monitoring or tests to prevent regression\n```\n\n### Step 1: Measure\n\nTwo complementary approaches — use both:\n\n- **Synthetic (Lighthouse, DevTools Performance tab):** Controlled conditions, reproducible. Best for CI regression detection and isolating specific issues.\n- **RUM (web-vitals library, CrUX):** Real user data in real conditions. Required to validate that a fix actually improved user experience.\n\n**Frontend:**\n```bash\n# Synthetic: Lighthouse in Chrome DevTools (or CI)\n# Chrome DevTools → Performance tab → Record\n# Chrome DevTools MCP → Performance trace\n\n# RUM: Web Vitals library in code\nimport { onLCP, onINP, onCLS } from 'web-vitals';\n\nonLCP(console.log);\nonINP(console.log);\nonCLS(console.log);\n```\n\n**Backend:**\n```bash\n# Response time logging\n# Application Performance Monitoring (APM)\n# Database query logging with timing\n\n# Simple timing\nconsole.time('db-query');\nconst result = await db.query(...);\nconsole.timeEnd('db-query');\n```\n\n### Where to Start Measuring\n\nUse the symptom to decide what to measure first:\n\n```\nWhat is slow?\n├── First page load\n│   ├── Large bundle? --> Measure bundle size, check code splitting\n│   ├── Slow server response? --> Measure TTFB in DevTools Network waterfall\n│   │   ├── DNS long? --> Add dns-prefetch \u002F preconnect for known origins\n│   │   ├── TCP\u002FTLS long? --> Enable HTTP\u002F2, check edge deployment, keep-alive\n│   │   └── Waiting (server) long? --> Profile backend, check queries and caching\n│   └── Render-blocking resources? --> Check network waterfall for CSS\u002FJS blocking\n├── Interaction feels sluggish\n│   ├── UI freezes on click? --> Profile main thread, look for long tasks (>50ms)\n│   ├── Form input lag? --> Check re-renders, controlled component overhead\n│   └── Animation jank? --> Check layout thrashing, forced reflows\n├── Page after navigation\n│   ├── Data loading? --> Measure API response times, check for waterfalls\n│   └── Client rendering? --> Profile component render time, check for N+1 fetches\n└── Backend \u002F API\n    ├── Single endpoint slow? --> Profile database queries, check indexes\n    ├── All endpoints slow? --> Check connection pool, memory, CPU\n    └── Intermittent slowness? --> Check for lock contention, GC pauses, external deps\n```\n\n### Step 2: Identify the Bottleneck\n\nCommon bottlenecks by category:\n\n**Frontend:**\n\n| Symptom | Likely Cause | Investigation |\n|---------|-------------|---------------|\n| Slow LCP | Large images, render-blocking resources, slow server | Check network waterfall, image sizes |\n| High CLS | Images without dimensions, late-loading content, font shifts | Check layout shift attribution |\n| Poor INP | Heavy JavaScript on main thread, large DOM updates | Check long tasks in Performance trace |\n| Slow initial load | Large bundle, many network requests | Check bundle size, code splitting |\n\n**Backend:**\n\n| Symptom | Likely Cause | Investigation |\n|---------|-------------|---------------|\n| Slow API responses | N+1 queries, missing indexes, unoptimized queries | Check database query log |\n| Memory growth | Leaked references, unbounded caches, large payloads | Heap snapshot analysis |\n| CPU spikes | Synchronous heavy computation, regex backtracking | CPU profiling |\n| High latency | Missing caching, redundant computation, network hops | Trace requests through the stack |\n\n### Step 3: Fix Common Anti-Patterns\n\n#### N+1 Queries (Backend)\n\n```typescript\n\u002F\u002F BAD: N+1 — one query per task for the owner\nconst tasks = await db.tasks.findMany();\nfor (const task of tasks) {\n  task.owner = await db.users.findUnique({ where: { id: task.ownerId } });\n}\n\n\u002F\u002F GOOD: Single query with join\u002Finclude\nconst tasks = await db.tasks.findMany({\n  include: { owner: true },\n});\n```\n\n#### Unbounded Data Fetching\n\n```typescript\n\u002F\u002F BAD: Fetching all records\nconst allTasks = await db.tasks.findMany();\n\n\u002F\u002F GOOD: Paginated with limits\nconst tasks = await db.tasks.findMany({\n  take: 20,\n  skip: (page - 1) * 20,\n  orderBy: { createdAt: 'desc' },\n});\n```\n\n#### Queries That Ignore Their Index\n\n\"Add an index\" is the guess. The query plan is the measurement:\n\n```sql\nEXPLAIN ANALYZE\nSELECT id, title FROM tasks\nWHERE owner_id = 42 ORDER BY created_at DESC LIMIT 20;\n```\n\nThree things in the output decide the fix:\n\n| What you see | What it means |\n|---|---|\n| `Seq Scan` on a large table where you expected an index | No usable index for this predicate |\n| Estimated `rows=` off from actual by an order of magnitude | Stale statistics; the planner is choosing on bad information |\n| A `Sort` node above the scan | The index covers the filter but not the `ORDER BY` |\n\nIndex for the **shape of the query**, not the column in isolation. In a composite index, equality columns come first, then the range or sort column:\n\n```sql\nCREATE INDEX idx_tasks_owner_created ON tasks (owner_id, created_at DESC);\n```\n\n**When an index will not help:**\n\n| Situation | Why |\n|---|---|\n| Low selectivity, querying the dominant value (a `status` column that is 95% `active`, filtered on `active`) | A sequential scan is genuinely cheaper; the planner will ignore the index. Filtering on the rare value is the opposite case, and a partial index serves it well |\n| Leading wildcard (`LIKE '%term'`) | A B-tree cannot seek without a prefix; needs trigram or full-text |\n| Function on the column (`WHERE lower(email) = ?`) | The plain column index is unusable; index the expression instead |\n| Write-heavy table | Every index is a tax on every `INSERT`\u002F`UPDATE`; measure the write cost, not just the read gain |\n\nRe-run `EXPLAIN ANALYZE` after. An index that did not change the plan is a revert (Step 4), and it is not free: it still costs on every write.\n\n#### Connection Pool Exhaustion\n\nThe signature is distinctive: **every** endpoint slows at once, the slow time is spent waiting for a connection rather than executing, and the database reports mostly idle sessions.\n\n```typescript\n\u002F\u002F BAD: a pool per request or per module — under serverless this multiplies\n\u002F\u002F by instance count and exhausts the database's connection limit\n\u002F\u002F GOOD: one pool per process, sized against the database's ceiling\nconst pool = new Pool({\n  max: 10,                        \u002F\u002F instances × max must stay under max_connections\n  idleTimeoutMillis: 30_000,\n  connectionTimeoutMillis: 5_000, \u002F\u002F fail fast instead of queueing forever\n});\n```\n\n**Bigger is not faster.** A pool larger than what the database can execute concurrently just relocates the queue from your app to the database, where it is harder to see. When instance count is unbounded (serverless, autoscaling), a proxy that multiplexes connections (pgbouncer, RDS Proxy) is the fix, not a higher `max`.\n\n#### Missing Image Optimization (Frontend)\n\n```html\n\u003C!-- BAD: No dimensions, no format optimization -->\n\u003Cimg src=\"\u002Fhero.jpg\" \u002F>\n\n\u003C!-- GOOD: Hero \u002F LCP image — art direction + resolution switching, high priority -->\n\u003C!--\n  Two techniques combined:\n  - Art direction (media): different crop\u002Fcomposition per breakpoint\n  - Resolution switching (srcset + sizes): right file size per screen density\n-->\n\u003Cpicture>\n  \u003C!-- Mobile: portrait crop (8:10) -->\n  \u003Csource\n    media=\"(max-width: 767px)\"\n    srcset=\"\u002Fhero-mobile-400.avif 400w, \u002Fhero-mobile-800.avif 800w\"\n    sizes=\"100vw\"\n    width=\"800\"\n    height=\"1000\"\n    type=\"image\u002Favif\"\n  \u002F>\n  \u003Csource\n    media=\"(max-width: 767px)\"\n    srcset=\"\u002Fhero-mobile-400.webp 400w, \u002Fhero-mobile-800.webp 800w\"\n    sizes=\"100vw\"\n    width=\"800\"\n    height=\"1000\"\n    type=\"image\u002Fwebp\"\n  \u002F>\n  \u003C!-- Desktop: landscape crop (2:1) -->\n  \u003Csource\n    srcset=\"\u002Fhero-800.avif 800w, \u002Fhero-1200.avif 1200w, \u002Fhero-1600.avif 1600w\"\n    sizes=\"(max-width: 1200px) 100vw, 1200px\"\n    width=\"1200\"\n    height=\"600\"\n    type=\"image\u002Favif\"\n  \u002F>\n  \u003Csource\n    srcset=\"\u002Fhero-800.webp 800w, \u002Fhero-1200.webp 1200w, \u002Fhero-1600.webp 1600w\"\n    sizes=\"(max-width: 1200px) 100vw, 1200px\"\n    width=\"1200\"\n    height=\"600\"\n    type=\"image\u002Fwebp\"\n  \u002F>\n  \u003Cimg\n    src=\"\u002Fhero-desktop.jpg\"\n    width=\"1200\"\n    height=\"600\"\n    fetchpriority=\"high\"\n    alt=\"Hero image description\"\n  \u002F>\n\u003C\u002Fpicture>\n\n\u003C!-- GOOD: Below-the-fold image — lazy loaded + async decoding -->\n\u003Cimg\n  src=\"\u002Fcontent.webp\"\n  width=\"800\"\n  height=\"400\"\n  loading=\"lazy\"\n  decoding=\"async\"\n  alt=\"Content image description\"\n\u002F>\n```\n\n#### Unnecessary Re-renders (React)\n\n```tsx\n\u002F\u002F BAD: Creates new object on every render, causing children to re-render\nfunction TaskList() {\n  return \u003CTaskFilters options={{ sortBy: 'date', order: 'desc' }} \u002F>;\n}\n\n\u002F\u002F GOOD: Stable reference\nconst DEFAULT_OPTIONS = { sortBy: 'date', order: 'desc' } as const;\nfunction TaskList() {\n  return \u003CTaskFilters options={DEFAULT_OPTIONS} \u002F>;\n}\n\n\u002F\u002F Use React.memo for expensive components\nconst TaskItem = React.memo(function TaskItem({ task }: Props) {\n  return \u003Cdiv>{\u002F* expensive render *\u002F}\u003C\u002Fdiv>;\n});\n\n\u002F\u002F Use useMemo for expensive computations\nfunction TaskStats({ tasks }: Props) {\n  const stats = useMemo(() => calculateStats(tasks), [tasks]);\n  return \u003Cdiv>{stats.completed} \u002F {stats.total}\u003C\u002Fdiv>;\n}\n```\n\n#### Large Bundle Size\n\n```typescript\n\u002F\u002F Modern bundlers (Vite, webpack 5+) handle named imports with tree-shaking automatically,\n\u002F\u002F provided the dependency ships ESM and is marked `sideEffects: false` in package.json.\n\u002F\u002F Profile before changing import styles — the real gains come from splitting and lazy loading.\n\n\u002F\u002F GOOD: Dynamic import for heavy, rarely-used features\nconst ChartLibrary = lazy(() => import('.\u002FChartLibrary'));\n\n\u002F\u002F GOOD: Route-level code splitting wrapped in Suspense\nconst SettingsPage = lazy(() => import('.\u002Fpages\u002FSettings'));\n\nfunction App() {\n  return (\n    \u003CSuspense fallback={\u003CSpinner \u002F>}>\n      \u003CSettingsPage \u002F>\n    \u003C\u002FSuspense>\n  );\n}\n```\n\n#### Missing Caching (Backend)\n\nCache what is expensive to produce and read far more often than it changes. Caching a query that was already fast adds a network hop, a staleness bug, and an eviction policy to maintain, in exchange for nothing.\n\n**Pick the layer deliberately:**\n\n| Layer | Visible to | Use when | Cost |\n|---|---|---|---|\n| In-process (`Map`, LRU) | One instance | Small, hot, per-instance staleness is acceptable | Each instance drifts independently; invalidation reaches only one |\n| Shared (Redis, Memcached) | All instances | Instances must agree, or the value is expensive to recompute | A network hop, and another service to run and monitor |\n| CDN \u002F edge | Everyone, per URL | Responses are public and identical for a given key | Invalidation is the hard part; assume you cannot recall a bad response quickly |\n\n```typescript\n\u002F\u002F Cache frequently-read, rarely-changed data\nconst CACHE_TTL = 5 * 60 * 1000; \u002F\u002F 5 minutes\nlet cachedConfig: AppConfig | null = null;\nlet cacheExpiry = 0;\n\nasync function getAppConfig(): Promise\u003CAppConfig> {\n  if (cachedConfig && Date.now() \u003C cacheExpiry) {\n    return cachedConfig;\n  }\n  cachedConfig = await db.config.findFirst();\n  cacheExpiry = Date.now() + CACHE_TTL;\n  return cachedConfig;\n}\n\n\u002F\u002F HTTP caching headers for static assets\napp.use('\u002Fstatic', express.static('public', {\n  maxAge: '1y',           \u002F\u002F Cache for 1 year\n  immutable: true,        \u002F\u002F Never revalidate (use content hashing in filenames)\n}));\n\n\u002F\u002F Cache-Control for API responses\nres.set('Cache-Control', 'public, max-age=300'); \u002F\u002F 5 minutes\n```\n\n**Key design decides correctness.** Every input that changes the response belongs in the key: tenant, locale, permissions, feature flags. A key that omits the viewer is how one user's data gets served to another, and that ships as a performance win.\n\n**Choose one invalidation strategy, not three:**\n\n| Strategy | Trade-off |\n|---|---|\n| TTL | Simplest. You accept staleness up to the TTL, so state the acceptable window explicitly |\n| Event or tag based | Fresh on write, but writers now have to know the cache topology |\n| Versioned keys (`user:42:profile:v7`) | Never invalidate, just stop reading old keys. Costs memory until eviction |\n\n**Guard against the stampede.** A hot key expires, every concurrent request misses together, and the origin takes the full load at once, which is how a cache turns into an outage instead of preventing one. Serve stale while a single request recomputes (`stale-while-revalidate`), or coalesce concurrent misses behind one in-flight promise so N waiters cause one recompute.\n\n**Do not cache:** anything whose staleness is a correctness bug (balances, permissions, inventory at checkout), or per-user data under a key that does not identify the user. See `..\u002F..\u002F..\u002Freferences\u002Fperformance-checklist.md` for request coalescing, write strategies, negative caching, and the cache checklist.\n\n### Step 4: Verify (Keep or Revert)\n\nA fix is a hypothesis until you re-measure. This step decides whether it survives.\n\n**Re-measure the way you measured the baseline:** same command, same conditions, same fixed budget (wall-clock, sample count, or request count). A baseline taken on a cold cache against a result taken on a warm one measures the cache, not your change.\n\n**Change one thing at a time.** Three optimizations landed together produce one number, and you cannot attribute it. If they must ship together, measure each in isolation first.\n\n**Beat the noise, not just the mean.** Repeat the measurement and compare the delta against run-to-run variance. A 3% gain inside ±5% variance is not a gain; it is a different sample.\n\n**Qualify cache and contention evidence.** A first-process sample does not clear operating-system or standard-library caches. One concurrency batch does not establish a stable contention p95. Repeat comparable runs, keep those evidence classes separate, and derive acceptance targets from observed variation and the headroom before the applicable timeout.\n\nThen decide, strictly:\n\n| Result vs. baseline | Action |\n|---|---|\n| Past the threshold, tests green | **Keep.** Commit with the before\u002Fafter numbers in the message. |\n| Within noise (no measurable change) | **Revert.** |\n| Worse | **Revert.** |\n| Improved, but a test went red | **Revert.** A regression wearing a win's clothing. |\n\n**\"Neutral\" is a revert, not a keep.** This is the step teams skip: the change is already written, throwing it away feels wasteful, so it lands unmeasured, and the codebase accretes complexity that never bought anything. Code you keep, you maintain forever. Make it pay for itself.\n\n**Correctness gates the metric.** The suite stays green *and* the number moves. An \"optimization\" that wins by dropping work the product needed (skipping a validation, caching something that must be fresh, removing an `await` that was load-bearing) is a regression, not a win.\n\n#### Log every attempt, including the reverted ones\n\nReverted work leaves no trace in git history, which is exactly why the same dead idea gets tried again next quarter. Keep a short ledger so a discarded idea stays discarded:\n\n| Idea | Baseline → Result | Verdict | Why |\n|---|---|---|---|\n| Memoize the row component | INP 240ms → 235ms | reverted | Inside noise (±15ms). Rows weren't the bottleneck. |\n| Virtualize the list | INP 240ms → 90ms | kept | Long tasks gone from the trace. |\n| Preconnect to the API origin | LCP 2.8s → 2.8s | reverted | Already same-origin. |\n\nA section in the PR description or a `PERF.md` in the repo both work. What matters is that the next person (or the next agent) reads it before proposing an experiment, and doesn't re-run one that already failed.\n\n### Step 5: Guard Against Regression\n\nGuard the metric the user actually feels, not every available number. Use the\nsame LCP, INP, p95 latency, or other primary metric that justified the fix.\n\nUse two complementary layers when the surface is user-facing:\n\n- **Synthetic CI gate:** Catch reproducible regressions before merge with a\n  performance budget. Repeat noisy measurements or compare a median\u002Ftrend so\n  normal run-to-run variance does not turn the gate into a flaky check.\n- **Field monitoring:** Alert on a meaningful p75 movement in RUM data. Use\n  attributed `web-vitals` data to locate the cause; treat CrUX's rolling window\n  as confirmation rather than an immediate alert.\n\nWhen either guard fires, return to Step 1 and establish a fresh baseline before\nproposing another fix.\n\n**Set budgets and enforce them:**\n\n```\nJavaScript bundle: \u003C 200KB gzipped (initial load)\nCSS: \u003C 50KB gzipped\nImages: \u003C 200KB per image (above the fold)\nFonts: \u003C 100KB total\nAPI response time: \u003C 200ms (p95)\nTime to Interactive: \u003C 3.5s on 4G\nLighthouse Performance score: ≥ 90\n```\n\n**Enforce in CI:**\n```bash\n# Bundle size check\nnpx bundlesize --config bundlesize.config.json\n\n# Lighthouse CI\nnpx lhci autorun\n```\n\n## See Also\n\nFor detailed performance checklists, optimization commands, and anti-pattern reference, see `..\u002F..\u002F..\u002Freferences\u002Fperformance-checklist.md`.\n\n\n## Common Rationalizations\n\n| Rationalization | Reality |\n|---|---|\n| \"We'll optimize later\" | Performance debt compounds. Fix obvious anti-patterns now, defer micro-optimizations. |\n| \"It's fast on my machine\" | Your machine isn't the user's. Profile on representative hardware and networks. |\n| \"This optimization is obvious\" | If you didn't measure, you don't know. Profile first. |\n| \"Users won't notice 100ms\" | Research shows 100ms delays impact conversion rates. Users notice more than you think. |\n| \"The framework handles performance\" | Frameworks prevent some issues but can't fix N+1 queries or oversized bundles. |\n| \"The query is slow, add an index\" | Read the plan first. The index may already exist and be unusable, and every index taxes writes forever. |\n| \"Just cache it\" | Caching an already-cheap call buys nothing and adds a staleness bug. Cache what is expensive *and* re-read far more than written. |\n| \"Raise the pool size, we're running out of connections\" | A pool bigger than the database can serve moves the queue somewhere less visible. Find what holds connections. |\n| \"It didn't help much, but it doesn't hurt\" | Neutral changes are a revert. You pay maintenance on them forever and got nothing back. |\n| \"We already wrote it, may as well keep it\" | Sunk cost. The measurement doesn't care how long the change took to write. |\n| \"The improvement is obvious, no need to re-measure\" | Then re-measuring is cheap and proves it. Unmeasured wins are how neutral complexity lands. |\n\n## Red Flags\n\n- Optimization without profiling data to justify it\n- N+1 query patterns in data fetching\n- An index added without a query plan before and after to justify it\n- A cache key that omits an input the response depends on (tenant, locale, viewer)\n- A cache with no stated staleness window and no invalidation strategy\n- Connection pool size raised in response to exhaustion, without finding what holds connections\n- List endpoints without pagination\n- Images without dimensions, lazy loading, or responsive sizes\n- Bundle size growing without review\n- No performance monitoring in production\n- `React.memo` and `useMemo` everywhere (overusing is as bad as underusing)\n- Optimizations kept without a re-measurement that justifies them\n- Several optimizations bundled into one measurement, so no single change can be attributed\n- A \"win\" that required a test to be changed, skipped, or deleted\n- The same failed optimization attempted more than once because nobody recorded the first attempt\n\n## Verification\n\nAfter any performance-related change:\n\n- [ ] Before and after measurements exist (specific numbers)\n- [ ] The result was re-measured the same way as the baseline (same command, same conditions)\n- [ ] The improvement exceeds run-to-run variance, not just the mean\n- [ ] Changes that didn't beat the baseline were reverted, not kept as neutral\n- [ ] Attempts are logged, kept and reverted alike, so a dead idea isn't re-run\n- [ ] The specific bottleneck is identified and addressed\n- [ ] Core Web Vitals are within \"Good\" thresholds\n- [ ] Bundle size hasn't increased significantly\n- [ ] No N+1 queries in new data fetching code\n- [ ] Any new index is justified by a query plan before and after, and its write cost was considered\n- [ ] Any new cache states what it keys on and how it goes stale\n- [ ] The measured user-facing metric has a synthetic budget or field monitor that can detect regression\n- [ ] Existing tests still pass (optimization didn't break behavior)\n","# Performance Optimization\n\n## Overview\n\nMeasure before optimizing. Performance work without measurement is guessing — and guessing leads to premature optimization that adds complexity without improving what matters. Profile first, identify the actual bottleneck, fix it, measure again. Optimize only what measurements prove matters.\n\n## When to Use\n\n- Performance requirements exist in the spec (load time budgets, response time SLAs)\n- Users or monitoring report slow behavior\n- Core Web Vitals scores are below thresholds\n- You suspect a change introduced a regression\n- Building features that handle large datasets or high traffic\n\n**When NOT to use:** Don't optimize before you have evidence of a problem. Premature optimization adds complexity that costs more than the performance it gains.\n\n## Core Web Vitals Targets\n\n| Metric | Good | Needs Improvement | Poor |\n|--------|------|-------------------|------|\n| **LCP** (Largest Contentful Paint) | ≤ 2.5s | ≤ 4.0s | > 4.0s |\n| **INP** (Interaction to Next Paint) | ≤ 200ms | ≤ 500ms | > 500ms |\n| **CLS** (Cumulative Layout Shift) | ≤ 0.1 | ≤ 0.25 | > 0.25 |\n\n## The Optimization Workflow\n\n```\n1. MEASURE  → Establish baseline with real data\n2. IDENTIFY → Find the actual bottleneck (not assumed)\n3. FIX      → Address the specific bottleneck\n4. VERIFY   → Measure again; keep or revert\n5. GUARD    → Add monitoring or tests to prevent regression\n```\n\n### Step 1: Measure\n\nTwo complementary approaches — use both:\n\n- **Synthetic (Lighthouse, DevTools Performance tab):** Controlled conditions, reproducible. Best for CI regression detection and isolating specific issues.\n- **RUM (web-vitals library, CrUX):** Real user data in real conditions. Required to validate that a fix actually improved user experience.\n\n**Frontend:**\n```bash\n# Synthetic: Lighthouse in Chrome DevTools (or CI)\n# Chrome DevTools → Performance tab → Record\n# Chrome DevTools MCP → Performance trace\n\n# RUM: Web Vitals library in code\nimport { onLCP, onINP, onCLS } from 'web-vitals';\n\nonLCP(console.log);\nonINP(console.log);\nonCLS(console.log);\n```\n\n**Backend:**\n```bash\n# Response time logging\n# Application Performance Monitoring (APM)\n# Database query logging with timing\n\n# Simple timing\nconsole.time('db-query');\nconst result = await db.query(...);\nconsole.timeEnd('db-query');\n```\n\n### Where to Start Measuring\n\nUse the symptom to decide what to measure first:\n\n```\nWhat is slow?\n├── First page load\n│   ├── Large bundle? --> Measure bundle size, check code splitting\n│   ├── Slow server response? --> Measure TTFB in DevTools Network waterfall\n│   │   ├── DNS long? --> Add dns-prefetch \u002F preconnect for known origins\n│   │   ├── TCP\u002FTLS long? --> Enable HTTP\u002F2, check edge deployment, keep-alive\n│   │   └── Waiting (server) long? --> Profile backend, check queries and caching\n│   └── Render-blocking resources? --> Check network waterfall for CSS\u002FJS blocking\n├── Interaction feels sluggish\n│   ├── UI freezes on click? --> Profile main thread, look for long tasks (>50ms)\n│   ├── Form input lag? --> Check re-renders, controlled component overhead\n│   └── Animation jank? --> Check layout thrashing, forced reflows\n├── Page after navigation\n│   ├── Data loading? --> Measure API response times, check for waterfalls\n│   └── Client rendering? --> Profile component render time, check for N+1 fetches\n└── Backend \u002F API\n    ├── Single endpoint slow? --> Profile database queries, check indexes\n    ├── All endpoints slow? --> Check connection pool, memory, CPU\n    └── Intermittent slowness? --> Check for lock contention, GC pauses, external deps\n```\n\n### Step 2: Identify the Bottleneck\n\nCommon bottlenecks by category:\n\n**Frontend:**\n\n| Symptom | Likely Cause | Investigation |\n|---------|-------------|---------------|\n| Slow LCP | Large images, render-blocking resources, slow server | Check network waterfall, image sizes |\n| High CLS | Images without dimensions, late-loading content, font shifts | Check layout shift attribution |\n| Poor INP | Heavy JavaScript on main thread, large DOM updates | Check long tasks in Performance trace |\n| Slow initial load | Large bundle, many network requests | Check bundle size, code splitting |\n\n**Backend:**\n\n| Symptom | Likely Cause | Investigation |\n|---------|-------------|---------------|\n| Slow API responses | N+1 queries, missing indexes, unoptimized queries | Check database query log |\n| Memory growth | Leaked references, unbounded caches, large payloads | Heap snapshot analysis |\n| CPU spikes | Synchronous heavy computation, regex backtracking | CPU profiling |\n| High latency | Missing caching, redundant computation, network hops | Trace requests through the stack |\n\n### Step 3: Fix Common Anti-Patterns\n\n#### N+1 Queries (Backend)\n\n```typescript\n\u002F\u002F BAD: N+1 — one query per task for the owner\nconst tasks = await db.tasks.findMany();\nfor (const task of tasks) {\n  task.owner = await db.users.findUnique({ where: { id: task.ownerId } });\n}\n\n\u002F\u002F GOOD: Single query with join\u002Finclude\nconst tasks = await db.tasks.findMany({\n  include: { owner: true },\n});\n```\n\n#### Unbounded Data Fetching\n\n```typescript\n\u002F\u002F BAD: Fetching all records\nconst allTasks = await db.tasks.findMany();\n\n\u002F\u002F GOOD: Paginated with limits\nconst tasks = await db.tasks.findMany({\n  take: 20,\n  skip: (page - 1) * 20,\n  orderBy: { createdAt: 'desc' },\n});\n```\n\n#### Queries That Ignore Their Index\n\n\"Add an index\" is the guess. The query plan is the measurement:\n\n```sql\nEXPLAIN ANALYZE\nSELECT id, title FROM tasks\nWHERE owner_id = 42 ORDER BY created_at DESC LIMIT 20;\n```\n\nThree things in the output decide the fix:\n\n| What you see | What it means |\n|---|---|\n| `Seq Scan` on a large table where you expected an index | No usable index for this predicate |\n| Estimated `rows=` off from actual by an order of magnitude | Stale statistics; the planner is choosing on bad information |\n| A `Sort` node above the scan | The index covers the filter but not the `ORDER BY` |\n\nIndex for the **shape of the query**, not the column in isolation. In a composite index, equality columns come first, then the range or sort column:\n\n```sql\nCREATE INDEX idx_tasks_owner_created ON tasks (owner_id, created_at DESC);\n```\n\n**When an index will not help:**\n\n| Situation | Why |\n|---|---|\n| Low selectivity, querying the dominant value (a `status` column that is 95% `active`, filtered on `active`) | A sequential scan is genuinely cheaper; the planner will ignore the index. Filtering on the rare value is the opposite case, and a partial index serves it well |\n| Leading wildcard (`LIKE '%term'`) | A B-tree cannot seek without a prefix; needs trigram or full-text |\n| Function on the column (`WHERE lower(email) = ?`) | The plain column index is unusable; index the expression instead |\n| Write-heavy table | Every index is a tax on every `INSERT`\u002F`UPDATE`; measure the write cost, not just the read gain |\n\nRe-run `EXPLAIN ANALYZE` after. An index that did not change the plan is a revert (Step 4), and it is not free: it still costs on every write.\n\n#### Connection Pool Exhaustion\n\nThe signature is distinctive: **every** endpoint slows at once, the slow time is spent waiting for a connection rather than executing, and the database reports mostly idle sessions.\n\n```typescript\n\u002F\u002F BAD: a pool per request or per module — under serverless this multiplies\n\u002F\u002F by instance count and exhausts the database's connection limit\n\u002F\u002F GOOD: one pool per process, sized against the database's ceiling\nconst pool = new Pool({\n  max: 10,                        \u002F\u002F instances × max must stay under max_connections\n  idleTimeoutMillis: 30_000,\n  connectionTimeoutMillis: 5_000, \u002F\u002F fail fast instead of queueing forever\n});\n```\n\n**Bigger is not faster.** A pool larger than what the database can execute concurrently just relocates the queue from your app to the database, where it is harder to see. When instance count is unbounded (serverless, autoscaling), a proxy that multiplexes connections (pgbouncer, RDS Proxy) is the fix, not a higher `max`.\n\n#### Missing Image Optimization (Frontend)\n\n```html\n\u003C!-- BAD: No dimensions, no format optimization -->\n\u003Cimg src=\"\u002Fhero.jpg\" \u002F>\n\n\u003C!-- GOOD: Hero \u002F LCP image — art direction + resolution switching, high priority -->\n\u003C!--\n  Two techniques combined:\n  - Art direction (media): different crop\u002Fcomposition per breakpoint\n  - Resolution switching (srcset + sizes): right file size per screen density\n-->\n\u003Cpicture>\n  \u003C!-- Mobile: portrait crop (8:10) -->\n  \u003Csource\n    media=\"(max-width: 767px)\"\n    srcset=\"\u002Fhero-mobile-400.avif 400w, \u002Fhero-mobile-800.avif 800w\"\n    sizes=\"100vw\"\n    width=\"800\"\n    height=\"1000\"\n    type=\"image\u002Favif\"\n  \u002F>\n  \u003Csource\n    media=\"(max-width: 767px)\"\n    srcset=\"\u002Fhero-mobile-400.webp 400w, \u002Fhero-mobile-800.webp 800w\"\n    sizes=\"100vw\"\n    width=\"800\"\n    height=\"1000\"\n    type=\"image\u002Fwebp\"\n  \u002F>\n  \u003C!-- Desktop: landscape crop (2:1) -->\n  \u003Csource\n    srcset=\"\u002Fhero-800.avif 800w, \u002Fhero-1200.avif 1200w, \u002Fhero-1600.avif 1600w\"\n    sizes=\"(max-width: 1200px) 100vw, 1200px\"\n    width=\"1200\"\n    height=\"600\"\n    type=\"image\u002Favif\"\n  \u002F>\n  \u003Csource\n    srcset=\"\u002Fhero-800.webp 800w, \u002Fhero-1200.webp 1200w, \u002Fhero-1600.webp 1600w\"\n    sizes=\"(max-width: 1200px) 100vw, 1200px\"\n    width=\"1200\"\n    height=\"600\"\n    type=\"image\u002Fwebp\"\n  \u002F>\n  \u003Cimg\n    src=\"\u002Fhero-desktop.jpg\"\n    width=\"1200\"\n    height=\"600\"\n    fetchpriority=\"high\"\n    alt=\"Hero image description\"\n  \u002F>\n\u003C\u002Fpicture>\n\n\u003C!-- GOOD: Below-the-fold image — lazy loaded + async decoding -->\n\u003Cimg\n  src=\"\u002Fcontent.webp\"\n  width=\"800\"\n  height=\"400\"\n  loading=\"lazy\"\n  decoding=\"async\"\n  alt=\"Content image description\"\n\u002F>\n```\n\n#### Unnecessary Re-renders (React)\n\n```tsx\n\u002F\u002F BAD: Creates new object on every render, causing children to re-render\nfunction TaskList() {\n  return \u003CTaskFilters options={{ sortBy: 'date', order: 'desc' }} \u002F>;\n}\n\n\u002F\u002F GOOD: Stable reference\nconst DEFAULT_OPTIONS = { sortBy: 'date', order: 'desc' } as const;\nfunction TaskList() {\n  return \u003CTaskFilters options={DEFAULT_OPTIONS} \u002F>;\n}\n\n\u002F\u002F Use React.memo for expensive components\nconst TaskItem = React.memo(function TaskItem({ task }: Props) {\n  return \u003Cdiv>{\u002F* expensive render *\u002F}\u003C\u002Fdiv>;\n});\n\n\u002F\u002F Use useMemo for expensive computations\nfunction TaskStats({ tasks }: Props) {\n  const stats = useMemo(() => calculateStats(tasks), [tasks]);\n  return \u003Cdiv>{stats.completed} \u002F {stats.total}\u003C\u002Fdiv>;\n}\n```\n\n#### Large Bundle Size\n\n```typescript\n\u002F\u002F Modern bundlers (Vite, webpack 5+) handle named imports with tree-shaking automatically,\n\u002F\u002F provided the dependency ships ESM and is marked `sideEffects: false` in package.json.\n\u002F\u002F Profile before changing import styles — the real gains come from splitting and lazy loading.\n\n\u002F\u002F GOOD: Dynamic import for heavy, rarely-used features\nconst ChartLibrary = lazy(() => import('.\u002FChartLibrary'));\n\n\u002F\u002F GOOD: Route-level code splitting wrapped in Suspense\nconst SettingsPage = lazy(() => import('.\u002Fpages\u002FSettings'));\n\nfunction App() {\n  return (\n    \u003CSuspense fallback={\u003CSpinner \u002F>}>\n      \u003CSettingsPage \u002F>\n    \u003C\u002FSuspense>\n  );\n}\n```\n\n#### Missing Caching (Backend)\n\nCache what is expensive to produce and read far more often than it changes. Caching a query that was already fast adds a network hop, a staleness bug, and an eviction policy to maintain, in exchange for nothing.\n\n**Pick the layer deliberately:**\n\n| Layer | Visible to | Use when | Cost |\n|---|---|---|---|\n| In-process (`Map`, LRU) | One instance | Small, hot, per-instance staleness is acceptable | Each instance drifts independently; invalidation reaches only one |\n| Shared (Redis, Memcached) | All instances | Instances must agree, or the value is expensive to recompute | A network hop, and another service to run and monitor |\n| CDN \u002F edge | Everyone, per URL | Responses are public and identical for a given key | Invalidation is the hard part; assume you cannot recall a bad response quickly |\n\n```typescript\n\u002F\u002F Cache frequently-read, rarely-changed data\nconst CACHE_TTL = 5 * 60 * 1000; \u002F\u002F 5 minutes\nlet cachedConfig: AppConfig | null = null;\nlet cacheExpiry = 0;\n\nasync function getAppConfig(): Promise\u003CAppConfig> {\n  if (cachedConfig && Date.now() \u003C cacheExpiry) {\n    return cachedConfig;\n  }\n  cachedConfig = await db.config.findFirst();\n  cacheExpiry = Date.now() + CACHE_TTL;\n  return cachedConfig;\n}\n\n\u002F\u002F HTTP caching headers for static assets\napp.use('\u002Fstatic', express.static('public', {\n  maxAge: '1y',           \u002F\u002F Cache for 1 year\n  immutable: true,        \u002F\u002F Never revalidate (use content hashing in filenames)\n}));\n\n\u002F\u002F Cache-Control for API responses\nres.set('Cache-Control', 'public, max-age=300'); \u002F\u002F 5 minutes\n```\n\n**Key design decides correctness.** Every input that changes the response belongs in the key: tenant, locale, permissions, feature flags. A key that omits the viewer is how one user's data gets served to another, and that ships as a performance win.\n\n**Choose one invalidation strategy, not three:**\n\n| Strategy | Trade-off |\n|---|---|\n| TTL | Simplest. You accept staleness up to the TTL, so state the acceptable window explicitly |\n| Event or tag based | Fresh on write, but writers now have to know the cache topology |\n| Versioned keys (`user:42:profile:v7`) | Never invalidate, just stop reading old keys. Costs memory until eviction |\n\n**Guard against the stampede.** A hot key expires, every concurrent request misses together, and the origin takes the full load at once, which is how a cache turns into an outage instead of preventing one. Serve stale while a single request recomputes (`stale-while-revalidate`), or coalesce concurrent misses behind one in-flight promise so N waiters cause one recompute.\n\n**Do not cache:** anything whose staleness is a correctness bug (balances, permissions, inventory at checkout), or per-user data under a key that does not identify the user. See `..\u002F..\u002F..\u002Freferences\u002Fperformance-checklist.md` for request coalescing, write strategies, negative caching, and the cache checklist.\n\n### Step 4: Verify (Keep or Revert)\n\nA fix is a hypothesis until you re-measure. This step decides whether it survives.\n\n**Re-measure the way you measured the baseline:** same command, same conditions, same fixed budget (wall-clock, sample count, or request count). A baseline taken on a cold cache against a result taken on a warm one measures the cache, not your change.\n\n**Change one thing at a time.** Three optimizations landed together produce one number, and you cannot attribute it. If they must ship together, measure each in isolation first.\n\n**Beat the noise, not just the mean.** Repeat the measurement and compare the delta against run-to-run variance. A 3% gain inside ±5% variance is not a gain; it is a different sample.\n\n**Qualify cache and contention evidence.** A first-process sample does not clear operating-system or standard-library caches. One concurrency batch does not establish a stable contention p95. Repeat comparable runs, keep those evidence classes separate, and derive acceptance targets from observed variation and the headroom before the applicable timeout.\n\nThen decide, strictly:\n\n| Result vs. baseline | Action |\n|---|---|\n| Past the threshold, tests green | **Keep.** Commit with the before\u002Fafter numbers in the message. |\n| Within noise (no measurable change) | **Revert.** |\n| Worse | **Revert.** |\n| Improved, but a test went red | **Revert.** A regression wearing a win's clothing. |\n\n**\"Neutral\" is a revert, not a keep.** This is the step teams skip: the change is already written, throwing it away feels wasteful, so it lands unmeasured, and the codebase accretes complexity that never bought anything. Code you keep, you maintain forever. Make it pay for itself.\n\n**Correctness gates the metric.** The suite stays green *and* the number moves. An \"optimization\" that wins by dropping work the product needed (skipping a validation, caching something that must be fresh, removing an `await` that was load-bearing) is a regression, not a win.\n\n#### Log every attempt, including the reverted ones\n\nReverted work leaves no trace in git history, which is exactly why the same dead idea gets tried again next quarter. Keep a short ledger so a discarded idea stays discarded:\n\n| Idea | Baseline → Result | Verdict | Why |\n|---|---|---|---|\n| Memoize the row component | INP 240ms → 235ms | reverted | Inside noise (±15ms). Rows weren't the bottleneck. |\n| Virtualize the list | INP 240ms → 90ms | kept | Long tasks gone from the trace. |\n| Preconnect to the API origin | LCP 2.8s → 2.8s | reverted | Already same-origin. |\n\nA section in the PR description or a `PERF.md` in the repo both work. What matters is that the next person (or the next agent) reads it before proposing an experiment, and doesn't re-run one that already failed.\n\n### Step 5: Guard Against Regression\n\nGuard the metric the user actually feels, not every available number. Use the\nsame LCP, INP, p95 latency, or other primary metric that justified the fix.\n\nUse two complementary layers when the surface is user-facing:\n\n- **Synthetic CI gate:** Catch reproducible regressions before merge with a\n  performance budget. Repeat noisy measurements or compare a median\u002Ftrend so\n  normal run-to-run variance does not turn the gate into a flaky check.\n- **Field monitoring:** Alert on a meaningful p75 movement in RUM data. Use\n  attributed `web-vitals` data to locate the cause; treat CrUX's rolling window\n  as confirmation rather than an immediate alert.\n\nWhen either guard fires, return to Step 1 and establish a fresh baseline before\nproposing another fix.\n\n**Set budgets and enforce them:**\n\n```\nJavaScript bundle: \u003C 200KB gzipped (initial load)\nCSS: \u003C 50KB gzipped\nImages: \u003C 200KB per image (above the fold)\nFonts: \u003C 100KB total\nAPI response time: \u003C 200ms (p95)\nTime to Interactive: \u003C 3.5s on 4G\nLighthouse Performance score: ≥ 90\n```\n\n**Enforce in CI:**\n```bash\n# Bundle size check\nnpx bundlesize --config bundlesize.config.json\n\n# Lighthouse CI\nnpx lhci autorun\n```\n\n## See Also\n\nFor detailed performance checklists, optimization commands, and anti-pattern reference, see `..\u002F..\u002F..\u002Freferences\u002Fperformance-checklist.md`.\n\n\n## Common Rationalizations\n\n| Rationalization | Reality |\n|---|---|\n| \"We'll optimize later\" | Performance debt compounds. Fix obvious anti-patterns now, defer micro-optimizations. |\n| \"It's fast on my machine\" | Your machine isn't the user's. Profile on representative hardware and networks. |\n| \"This optimization is obvious\" | If you didn't measure, you don't know. Profile first. |\n| \"Users won't notice 100ms\" | Research shows 100ms delays impact conversion rates. Users notice more than you think. |\n| \"The framework handles performance\" | Frameworks prevent some issues but can't fix N+1 queries or oversized bundles. |\n| \"The query is slow, add an index\" | Read the plan first. The index may already exist and be unusable, and every index taxes writes forever. |\n| \"Just cache it\" | Caching an already-cheap call buys nothing and adds a staleness bug. Cache what is expensive *and* re-read far more than written. |\n| \"Raise the pool size, we're running out of connections\" | A pool bigger than the database can serve moves the queue somewhere less visible. Find what holds connections. |\n| \"It didn't help much, but it doesn't hurt\" | Neutral changes are a revert. You pay maintenance on them forever and got nothing back. |\n| \"We already wrote it, may as well keep it\" | Sunk cost. The measurement doesn't care how long the change took to write. |\n| \"The improvement is obvious, no need to re-measure\" | Then re-measuring is cheap and proves it. Unmeasured wins are how neutral complexity lands. |\n\n## Red Flags\n\n- Optimization without profiling data to justify it\n- N+1 query patterns in data fetching\n- An index added without a query plan before and after to justify it\n- A cache key that omits an input the response depends on (tenant, locale, viewer)\n- A cache with no stated staleness window and no invalidation strategy\n- Connection pool size raised in response to exhaustion, without finding what holds connections\n- List endpoints without pagination\n- Images without dimensions, lazy loading, or responsive sizes\n- Bundle size growing without review\n- No performance monitoring in production\n- `React.memo` and `useMemo` everywhere (overusing is as bad as underusing)\n- Optimizations kept without a re-measurement that justifies them\n- Several optimizations bundled into one measurement, so no single change can be attributed\n- A \"win\" that required a test to be changed, skipped, or deleted\n- The same failed optimization attempted more than once because nobody recorded the first attempt\n\n## Verification\n\nAfter any performance-related change:\n\n- [ ] Before and after measurements exist (specific numbers)\n- [ ] The result was re-measured the same way as the baseline (same command, same conditions)\n- [ ] The improvement exceeds run-to-run variance, not just the mean\n- [ ] Changes that didn't beat the baseline were reverted, not kept as neutral\n- [ ] Attempts are logged, kept and reverted alike, so a dead idea isn't re-run\n- [ ] The specific bottleneck is identified and addressed\n- [ ] Core Web Vitals are within \"Good\" thresholds\n- [ ] Bundle size hasn't increased significantly\n- [ ] No N+1 queries in new data fetching code\n- [ ] Any new index is justified by a query plan before and after, and its write cost was considered\n- [ ] Any new cache states what it keys on and how it goes stale\n- [ ] The measured user-facing metric has a synthetic budget or field monitor that can detect regression\n- [ ] Existing tests still pass (optimization didn't break behavior)\n",{"name":5,"description":7},"main","57541c0eee379b047ef924f47432ce8ffa5130e8","skills\u002Fdefault\u002Faddy-performance-optimization","https:\u002F\u002Fgithub.com\u002Fjapurcell\u002Fskills","https:\u002F\u002Fgithub.com\u002Fjapurcell","2026-11-13 07:27:52",{"source":8,"skillName":5,"commands":62,"prompt":72,"zipAvailable":73},[63,66,69],{"tool":64,"command":65},"npx","npx skills add japurcell\u002Fskills --skill addy-performance-optimization",{"tool":67,"command":68},"bunx","bunx skills add japurcell\u002Fskills --skill addy-performance-optimization",{"tool":70,"command":71},"pnpm","pnpm dlx skills add japurcell\u002Fskills --skill addy-performance-optimization","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjapurcell\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fdefault\u002Faddy-performance-optimization\u002FSKILL.md",true,[],[76,106,128,157,179,200],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":87,"publishedAt":50},"01M6PT0ZTYCN4DHK3SXWS79WSY","spec-create","Create or revise a portable behavioral SPEC for a feature or whole product. Use when specifying a new idea, documenting an existing system for reimplementation, or defining a change while preserving compatibility. Implementation planning is a separate task.","https:\u002F\u002Fgithub.com\u002Fjapurcell\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fdefault\u002Fspec-create\u002FSKILL.md",[82],{"categoryNo":83,"categoryName":84,"taxonomyType":85,"taxonomyTypeDesc":86},"01JBSEEDCAT000000000000031","产品经理","PROFESSION","适用职业",[88,89,90,91,92,93,94,45,95,96,97,98,99,100,101,102,103,104,105],"create","spec","spec create","feature","planning","for","system","Existing","task","output","change","product","implementation","revise","compatibility","behavioral","idea","path",{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":113,"publishedAt":50},"01M6GSVHQ4MY4R4SMS8RY6324Q","prd-ralph","Complete at most one eligible unfinished PRD task, verify it, log progress, and optionally create one scoped commit.","https:\u002F\u002Fgithub.com\u002Fjapurcell\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fdefault\u002Fprd-ralph\u002FSKILL.md",[112],{"categoryNo":83,"categoryName":84,"taxonomyType":85,"taxonomyTypeDesc":86},[114,115,116,88,117,118,119,120,121,122,96,123,124,125,126,127,105],"prd ralph","ralph","prd","progress","verify","at","complete","commit","it","log","scoped","false","file","id",{"skillNo":129,"name":130,"nameZh":6,"description":131,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":132,"categories":133,"keywords":137,"publishedAt":50},"01M6GSYMGHE2FEGEFKD926EJH8","fsdp-style-guide","Mandatory for all UI\u002FUX design, implementation, review, audit, or visual regression tasks. Always use for any work that affects user-facing appearance, behavior, accessibility, branding, layout, navigation, forms, dialogs, alerts, tables, or visual design.","https:\u002F\u002Fgithub.com\u002Fjapurcell\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fforest-service\u002Ffsdp-style-guide\u002FSKILL.md",[134],{"categoryNo":135,"categoryName":136,"taxonomyType":85,"taxonomyTypeDesc":86},"01JBSEEDCAT000000000000032","设计师",[138,139,140,141,142,143,144,145,45,146,147,148,149,150,151,152,153,154,155,156,93],"fsdp style guide","style guide","FSDP","style","guide","visual regression","regression","design","visual","tasks","review","visual design","alerts","work","branding","layout","audit","ux","behavior",{"skillNo":158,"name":159,"nameZh":6,"description":160,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":161,"categories":162,"keywords":163,"publishedAt":50},"01M6GSYHEQARNM7WN0RJA7K7T2","agency-priorities","Provide self-contained USDA strategic goals and Forest Service priorities for agency briefings, proposals, and work-plan alignment. Use when explaining agency direction or evaluating how a project contributes to USDA and Forest Service priorities.","https:\u002F\u002Fgithub.com\u002Fjapurcell\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fforest-service\u002Fagency-priorities\u002FSKILL.md",[],[164,165,166,167,168,151,169,170,171,172,173,174,175,176,45,93,31,177,178],"agency priorities","priorities","agency","self","alignment","plan","goals","proposals","direction","how","project","strategic","service","briefings","self-contained",{"skillNo":180,"name":181,"nameZh":6,"description":182,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":183,"categories":184,"keywords":188,"publishedAt":50},"01M6GSY9VVN8RSJ5QYM540ZJ1D","accomplishment-report","Create a concise Forest Service executive accomplishment report when all work in an ExecPlan is completed, or update its existing report. Use at ExecPlan closeout and when asked to report completed work, agency alignment, and estimated AI-assisted versus human-only time and cost savings.","https:\u002F\u002Fgithub.com\u002Fjapurcell\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fforest-service\u002Faccomplishment-report\u002FSKILL.md",[185],{"categoryNo":186,"categoryName":187,"taxonomyType":85,"taxonomyTypeDesc":86},"01JBSEEDCAT000000000000034","行政与办公人员",[189,190,168,191,88,151,192,193,194,195,119,166,196,176,45,197,198,199,95,31],"report","accomplishment report","cost","concise","human","time","update","only","closeout","savings","execplan",{"skillNo":201,"name":202,"nameZh":6,"description":203,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":204,"categories":205,"keywords":212,"publishedAt":50},"01M6GSY7J8ZMCE319P8Y6JZ432","writing-for-agents","Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.","https:\u002F\u002Fgithub.com\u002Fjapurcell\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fdefault\u002Fwriting-for-agents\u002FSKILL.md",[206,209],{"categoryNo":207,"categoryName":208,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":210,"categoryName":211,"taxonomyType":85,"taxonomyTypeDesc":86},"01JBSEEDCAT000000000000036","内容创作者",[213,214,93,45,215,216,31],"writing","writing for agents","documents","editing"]