Fix Tests

NeoLabHQ/context-engineering-kit/plugins/tdd/skills/fix-tests

作者 NeoLabHQ23e2428e809d77717f8acc9659c374a3a1fcb93e無授權條款收錄於 2026年10月9日更新於 2026年10月9日

Systematically fix all failing tests after business logic changes or refactoring

AI 產生的概覽

協調平行代理,在業務邏輯變更或重構後修復失敗的測試。

功能
此技能提供一套工作流程,用於在業務邏輯變更、重構或相依套件更新後修復失敗的測試。它會探索測試基礎設施,執行完整測試套件以找出失敗的檔案,驗證個別測試檔案能否獨立執行,接著為每個失敗的測試檔案啟動一個開發代理進行修復。它會重新執行完整套件並反覆迭代,直到所有測試通過,力求保留測試意圖與覆蓋率,除非發現真正的缺陷,否則不改動業務邏輯。
適用情境
當測試因不再符合目前行為或實作而失敗時使用,例如重構、業務邏輯變更或相依套件更新之後。它適用於已有測試套件、且能執行測試與覆蓋率報告的專案。
執行需求
僅為指令,不隨附指令碼。需要一個可執行測試套件和測試命令的專案、README 及套件設定或等效專案設定等文件,以及啟動子代理的能力。若可用,它會選擇性地引用獨立的 sadd 和 TDD 技能。

Fix Tests

User Arguments

User can provide to focus on specific tests or modules:

$ARGUMENTS

If nothing is provided, focus on all tests.

Context

After business logic changes, refactoring, or dependency updates, tests may fail because they no longer match the current behavior or implementation. This command orchestrates automated fixing of all failing tests using specialized agents.

Goal

Fix all failing tests to match current business logic and implementation.

Important Constraints

  • Focus on fixing tests - avoid changing business logic unless absolutely necessary
  • Preserve test intent - ensure tests still validate the expected behavior
  • "Analyse complexity of changes" -
    • if there 2 or more changed files, or one file with complex logic, then Do not write tests yourself - only orchestrate agents!
    • if there is only one changed file, and it's a simple change, then you can write tests yourself.

Workflow Steps

Preparation

  1. Read sadd skill if available

    • If available, read the sadd skill to understand best practices for managing agents
  2. Discover test infrastructure

    • Read @README.md and package.json (or equivalent project config)
    • Identify commands to run tests and coverage reports
    • Understand project structure and testing conventions
  3. Run all tests

    • Execute full test suite to establish baseline
  4. Identify all failing test files

    • Parse test output to get list of failing test files
    • Group by file for parallel agent execution

Analysis

  1. Verify single test execution
    • Choose any test file
    • Launch haiku agent with instructions to find proper command to run this only test file
      • Ask him to iterate until you can reliably run individual tests
    • After he complete try running a specific test file if it exists
    • This ensures agents can run tests in isolation

Test Fixing

  1. Launch developer agents (parallel)

    • Launch one agent per failing test file
    • Provide each agent with clear instructions:
      • Context: Why this test needs fixing (business logic changed)
      • Target: Which specific file to fix
      • Guidance: Read TDD skill (if available) for best practices how to write tests.
      • Resources: Read README and relevant documentation
      • Command: How to run this specific test file
      • Goal: Iterate until test passes
      • Constraint: Fix test, not business logic (unless clearly broken)
  2. Verify all fixes

    • After all agents complete, run full test suite again
    • Verify all tests pass
  3. Iterate if needed

    • If any tests still fail: Return to step 5
    • Launch new agents only for remaining failures
    • Continue until 100% pass rate

Success Criteria

  • All tests pass ✅
  • Test coverage maintained
  • Test intent preserved
  • Business logic unchanged (unless bugs found)

Agent Instructions Template

When launching agents, use this template:

The business logic has changed and test file {FILE_PATH} is now failing.
Your task:1. Read the test file and understand what it's testing2. Read TDD skill (if available) for best practices on writing tests.3. Read @README.md for project context4. Run the test: {TEST_COMMAND}5. Analyze the failure - is it:   - Test expectations outdated? → Fix test assertions   - Test setup broken? → Fix test setup/mocks   - Business logic bug? → Fix logic (rare case)6. Fix the test and verify it passes7. Iterate until test passes

來源與署名

來源:NeoLabHQ/context-engineering-kit位於plugins/tdd/skills/fix-tests提交23e2428

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架