AgentSkillsCN

performance-pass

当变更可能影响延迟、吞吐量、渲染性能、内存占用或数据库负载时,切勿进行微优化;应聚焦于显而易见的瓶颈问题,并着重防范回归风险。

SKILL.md
--- frontmatter
name: performance-pass
description: Use when changes might impact latency, throughput, rendering, memory, or DB load. Do NOT micro-optimize; focus on obvious bottlenecks and regression prevention.

Backend checklist:

  • API
    • Pagination defaults for list endpoints
    • Avoid N+1 patterns; verify includes/joins
    • Add caching headers or server caching where appropriate
    • Validate payload sizes and streaming for large responses
  • DB
    • Verify indexes align with query predicates and sort order
    • Check migration/backfill impacts (locks, write amplification)
    • Watch for chatty queries
  • Runtime
    • Avoid unnecessary allocations in hot paths
    • Ensure async usage is correct (no sync-over-async)
  • Guardrails
    • Add perf-focused tests/benchmarks only if repo already uses them

Frontend checklist (React):

  • Rendering
    • Avoid unnecessary re-renders; use memoization only where it helps
    • Verify list virtualization for large lists if relevant
  • Data fetching
    • Avoid duplicate requests; handle loading/error states cleanly
    • Ensure caching strategy is consistent (query libs, cache keys)
  • Bundling
    • Avoid adding heavy dependencies without justification
    • Ensure code splitting for large new routes/features if repo supports it

Verification:

  • Run build and measure obvious regressions (build output, bundle warnings)
  • Smoke test core flows affected
  • If repo has profiling tools/scripts, run them and report results

Finish with:

  • Potential perf risks identified
  • Changes made (if any) to mitigate
  • Commands run + results
  • Follow-ups (monitoring, dashboards, load testing)