312362115/claude/perf-profiling
Claude Code and agent skill by 312362115/claude
Trust tier 2
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
前后端性能分析技能:定位瓶颈、跑 benchmark、对比优化前后效果。 前端覆盖 Core Web Vitals(LCP/FID/CLS)、Lighthouse 审计、Bundle 分析。 后端覆盖 API 响应时间、数据库查询性能、内存/CPU profiling。 核心原则:基于数据定位瓶颈,不做无依据的"优化"。 触发词:性能优化、太慢了、性能分析、LCP、首屏、响应时间慢、profiling、benchmark。 触发场景:性能相关需求验收、用户反馈慢、性能指标超标、重构后性能回归验证。
Install
npx vskill@latest install 312362115/claude/perf-profilingSKILL.md
性能分析(Perf Profiling)
优化的前提是度量。不知道慢在哪,就不知道该优化哪。每次优化都要有"前"和"后"的数据对比,否则不算优化。
第一步:明确分析目标
用 AskUserQuestion 确认:
- 具体症状:哪里慢?慢到什么程度?(要数据,不要"感觉")
- 性能基线:当前是多少?目标是多少?
- 复现条件:特定页面?特定数据量?特定并发?
前端性能分析
2.1 Core Web Vitals 度量
| 指标 | 含义 | 达标 | 需改进 | 差 | |
|---|---|---|---|---|---|
| LCP | 最大内容绘制 | ≤2.5s | ≤4s | >4s | |
| INP | 交互到下一次绘制 | ≤200ms | ≤500ms | >500ms | |
| CLS | 累计布局偏移 | ≤0.1 | ≤0.25 | >0.25 |
度量工具:
2.2 Bundle 分析
关注点:
- 总 bundle 大小(gzip 后)
- 最大的几个依赖占比
- 有没有重复打包的依赖
- 是否做了 code splitting
2.3 前端常见瓶颈与优化方向
| 瓶颈 | 诊断方式 | 优化方向 | |
|---|---|---|---|
| 首屏大图/大资源阻塞 LCP | Lighthouse / Network 瀑布图 | 懒加载、压缩、CDN、preload 关键资源 | |
| JS Bundle 过大 | Bundle 分析 | Code splitting、tree shaking、动态导入 | |
| 未优化图片 | Lighthouse 图片审计 | WebP/AVIF、响应式图片、压缩 | |
| 布局抖动导致 CLS | Lighthouse CLS 审计 | 固定尺寸占位、字体预加载 | |
| 大量 DOM 操作 | Performance timeline | 虚拟列表、减少重排、requestAnimationFrame | |
| 第三方脚本阻塞 | Network + Coverage | 延迟加载、异步加载、移除不必要的三方脚本 |
后端性能分析
3.1 API 响应时间度量
记录关键指标:
- p50 / p95 / p99 响应时间
- 吞吐量(req/s)
- 错误率
3.2 数据库查询分析
关注点:
- 全表扫描(缺索引)
- N+1 查询
- 未使用的索引
- 慢查询(>100ms)
3.3 Node.js / Python Profiling
Node.js:
Python:
3.4 后端常见瓶颈与优化方向
| 瓶颈 | 诊断方式 | 优化方向 | |
|---|---|---|---|
| 数据库查询慢 | EXPLAIN ANALYZE | 加索引、优化查询、减少 N+1 | |
| 序列化/反序列化开销 | profiling | 减少响应字段、分页、缓存 | |
| 外部 API 调用阻塞 | timing 日志 | 并行调用、缓存、超时控制 | |
| 内存泄漏 | 内存快照对比 | 排查未释放的引用、闭包 | |
| CPU 密集计算 | CPU profiling | Worker 线程、缓存计算结果 | |
| 连接池耗尽 | 连接池监控 | 调整池大小、检查连接泄漏 |
第四步:优化与对比
4.1 优化前记录基线
在做任何改动之前,必须记录当前性能数据:
4.2 优化后对比
每次优化后,用相同条件重新测量,对比前后:
4.3 输出性能报告
完整性能分析后,输出报告到 docs/specs/ 或直接在对话中给出:
分析准则
- 数据驱动:不凭直觉优化。先度量,找到瓶颈,再优化,再度量
- 优先级:先优化影响最大的瓶颈(80/20 法则)
- 工具按项目选:不强制某个工具,项目里有什么用什么,缺什么建议安装什么
- 不过度优化:达到目标就停。从 3s 优化到 2s 和从 2s 优化到 1.5s 的成本完全不同
- 回归保护:性能优化不能破坏功能。优化后必须跑测试确认功能正常
与其他 skill 的关系
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/perf-profiling/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/312362115/claude/perf-profiling)