File contents 性能优化技能
描述
对代码进行性能分析,识别CPU、内存和I/O瓶颈,提供具体的优化建议和基准对比。支持前端渲染、后端服务和数据库查询优化。
使用方法
/performance-optimizer [目标路径或文件] [选项]
选项
--focus <area> - 分析重点: cpu, memory, io, render, all (默认: all)
--depth <level> - 分析深度: shallow, normal, deep (默认: normal)
--benchmark - 生成优化前后的基准对比
--fix - 自动应用低风险优化
执行步骤
性能基线 : 分析当前代码结构,建立性能基线和复杂度评估
瓶颈分析 : 识别算法复杂度问题、内存泄漏风险、不必要的渲染和慢查询
优化建议 : 提供具体的代码修改方案,按影响大小和实施难度排序
基准对比 : 估算优化后的性能提升幅度,提供对比数据
检查项目
类别
检查内容
算法
时间复杂度、空间复杂度、不必要的循环
内存
闭包泄漏、大对象持有、未释放引用
I/O
同步阻塞、N+1查询、缺少缓存
渲染
不必要的重渲染、大列表未虚拟化、图片未懒加载
网络
请求合并、压缩、CDN、预加载
数据库
慢查询、缺少索引、全表扫描
优化级别
级别
说明
风险
P0
严重性能问题,必须修复
低
P1
明显性能瓶颈,建议优先修复
低-中
P2
一般性能改进,建议优化
中
P3
微优化,可选
中-高
输出格式
性能评分: 1-100分(基于综合分析)
瓶颈列表: 按严重程度排序的性能问题
优化方案: 具体代码修改建议和预期收益
基准对比: 优化前后的性能指标对比
示例
分析文件性能:
/performance-optimizer src/main/rag/hybrid-search-engine.js
聚焦内存分析:
/performance-optimizer src/renderer/stores/ --focus memory --depth deep
生成基准对比:
/performance-optimizer src/main/llm/context-engineering.js --benchmark
1 --- 2 name: performance-optimizer 3 description: 性能优化技能 - 性能分析、瓶颈识别、优化建议 4 --- 5 6 # 性能优化技能 7 8 ## 描述 9 10 对代码进行性能分析,识别CPU、内存和I/O瓶颈,提供具体的优化建议和基准对比。支持前端渲染、后端服务和数据库查询优化。 11 12 ## 使用方法 13 14 ``` 15 /performance-optimizer [目标路径或文件] [选项] 16 ``` 17 18 ## 选项 19 20 - `--focus <area>` - 分析重点: cpu, memory, io, render, all (默认: all) 21 - `--depth <level>` - 分析深度: shallow, normal, deep (默认: normal) 22 - `--benchmark` - 生成优化前后的基准对比 23 - `--fix` - 自动应用低风险优化 24 25 ## 执行步骤 26 27 1. **性能基线**: 分析当前代码结构,建立性能基线和复杂度评估 28 2. **瓶颈分析**: 识别算法复杂度问题、内存泄漏风险、不必要的渲染和慢查询 29 3. **优化建议**: 提供具体的代码修改方案,按影响大小和实施难度排序 30 4. **基准对比**: 估算优化后的性能提升幅度,提供对比数据 31 32 ## 检查项目 33 34 | 类别 | 检查内容 | 35 | ------ | -------------------------------------------- | 36 | 算法 | 时间复杂度、空间复杂度、不必要的循环 | 37 | 内存 | 闭包泄漏、大对象持有、未释放引用 | 38 | I/O | 同步阻塞、N+1查询、缺少缓存 | 39 | 渲染 | 不必要的重渲染、大列表未虚拟化、图片未懒加载 | 40 | 网络 | 请求合并、压缩、CDN、预加载 | 41 | 数据库 | 慢查询、缺少索引、全表扫描 | 42 43 ## 优化级别 44 45 | 级别 | 说明 | 风险 | 46 | ---- | -------------------------- | ----- | 47 | P0 | 严重性能问题,必须修复 | 低 | 48 | P1 | 明显性能瓶颈,建议优先修复 | 低-中 | 49 | P2 | 一般性能改进,建议优化 | 中 | 50 | P3 | 微优化,可选 | 中-高 | 51 52 ## 输出格式 53 54 - 性能评分: 1-100分(基于综合分析) 55 - 瓶颈列表: 按严重程度排序的性能问题 56 - 优化方案: 具体代码修改建议和预期收益 57 - 基准对比: 优化前后的性能指标对比 58 59 ## 示例 60 61 分析文件性能: 62 63 ``` 64 /performance-optimizer src/main/rag/hybrid-search-engine.js 65 ``` 66 67 聚焦内存分析: 68 69 ``` 70 /performance-optimizer src/renderer/stores/ --focus memory --depth deep 71 ``` 72 73 生成基准对比: 74 75 ``` 76 /performance-optimizer src/main/llm/context-engineering.js --benchmark 77 ```
chainlesschain/chainlesschain/tree/main/desktop-app-vue/src/main/ai-engine/cowork/skills/builtin/performance-optimizer commit 598f6ea264
Frequently asked questions How do I install the Performance Optimizer skill? Run npx skillmds@latest add chainlesschain/performance-optimizer in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
What does the Performance Optimizer skill do? 性能优化技能 - 性能分析、瓶颈识别、优化建议 It is listed under Web & Frontend on SkillMD.
Is Performance Optimizer safe to use? This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
Which AI agents work with Performance Optimizer? This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Is Performance Optimizer free to use? Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
Who published Performance Optimizer? chainlesschain (@chainlesschain) published this skill. Their other Agent Skills are listed on their SkillMD profile.