Communitygithub.com

基準測試 — 效能基線與回歸檢測

使用此技能來衡量效能基線、檢測 PR 前後的效能回歸,以及比較不同技術方案的優劣。

基準測試 — 效能基線與回歸檢測 是什麼?

這是一個專為開發者與 AI 代理設計的基準測試技能,能自動化測量與追蹤應用程式的效能指標。它支援四種主要模式:頁面效能(測量 Core Web Vitals 與資源大小)、API 效能(p50/p95/p99 延遲與正確性)、建置效能(冷啟動、熱更新、測試與型別檢查時間),以及 PR 前後對比分析。此技能可與瀏覽器 MCP 工具整合以獲取真實使用者資料,並將結果儲存為 Git 可追蹤的 JSON 檔案,讓團隊能共享效能基線。它特別適合在 CI 流程中自動化觸發,與 `/canary-watch` 或 `/browser-qa` 等技能搭配使用,以確保每次發布前都符合效能目標。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/everything-claude-code/tree/main/skills/benchmark

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

基準測試 — 效能基線與回歸檢測 是做什麼的?

使用時機

  • PR 前後測量效能影響
  • 為專案設定效能基線
  • 當使用者回報「感覺很慢」時
  • 上線前確保達到效能目標
  • 比較你的技術方案與替代方案

運作方式

模式 1:頁面效能

透過瀏覽器 MCP 測量真實瀏覽器指標:

1. 瀏覽每個目標 URL
2. 測量 Core Web Vitals:
   - LCP(最大內容繪製)— 目標 < 2.5 秒
   - CLS(累計版面配置位移)— 目標 < 0.1
   - INP(與下一次繪製的互動)— 目標 < 200 毫秒
   - FCP(首次內容繪製)— 目標 < 1.8 秒
   - TTFB(第一位元組時間)— 目標 < 800 毫秒
3. 測量資源大小:
   - 總頁面權重(目標 < 1MB)
   - JS 套件大小(目標 < 200KB gzipped)
   - CSS 大小
   - 圖片權重
   - 第三方腳本權重
4. 計算網路請求數量
5. 檢查是否有阻礙渲染的資源

模式 2:API 效能

對 API 端點進行基準測試:

1. 每個端點呼叫 100 次
2. 測量:p50、p95、p99 延遲
3. 追蹤:回應大小、狀態碼
4. 在負載下測試:10 個並發請求
5. 與 SLA 目標比較

模式 3:建置效能

測量開發反饋循環:

1. 冷啟動建置時間
2. 熱更新時間(HMR)
3. 測試套件執行時間
4. TypeScript 檢查時間
5. Lint 時間
6. Docker 建置時間

模式 4:前後對比

在變更前後執行以測量影響:

/benchmark baseline    # 儲存當前指標
# ... 進行變更 ...
/benchmark compare     # 與基線比較

輸出:

| 指標 | 之前 | 之後 | 差異 | 結果 |
|--------|--------|-------|-------|---------|
| LCP | 1.2 秒 | 1.4 秒 | +200 毫秒 | 警告:注意 |
| 套件 | 180KB | 175KB | -5KB | ✓ 改善 |
| 建置 | 12 秒 | 14 秒 | +2 秒 | 警告:注意 |

輸出

將基線儲存在 .ecc/benchmarks/ 目錄下,格式為 JSON。這些檔案會透過 Git 追蹤,以便團隊共享基線。

整合

  • CI:在每個 PR 上執行 /benchmark compare
  • 搭配 /canary-watch 進行部署後監控
  • 搭配 /browser-qa 作為完整的上線前檢查清單

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/claude-api

Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.

affaan-m/everything-claude-code

End-to-end marketing campaign planning and execution. Covers audience research, positioning, campaign angle definition, landing page copy, email sequences, social posts, ad copy, short-form video scripts, and content calendars. Use as the orchestration layer for multi-channel product launches. Use when planning or executing a multi-channel product launch, or producing landing page, email, social, or ad copy.

affaan-m/everything-claude-code

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/everything-claude-code-conventions

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use when the user asks to build web components, pages, or applications and the visual direction matters as much as the code quality.

affaan-m/gget

gget CLI and Python workflow for quick genomic database queries, sequence lookup, BLAST-style searches, enrichment checks, and reproducible bioinformatics evidence logs.

affaan-m/literature-review

Systematic literature-review workflow for academic, biomedical, technical, and scientific topics, including search planning, source screening, synthesis, citation checks, and evidence logging.

affaan-m/motion-ui

Production-ready UI motion system for React/Next.js. Use when implementing animations, transitions, or motion patterns.

affaan-m/project-guidelines-example

Example project-specific skill template based on a real production application.

affaan-m/pubmed-database

Direct PubMed and NCBI E-utilities search workflows for biomedical literature, MeSH queries, PMID lookup, citation retrieval, and API-backed literature monitoring.

affaan-m/scholar-evaluation

Structured scholarly-work evaluation for papers, proposals, literature reviews, methods sections, evidence quality, citation support, and research-writing feedback.

affaan-m/uspto-database

USPTO patent and trademark data workflow for official record lookup, PatentSearch queries, TSDR checks, assignment data, and reproducible IP research logs.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

相關技能