Skip to content
Back to search

Test Fix

SkillWorks with Claude CodeGitHub

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.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/winsoftlabs30--test-fix-skill/badge.svg)](/listings/winsoftlabs30--test-fix-skill)

HTML

<a href="/listings/winsoftlabs30--test-fix-skill"><img src="/api/listings/winsoftlabs30--test-fix-skill/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

npx skills add WinSoftLabs30/test-fix-skill

On ClawHub (OpenClaw): `openclaw skills install @winsoftlabs30/test-fix`, or `clawhub install @winsoftlabs30/test-fix` with the ClawHub CLI.

Or copy `SKILL.md` into:

- **OpenCode** — `.opencode/skills/test-fix/` in your project, or `~/.config/opencode/skills/test-fix/` for every project - **Claude Code** — `.claude/skills/test-fix/` - **Other agents** — any that read the `SKILL.md` format (Cursor, Codex, Gemini CLI, ...)

No build step, no dependencies. Any Node version works for this manual edition.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

SKILL.md · Manifest · 84 lines
  1. ---
  2. name: Test Fix
  3. description: 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.
  4. ---
  5. # Test Fix (manual edition)
  6. When the user asks to "fix the failing tests" or "make the tests pass", follow this
  7. workflow. This edition has no scripts: you run the commands and apply the same judgment.
  8. ## Step 1 — Run the suite once
  9. Detect the runner from `package.json`:
  10. | Signal | Command |
  11. | --- | --- |
  12. | `vitest` in devDependencies or the test script | `npx vitest run` |
  13. | `jest` in devDependencies or the test script | `npx jest` |
  14. | `@playwright/test` in devDependencies | `npx playwright test` |
  15. | none of the above | the project's own `npm test` |
  16. Record the totals and every failing test (file + name + first line of the message).
  17. - Green means zero failures AND exit code 0.
  18. - A non-zero exit with no listed failures means the suite itself is broken (for example a
  19. test file fails to load). Report that; never call it green.
  20. ## Step 2 — Rerun only the failing files
  21. Rerun each failing file once:
  22. - vitest: `npx vitest run path/to/file.test.ts`
  23. - jest: `npx jest --runTestsByPath path/to/file.test.ts`
  24. - playwright: `npx playwright test path/to/file.spec.ts`
  25. Classify each failure:
  26. - **flaky** — failed, then passed on the rerun. Report only. Do not patch it, and do not
  27. add sleeps or retries to hide the race.
  28. - **consistent** — failed both times. It needs a patch; go to step 3.
  29. ## Step 3 — Judge each consistent failure
  30. Read the failure message, the test, and the source. Decide:
  31. - **source bug** — the production code is wrong. Patch the source.
  32. - **wrong test** — the assertion contradicts the intended behavior. Prove it first
  33. (doc comments, naming, sibling tests, specs). If you cannot prove the test is wrong,
  34. treat it as a source bug. Doubt goes to the code, not the axe.
  35. ## Step 4 — Propose patches (do not apply)
  36. For each failure, write `patches/<n>.md` containing:
  37. 1. a unified diff of the smallest safe change
  38. 2. two lines of rationale: the cause, and why this is the minimal fix
  39. 3. risk: low / med / high
  40. Then write `patches/README.md` with a table:
  41. failure -> cause (source bug / wrong test) -> risk -> patch file.
  42. ## Step 5 — Report and wait
  43. Lead with the verdict, for example:
  44. > 3 failures: 1 source bug, 1 wrong test, 1 flaky — patches in `patches/`, nothing
  45. > applied yet.
  46. List flaky ones as report-only. Then ask for approval. Apply only after explicit
  47. approval, one patch at a time, rerunning the affected test after each.
  48. ## Hard rules
  49. - Never delete, skip, `.skip`, or weaken a test to make it pass.
  50. - Never edit an assertion before proving the production code is right.
  51. - Never apply a patch without explicit approval.
  52. - Flaky means report only — no patch.
  53. - Never silence a failure with sleeps or retries without explaining the real race.
  54. ---
  55. This is the manual edition: the workflow and the hard rules, with nothing to install.
  56. A paid edition with the same workflow plus two zero-dependency helper scripts (runner
  57. detection, one run, rerun-and-classify) is listed on Agensi.
README.md · README · 55 lines
  1. # Test Fix — fix failing tests without cheating
  2. [![skills.sh](https://skills.sh/b/WinSoftLabs30/test-fix-skill)](https://skills.sh/WinSoftLabs30/test-fix-skill)
  3. When an AI agent is asked to fix failing tests, the default behavior is an eager intern:
  4. it edits the test to match the broken code, deletes the flaky test, or changes five files
  5. for a one-line bug — and calls it "fixed". This skill turns that into a careful senior dev.
  6. ## What it does
  7. 1. Runs the suite once and records every failing test.
  8. 2. Catches broken test files: a suite that fails to load is reported as a failure, never
  9. as green.
  10. 3. Reruns only the failing files to separate **flaky** (failed, then passed) from
  11. **consistent** (real failures).
  12. 4. Judges each consistent failure: **source bug** or **wrong test** (doubt goes to the
  13. code).
  14. 5. Proposes the smallest patch per failure as a diff in `patches/`, with cause and risk.
  15. 6. Waits for approval — it never applies anything on its own. Flaky means report only.
  16. Hard rules baked in: never delete, skip or weaken a test; never edit an assertion before
  17. proving the source is wrong; never apply without explicit approval.
  18. ## Install
  19. ```
  20. npx skills add WinSoftLabs30/test-fix-skill
  21. ```
  22. On ClawHub (OpenClaw): `openclaw skills install @winsoftlabs30/test-fix`, or
  23. `clawhub install @winsoftlabs30/test-fix` with the ClawHub CLI.
  24. Or copy `SKILL.md` into:
  25. - **OpenCode** — `.opencode/skills/test-fix/` in your project, or
  26. `~/.config/opencode/skills/test-fix/` for every project
  27. - **Claude Code** — `.claude/skills/test-fix/`
  28. - **Other agents** — any that read the `SKILL.md` format (Cursor, Codex, Gemini CLI, ...)
  29. No build step, no dependencies. Any Node version works for this manual edition.
  30. ## Use
  31. Ask your agent: **"fix the failing tests"**. The skill loads and follows the workflow.
  32. ## Manual edition
  33. This repository is the workflow and the hard rules. The paid edition on Agensi adds two
  34. zero-dependency scripts that do the mechanical part — detect the runner, run once, print
  35. failures as JSON, rerun only the failing files and classify each as flaky or consistent.
  36. ## License
  37. MIT-0 — see [LICENSE](LICENSE). Use it, modify it, redistribute it, no attribution
  38. needed. (ClawHub requires MIT-0, so both free channels use one license.)

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.