跳到正文
cccskills
免费在 GitHub 公开

optimize

Analyze code, database queries, or systems for performance problems involving speed, memory, and frontend file size. Get prioritized recommendations with code examples, expected impact, implementation effort, risks, and a roadmap for improvements.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

Analyze and suggest performance improvements for code, queries, or systems

查看安装方法

适用场景

  • Investigate a slow function or module
  • Review memory usage and possible leaks
  • Find inefficient database queries
  • Explore ways to reduce frontend file size

包含的文件(1)

  • SKILL.md5.3 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Performance optimizer

Analyze and suggest performance improvements for code, queries, or systems.

Purpose

Identify optimization opportunities:

  • Runtime performance bottlenecks
  • Memory usage issues
  • Database query inefficiencies
  • Bundle size problems
  • Algorithm complexity

Instructions

Step 1: Scope identification

Determine optimization target:

  • Function: Single function performance
  • Module: Related functions/classes
  • Query: Database query optimization
  • Bundle: Frontend bundle analysis
  • System: Architecture-level optimization

Step 2: Performance analysis

Runtime analysis

# Find potentially slow patterns
grep -rn "forEach\|\.map\|\.filter\|\.reduce" --include="*.{ts,js}" . | head -20

# Find nested loops (O(n²) potential)
grep -rn "for.*for\|\.forEach.*\.forEach\|\.map.*\.map" --include="*.{ts,js}" . | head -10

# Find sync operations that could be async
grep -rn "readFileSync\|writeFileSync\|execSync" --include="*.{ts,js}" . | head -10

Memory analysis

# Large array operations
grep -rn "new Array\|Array\.from\|\.concat\|spread" --include="*.{ts,js}" . | head -10

# Potential memory leaks (event listeners, intervals)
grep -rn "addEventListener\|setInterval\|setTimeout" --include="*.{ts,js}" . | head -10

Database query analysis

# N+1 query patterns
grep -rn "await.*find\|await.*query" --include="*.{ts,js}" . | head -15

# Missing indexes hints
grep -rn "WHERE\|ORDER BY\|GROUP BY" --include="*.{ts,js,sql}" . | head -15

Bundle analysis

