Community程式設計與開發github.com

optimizetests

最佳化 OpenClaw 的慢速測試、匯入、覆蓋率問題與 CI 執行時間,同時維持覆蓋率不變。

optimizetests 是什麼?

此技能旨在協助開發者最佳化 OpenClaw 專案中的測試效能,重點在於減少實際執行時間,而不降低測試覆蓋率或跳過任何斷言。它提供了一個結構化的行動手冊(runbook),指導使用者先讀取相關文件建立基礎知識,接著透過特定指令收集基準數據(如整體排名與個別檔案計時),然後優先處理最高回報的熱點——例如廣泛的 barrel 匯入、`vi.resetModules()` 的過度使用、昂貴的伺服器設定,或重複的測試夾具建構。技能強調採用生產級品質的修復方式,例如將共用作業抽取為純粹的輔助函式、使用依賴注入取代模組重置,以及將擴展所屬的行為移至專屬測試。每次修改後,使用者需重新執行相同的基準測試與驗證測試 pipeline,記錄前後的 wall time、Vitest 持續時間與最大 RSS 記憶體用量。最後,透過 `pnpm check:changed` 與更廣泛的檢查套件驗證變更,並使用指定腳本提交與推送,同時監控 CI 狀態直到綠燈。此技能適用於任何使用 Vitest 或類似測試框架的 TypeScript/Node.js 專案,尤其適合大型 monorepo 結構。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/clawdbot/clawdbot/tree/main/.agents/skills/optimizetests

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

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

說明文件

最佳化測試

目標:在維持覆蓋率不變的前提下,實現 OpenClaw 測試/執行時間的實際加速。請勿以新增分片、跳過斷言、弱化門檻或調整 runner 旗標作為主要修復手段。

行動手冊

  1. 閱讀 docs/help/testing.md、docs/ci.md 以及你將編輯的任何子樹的範圍內 AGENTS.md 檔案。
  2. 在編輯前建立證據:
    • 整體排名:pnpm test:perf:groups --full-suite --allow-failures --output .artifacts/test-perf/<name>.json
    • 目標檔案:timeout 240 /usr/bin/time -l pnpm test <file> --maxWorkers=1 --reporter=verbose
    • 匯入嫌疑:加入 OPENCLAW_VITEST_IMPORT_DURATIONS=1 OPENCLAW_VITEST_PRINT_IMPORT_BREAKDOWN=1
  3. 優先攻擊回報最高的熱點:
    • 熱門測試中的寬泛 barrel 匯入或 importActual()
    • 每個測試中的 vi.resetModules() 加上全新匯入
    • 昂貴的閘道器/伺服器/客戶端設定,其中重設/重用能證明相同行為
    • 核心測試斷言屬於擴展所屬的行為
    • 重複的測試夾具建構或合約斷言
  4. 偏愛生產級品質的修復:
    • 窄化執行時期接縫,而非廣泛的 mock
    • 對靜態解析/元資料使用純粹輔助函式
    • 注入相依性,而非模組重置
    • 對捆綁的外掛程式/提供者/通道行為使用擴展所屬的測試
  5. 每次變更後,重新執行相同的基準測試與驗證測試 pipeline。記錄前後的 wall time、Vitest 持續時間與最大 RSS(當可用時)。
  6. 執行 pnpm check:changed;當觸及的表面需要時,執行更廣泛的閘門檢查(pnpm check、pnpm test、pnpm build)。
  7. 使用 scripts/committer "<conventional message>" <paths...> 提交範圍內的變更。在要求時推送。如果 CI 顯示紅燈,使用 gh run list/view 檢查,修正,推送,重複直到當前 CI 變為綠燈或阻礙因素被證明無關。

輸出

以已推送的提交、前後計時、已執行的閘門檢查、當前 CI 狀態,以及任何需要獨立最佳化的剩餘尾端測試套件作為結尾。

Individual skills in this repo

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

1password

Set up and use 1Password CLI for sign-in, desktop integration, and reading or injecting secrets.

acp-router

Route plain-language requests for Claude Code, Cursor, Copilot, OpenClaw ACP, OpenCode, Gemini CLI, Grok Build, Qwen, Kiro, Kimi, iFlow, Factory Droid, Kilocode, or explicit ACP harness work into either OpenClaw ACP runtime sessions or direct acpx-driven sessions ("telephone game" flow). For coding-agent thread requests, read this skill first, then use only `sessions_spawn` for thread creation. Codex chat binding defaults to the native Codex app-server plugin unless ACP is explicit or background spawn needs ACP.

add-model-provider

Add and live-prove a model provider with non-interactive config one-liners, without exposing credentials.

agent-transcript

Requested GitHub PR/issue agent transcripts: redact, trim, preview, and insert safely.

apple-notes

Create, view, edit, delete, search, move, or export Apple Notes via the memo CLI on macOS.

apple-reminders

List, add, edit, complete, or delete Apple Reminders and reminder lists via remindctl.

auto-qa

Run OpenClaw-wide autonomous QA and live/stress campaigns across independent subsystem lanes, with verified fixes and a resumable evidence report.

autoreview

Structured code review through the shared OpenClaw agent-skills installation.

bear-notes

Create, search, and manage Bear notes via grizzly CLI.

blacksmith-testbox

Run Blacksmith Testbox for CI-parity checks, secrets, hosted services, migrations, or builds local cannot reproduce.

block-kit

Use proactively for structured or interactive Slack replies, and when asked to author or validate native Slack Block Kit JSON.

blogwatcher

Monitor blogs and RSS/Atom feeds for updates using the blogwatcher CLI.

blucli

BluOS CLI (blu) for discovery, playback, grouping, and volume.

bluebubbles

Send and manage iMessages via BlueBubbles, including attachments, tapbacks, edits, replies, and groups.

browser-automation

Use when controlling web pages with the OpenClaw browser tool, especially multi-step flows, login checks, tab management, or recovery from stale refs/timeouts.

camsnap

Capture frames or clips from RTSP/ONVIF cameras and local webcams, including USB pan/tilt/zoom control.

canvas

Present HTML on connected OpenClaw node canvases, navigate/eval/snapshot, and debug canvas host URLs.

channel-message-flows

Use when running QA Lab channel message flow evidence.

clawdtributor

Clawtributor PRs here, last week or another window: discover conversation refs, recheck GitHub, rank by impact.

clawhub

Search ClawHub for plugins by default, or skills and agent Templates when requested; add Templates; install, verify, update, uninstall, publish, or sync skills.

相關技能