From claude-code-starter
Analyzes performance bottlenecks in web pages, APIs, builds and delivers prioritized fixes with baselines from Lighthouse, Chrome DevTools, cProfile, py-spy, clinic.js, EXPLAIN ANALYZE.
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-code-starter:perfThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
帮用户找到性能瓶颈并给出具体的改进方案。核心原则:先测量,再优化,再验证。
帮用户找到性能瓶颈并给出具体的改进方案。核心原则:先测量,再优化,再验证。
你想优化什么?
- 网页加载速度(首屏渲染慢、页面太大)
- 后端响应时间(API 慢、数据库查询慢)
- 构建速度(打包太慢)
- 内存或 CPU 占用
在做任何改动之前,用合适的工具记录当前性能数据作为基线:
前端性能测量:
npx lighthouse URL --output=json) — 获取 FCP、LCP、TBT、CLS 评分Python 后端:
cProfile — 内置分析器,快速定位耗时函数:python -m cProfile -s cumtime app.pypy-spy — 采样式分析器,可附加到运行中的进程,无需改代码:py-spy top --pid PIDline_profiler — 逐行分析特定函数耗时,适合定位热点代码Node.js 后端:
--inspect 标志 + Chrome DevTools — node --inspect app.js,然后在 Chrome 打开 chrome://inspectclinic.js — 自动诊断工具:npx clinic doctor -- node app.js数据库:
EXPLAIN ANALYZE — 在慢查询前加上,查看执行计划和实际耗时。重点关注全表扫描(Seq Scan)和嵌套循环记录基线数据:具体的数字(如"首页 LCP 3.2s"、"API 响应 P95 800ms"、"查询耗时 1.4s")。
根据测量结果,检查常见问题:
网页加载:
后端响应:
构建速度:
按投入产出比排序,给出具体建议:
性能分析报告
基线数据:[填入步骤 2 的测量结果]
高影响(优先做):
- [问题] 具体描述 -> [方案] 怎么改 -> [预期提升] 具体数字
中影响:
- ...
低影响(可选):
- ...
用户选择后,逐个执行优化。每个优化完成后,用步骤 2 相同的工具和条件重新测量,对比基线数据:
优化完成。主要改动:xxx。性能对比:[优化前数字] -> [优化后数字]。
npx claudepluginhub lightpointventures/claude-code-starterDiagnoses frontend and backend performance bottlenecks including bundle size, N+1 queries, memory leaks, and Core Web Vitals. Prioritizes fixes by impact.
Analyzes and optimizes performance across frontend, backend, and database layers: CPU, memory, I/O, bundle size, queries, images, and rendering.
Measures and fixes performance bottlenecks in code, databases, and APIs using profiling, query analysis, and caching. Applies when users mention slowness or high response times.