Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

Test Fix

FreeNo executable scriptsNot checked

Fix failing tests without weakening them — run the suite once, rerun only the failing files to separate flaky from real failures, classify each real failure…

winsoftlabs30by winsoftlabs30167 installs in other catalogs

About this skill

Test Fix (manual edition)

When the user asks to "fix the failing tests" or "make the tests pass", follow this workflow. This edition has no scripts: you run the commands and apply the same judgment.

Step 1 — Run the suite once

Detect the runner from package.json:

Signal Command
vitest in devDependencies or the test script npx vitest run
jest in devDependencies or the test script npx jest
@playwright/test in devDependencies npx playwright test
none of the above the project's own npm test

Record the totals and every failing test (file + name + first line of the message).

  • Green means zero failures AND exit code 0.
  • A non-zero exit with no listed failures means the suite itself is broken (for example a test file fails to load). Report that; never call it green.

Step 2 — Rerun only the failing files

Rerun each failing file once:

  • vitest: npx vitest run path/to/file.test.ts
  • jest: npx jest --runTestsByPath path/to/file.test.ts
  • playwright: npx playwright test path/to/file.spec.ts

Classify each failure:

  • flaky — failed, then passed on the rerun. Report only. Do not patch it, and do not add sleeps or retries to hide the race.
  • consistent — failed both times. It needs a patch; go to step 3.

Step 3 — Judge each consistent failure

Read the failure message, the test, and the source. Decide:

  • source bug — the production code is wrong. Patch the source.
  • wrong test — the assertion contradicts the intended behavior. Prove it first (doc comments, naming, sibling tests, specs). If you cannot prove the test is wrong, treat it as a source bug. Doubt goes to the code, not the axe.

Step 4 — Propose patches (do not apply)

For each failure, write patches/<n>.md containing:

  1. a unified diff of the smallest safe change
  2. two lines of rationale: the cause, and why this is the minimal fix
  3. risk: low / med / high

Then write patches/README.md with a table: failure -> cause (source bug / wrong test) -> risk -> patch file.

Step 5 — Report and wait

Lead with the verdict, for example:

3 failures: 1 source bug, 1 wrong test, 1 flaky — patches in patches/, nothing applied yet.

List flaky ones as report-only. Then ask for approval. Apply only after explicit approval, one patch at a time, rerunning the affected test after each.

Hard rules

  • Never delete, skip, .skip, or weaken a test to make it pass.
  • Never edit an assertion before proving the production code is right.
  • Never apply a patch without explicit approval.
  • Flaky means report only — no patch.
  • Never silence a failure with sleeps or retries without explaining the real race.

This is the manual edition: the workflow and the hard rules, with nothing to install. A paid edition with the same workflow plus two zero-dependency helper scripts (runner detection, one run, rerun-and-classify) is listed on Agensi.

Full SKILL.md on ClawHub

Install Test Fix in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

FAQ

What does the Test Fix skill do?

Fix failing tests without weakening them — run the suite once, rerun only the failing files to separate flaky from real failures, classify each real failure as source bug or wrong test, then propose minimal diffs for approval. Use when asked to fix failing tests or make the suite green.

How do I install the Test Fix skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the Test Fix skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare Test Fix with