# Check bundle size (if applicable)
[ -f "package.json" ] && npm run build 2>/dev/null && ls -lh dist/*.js 2>/dev/null

# Large dependencies
[ -f "package.json" ] && cat package.json | jq '.dependencies | keys[]' | head -20

Step 3: Prioritization

Rank findings by:

  1. Impact: How much will this improve performance?
  2. Effort: How hard is the fix?
  3. Risk: What could break?

Output format


⚡ Performance analysis

Target: [file/module/system] Analysis Date: [timestamp]

📊 Current Metrics (if measurable)

MetricCurrentTargetGap
Response timeXms<Yms-Z% needed
Memory usageXMB<YMB-Z% needed
Bundle sizeXKB<YKB-Z% needed

🔴 Critical issues

1. [Issue title] - [location]

Problem: [What's slow and why]

Current:

// O(n²) - nested loops
users.forEach(user => {
  permissions.forEach(perm => {
    if (user.id === perm.userId) { ... }
  });
});

Optimized:

// O(n) - Map lookup
const permMap = new Map(permissions.map(p => [p.userId, p]));
users.forEach(user => {
  const perm = permMap.get(user.id);
  if (perm) { ... }
});

Impact: ~10x faster for 1000 users Effort: Low (5 min) Risk: Low

🟠 High priority

IssueLocationImpactEffort
[description]file:line[estimate][time]

🟡 Medium priority

IssueLocationImpactEffort
[description]file:line[estimate][time]

💡 Quick wins

  1. [Small change with good impact]
  2. [Another quick optimization]
  3. [Low-hanging fruit]

📈 Optimization roadmap

Week 1: Critical fixes (items 1-3)
Week 2: High priority (items 4-6)
Week 3: Measure and validate improvements

Common patterns

Array operations

PatternIssueFix
arr.filter().map()Two iterationsSingle reduce() or flatMap()
arr.find() in loopO(n²)Build Map/Set first
[...arr1, ...arr2]Memory allocationarr1.concat(arr2) or push

Database

PatternIssueFix
Loop with awaitN+1 queriesBatch query with IN
SELECT *Over-fetchingSelect only needed columns
Missing WHERE indexFull table scanAdd composite index

React/frontend

PatternIssueFix
Inline functions in JSXRe-rendersuseCallback
Large list renderingDOM thrashingVirtualization
Unoptimized imagesSlow LCPNext/Image, lazy loading

Node.js

PatternIssueFix
Sync file operationsBlocks event loopAsync alternatives
JSON.parse large filesMemory spikeStreaming parser
No connection poolingConnection overheadPool with pg-pool, etc.

Usage

Analyze specific file:

/optimize src/services/user.ts

Focus on specific area:

/optimize --queries src/repositories/
/optimize --bundle
/optimize --memory src/workers/

With target metrics:

/optimize --target=100ms src/api/search.ts

Quick scan:

/optimize --quick

Notes

  • Measurements beat assumptions: profile before optimizing
  • Premature optimization is the root of all evil (Knuth)
  • Focus on hot paths: optimize what runs often
  • Consider trade-offs: speed vs readability vs maintainability

$ARGUMENTS

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Evaluate Claude Code agents, skills, and commands with weighted quality criteria. Get scores, readiness grades, template comparisons, and practical improvement suggestions in Markdown or JSON reports to guide reviews before release.

中文简介正在准备中。当前显示英语简介。

  • Review skills before release
  • Compare agent definitions with reference templates
  • Quickly check critical quality criteria
FlorianBruniaux/claude-code-ultimate-guide62072026年10月20日 更新

Assess a codebase across seven areas, including exposed credentials, security, dependencies, structure, and tests. Receive category scores, findings tied to file locations, and a prioritized improvement plan with smaller tasks that can be completed quickly.

中文简介正在准备中。当前显示英语简介。

  • Assessing the overall health of an inherited project
  • Reviewing exposed credentials and security risks
  • Identifying dependency and test coverage gaps
FlorianBruniaux/claude-code-ultimate-guide62072026年10月20日 更新

Measure code patterns such as casts to any or disabled lint rules, then run repeated, targeted edits. Keep changes that improve the chosen metric, revert unsuccessful changes, and track results for each improvement loop.

中文简介正在准备中。当前显示英语简介。

  • Finding code patterns to prioritize for cleanup
  • Preparing measurement files for an improvement loop
  • Repeating targeted edits to reduce casts to any
FlorianBruniaux/claude-code-ultimate-guide62072026年10月20日 更新

best-of-n

免费

Generate several separate solutions, compare them against criteria fixed in advance, and verify the selected result through executable checks or an independent reviewer. Keep a proof log documenting candidates, evidence, failures, and remaining limits.

中文简介正在准备中。当前显示英语简介。

  • Comparing implementation options before choosing one
  • Verifying a solution when a wrong choice would be costly
  • Keeping evaluation evidence for delivery or audit
FlorianBruniaux/claude-code-ultimate-guide62072026年10月20日 更新

canary

免费

Monitor a live application after deployment and compare it with a saved baseline, a record of its earlier state. Check page responses, loading times, and new errors, flag persistent changes, and produce a per-page health report.

中文简介正在准备中。当前显示英语简介。

  • Recording a healthy baseline before deployment
  • Monitoring production immediately after deployment
  • Checking key pages for slower responses or failures
FlorianBruniaux/claude-code-ultimate-guide62072026年10月20日 更新

catchup

免费

Rebuild project context after clearing a conversation or returning to work. Review recent Git history, uncommitted changes, and TODO markers to get a structured summary of project status and suggested next steps.

中文简介正在准备中。当前显示英语简介。

  • Restoring project context after /clear
  • Reviewing recent changes after a long break
  • Checking unfinished work before choosing the next task
FlorianBruniaux/claude-code-ultimate-guide62072026年10月20日 更新

查看 FlorianBruniaux 的全部技能

报告此技能的问题