Skip to content
cccskills
FreePublished on GitHub

perf

效能分析與最佳化:量測 baseline、定位瓶頸、優化最高影響項、驗證改善效果。適用於應用程式慢、API 超時、前端 Core Web Vitals 問題。

The English summary is being prepared. Showing the original description.

See how to install

Files included (1)

  • SKILL.md2.8 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Perf — 效能工程

觸發條件

  • 應用程式慢或無回應
  • API 回應時間超標
  • 前端頁面載入過慢
  • 擴充基礎設施前,先確認是否有軟體層優化空間
  • Core Web Vitals 警示(LCP / FID / CLS)

優化流程(4 步驟)

  1. Measure — 先量測,有 baseline 才能比較(不要憑感覺優化)
  2. Identify — 找到最大瓶頸(用 80/20 原則:20% 的程式碼造成 80% 的效能問題)
  3. Optimize — 優先修復影響最大的問題,一次一個
  4. Verify — 用相同工具重新量測,確認改善數字

Profiling 指令

# Node.js
node --prof app.js
node --prof-process isolate-*.log > profile.txt

# Python
python -m cProfile -o output.prof script.py
python -m pstats output.prof

# Go
go tool pprof http://localhost:6060/debug/pprof/profile

# CLI 效能比較(用 hyperfine,需安裝)
hyperfine 'command_a' 'command_b' --warmup 3

常見瓶頸分類

資料庫

  • 缺少索引(在 WHERE / JOIN 欄位加索引)
  • N+1 查詢(改用 eager loading 或 JOIN)
  • 大結果集(加分頁)

記憶體

  • 記憶體洩漏(檢查 event listener、closure 未釋放)
  • 大物件緩衝(改用 stream 處理)
  • 無 TTL 的 cache(加過期時間)

CPU

  • 同步阻塞操作(改 async)
  • 複雜演算法(加 memoize 或改更優算法)
  • 不必要的重複計算(cache 中間結果)

網路

  • 請求過多(batch / 合併)
  • 大 payload(壓縮、分頁)
  • 未使用快取(加 CDN、browser cache header)

效能預算(參考值)

指標目標說明
API 回應<200ms (P95)排除網路 RTT
頁面載入(4G)<1sTime to Interactive
LCP<2.5sLargest Contentful Paint
FID / INP<100ms互動回應
CLS<0.1版面穩定性
Bundle Size<500KB gzipJS bundle

輸出格式

## Performance Report

**Before:** [baseline 量測數字]
**After:**  [優化後數字]
**Improvement:** [百分比改善]

### Bottlenecks Identified
1. [問題] — Impact: High / Medium / Low

### Optimizations Applied
1. [改動] → [結果]

### Remaining Headroom
[還有哪些可以優化但本次未做]

Gotcha

  • 不要在沒有 baseline 的情況下優化:沒有量測就是猜測
  • 一次只改一件事:否則無法判斷哪個改動有效
  • 優化後重跑相同場景:確保量測條件一致才能比較
  • 搭配 context-report skill:若問題是 Claude Code session 效率,用 /context-report 而非本 skill

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

建立符合官方規格的 Claude Code skill:蒐集需求、產出正確格式的 SKILL.md、驗證命名與描述規則、套用 Progressive Disclosure 結構。適合在新增 skill 或 slash command 時使用。

The English summary is being prepared. Showing the original description.

zeuikli/claude-code-workspace156Updated Oct 19, 2026

啟動 Agent Team 模式,多個 worker 平行處理任務並共享發現。適用於大型重構、codebase 遷移、全面審查。

The English summary is being prepared. Showing the original description.

zeuikli/claude-code-workspace156Updated Oct 19, 2026

分析 claude.com/blog 的新文章,提取可操作洞察並更新 workspace 設定。手動調用。

The English summary is being prepared. Showing the original description.

zeuikli/claude-code-workspace156Updated Oct 19, 2026

分析當前專案的 Claude Code session 資料,產出 context 效率報告(模型用量、工具效率、委派比例、TodoWrite 使用率)。搭配 context-management.md 使用。

The English summary is being prepared. Showing the original description.

zeuikli/claude-code-workspace156Updated Oct 19, 2026

追蹤並計算當前 session 的 Token 使用量和花費(USD)。產出前後對比報告,幫助使用者了解 workspace 優化的實際效益。

The English summary is being prepared. Showing the original description.

zeuikli/claude-code-workspace156Updated Oct 19, 2026

debug

Free

系統性 debug 工作流:捕捉錯誤、分析日誌、關聯跨系統 pattern,產出有根因與修復驗證的報告。適用於 bug、test 失敗、生產異常。

The English summary is being prepared. Showing the original description.

zeuikli/claude-code-workspace156Updated Oct 19, 2026

See all skills by zeuikli

Report a problem with this skill