/design-system:performance-auditfrom design-system
Audits design-system components and product UI for render count, unnecessary re-renders, memoization gaps, bundle size impact, useEffect chains, and context thrashing. Auto-invoked by component-quality-gate and design-system-audit.
Ships in design-system. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
現有 /design-system-audit(全 dim per design-system-audit SSOT,code/spec 層)+ /visual-audit(pixel 層)都不看效能。render 次數過多、context 亂鋪、useEffect 鏈條過長這類 bug:
本 skill 作為稽核 6 維度的 D3 元件效能 canonical home。
| 情境 | 模式 | 本 skill 跑什麼 |
|---|---|---|
| 新元件 merge 前 | 進階強制 | 全面(render count / memo / bundle) |
| 元件新功能 | 進階強制 | 全面 scoped to 新 prop / variant |
| 產品 demo 前 | 進階強制 | scoped to URL(常用頁 route) |
| 日常 dev | 高效 | tsc pass + bundle diff 門檻即可 |
| Release cut | 進階 + 全 DS scope | 全 DS render / memo / bundle 全跑 |
packages/design-system/src/components/{Name}/node_modules 已安裝查 4 項:
React.memo 是否需要?style={{ ... }} / onClick={() => ...} 每 render 造新 ref → child memo 失效<ThemeProvider value={theme}> 若含頻繁變動 field(e.g. openMenuId)→ 整個 subtree 重渲。Context 必切分粒度或用 selectorkey={index} 導致無意義 remount工具:
why-did-you-render dev dep 觸發警告(尚未落地;trigger = 下一個 render-storm 類 bug 實例時一併引入,roadmap 殘項列冊)查 3 項:
useMemo查 3 項:
import * as Icons from 'lucide-react'(全庫入 bundle) vs import { Check } from 'lucide-react'React.lazy 減首屏framer-motion vs motion/react / 不同版本 react-day-picker 等工具:
npx vite build --report(vite bundle visualizer)npm run check:bundle-size(budget SSOT = packages/design-system/bundle-budget.json,total + top-8 entry 各 +10% headroom;同一份檔的 sizeLimit 段是排程 size-limit 量的含相依 gzip 上限,--init 一次重設兩段、--section=raw|size-limit 只重設其一;CI verify-static job 直呼 npm run --silent check:bundle-size(.github/workflows/ci.yml,2026-09-21 接進;舊句「release-preflight 內建必跑」的 scripts/release-preflight.mjs 已於 2026-08-04 退役,檔案已不存在);蓄意增大 → --init 更新 budget + commit 說明)產出:
# Performance Audit — {Scope} — {YYYY-MM-DD}
## Summary
- Render issues: N
- Memoization gaps: M
- Bundle impact: K KB
## Findings(按 impact 排序)
### P0: {title}
- 位置: {file:line}
- 現況: {render count / bundle contribution}
- 建議: {具體修法}
- 是工程/治理修實作(P2E auto),還是產品/UI/UX SSOT 真取捨(P2H)?
## Authority classification
- P2E:{工程/治理 finding,交 canonical owner 自主修復}
- P2H:{只有真正產品/UI/UX SSOT 取捨才列 exact target-bound decision}
本 skill 保持 read-only,report 是 evidence receipt;caller/canonical owner 對 P2E 直接接續 修復與驗證,不把 read-only skill boundary 誤當 user checkpoint。只有 P2H 或 shared-governance human-only boundary 才停止。
packages/design-system/ds-canonical/skills/design-system-audit/SKILL.md — 全 dim 統籌(per design-system-audit SSOT);本 skill 是 D3 補位packages/design-system/ds-canonical/skills/visual-audit/SKILL.md — pixel 層(D5)packages/design-system/ds-canonical/skills/ux-audit/SKILL.md — UX 行為層(D4)packages/design-system/ds-canonical/skills/component-quality-gate/SKILL.md — Phase 4.5 進階模式 chain 本 skillWhat SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
27 skills in this plugin
/bug-fix-rhythmBatch-end-verify rhythm + parallel tool batch + user-listed N-rule MUST-ALL + claim runtime verify. Invoke when entering multi-fix session 或 user 列 numbered rules. Replaces M32(c)(d)(h1)(h2) sub-invariants(2026-05-12 split per Knowledge-Prune Checkpoint 2)。/canonical-reviewerReview governance changes in an isolated read-only context with explicit author identity, complete canonical evidence, and mutation detection./code-quality-auditClean code 量化稽核 — `any` 使用 / dead export / file size / long function / circular dep / magic number。補 `/design-system-audit` 只管「design canonical」的缺口。Invoke via /code-quality-audit scope=all(release / 季度)OR scope=changed(daily)OR scope=component:X(focused)。Auto-chain by `/design-system-audit --deep` Dim 27 + `/component-quality-gate` Ship phase + `/new-component` Phase 4.5。/codex-collabCoordinate an evidence-complete primary analysis with a genuinely independent peer provider, then verify and synthesize both results./codify-correctionsProcess $GOVERNANCE_STATE_DIR/user-corrections.jsonl — the Stop-hook-harvested signals of user corrections ("不是" / "不對" / "應該" / "糾正" etc.). Dedup by session + keyword, cluster by topic, and apply edits to the canonical owner(ds-canonical rule / repository memory / canonical skill reference / spec.md rationale) under the shared authority classifier. After codification archive processed entries in the same Git-owned runtime state root. Invoke when user-corrections.jsonl exceeds 40 entries(session_start hard blocker; there is no soft reminder), when the user asks, OR quarterly./codify-principleUser 提出新設計原則 → auto 5-layer artifact generation pipeline。將原則文字自動轉化為 SSOT canonical text + hook scaffold + audit dim + scaffold update + memory entry,依 rule-placement Level 1–9 taxonomy 放入正確 home。對齊 M14 + M19。Invoke when user says「我想加一條設計原則 X」「新原則 Y」「ensure X always」OR auto-recognize trigger phrase。本 skill 把 reactive markdown rule 升級成 proactive principle-to-artifact generator。npx claudepluginhub ajenchen/design-system --plugin design-system