- Home
- Skills
- Testing & Debugging
- Fix Failing Tests Without Skipping or Weakening Them
More screenshots
Works with the AI Agents you already use
Fix Failing Tests Without Skipping or Weakening Them
Gets a red test suite back to green by fixing the real cause of each failure, never by deleting, skipping or loosening tests without your OK.
Free
Fix Failing Tests Without Skipping or Weakening Them
Example session with this skill installed
The tests are failing. Fix them.
- Read your context and instructions
- Compiled the fix failing tests
Test suite: still failing, needs your decision
Before: the test file couldn't load (0 of 9 tests ran) · After: 1 failed / 9 total
Command: npm test (vitest run)
Fixed
| Test(s) | Category | Root cause | Fix |
|---|---|---|---|
Whole file (Cannot find package '@/shipping') | Environment/setup | Commit e649fbb ("Tidy vitest config") removed the @ alias from the vitest config. tsconfig.json still maps @/* to src/*. | vitest.config.ts:5: put the resolve.alias back and kept the new test.include |
freeShippingEligible › members qualify from exactly $25 | Code bug | The same commit changed orderTotal >= 25 to > 25. That contradicts the docstring, which says members get free shipping "from $25". | src/shipping.ts:38: back to >= 25 |
shippingCost › prices any allowed weight | Flaky | The test picked a random weight from 0.1 to 50.1 kg, so about 40% of runs used a weight over 30 kg, which the code rejects. | test/shipping.test.ts:21: the random weight is replaced with fixed weights 0.1, 1, 2, 2.1, 15, 29.9 and 30 kg, which cover the whole allowed range and its edges. The check (toBeGreaterThan(0)) is unchanged. It passed 5 out of 5 runs on its own. |
Needs your decision
| Test | Why I think the test is wrong | Proposed change |
|---|---|---|
shippingCost › charges the international base rate | The test expects 15 and the code returns 18. Commit d8f0192 ("Raise international base rate to $18 (carrier contract renewal)") and the CHANGELOG.md 1.1.0 entry both show the $18 rate was deliberate. | test/shipping.test.ts:9: .toBe(15) → .toBe(18) |
Reply
yes to update the test as shown,
no if the test is right and the source should change instead (I'll propose that change and ask again before editing anything), or
leave it to change nothing.
Unresolved
| Test | Category | What's blocking | Suggested next step |
|---|---|---|---|
| none |
Test integrity (checked against git diff)
No tests were deleted, skipped or loosened, and no expected values were changed. The one test edit was the flaky fix: prices any allowed weight now uses fixed weights instead of a random one, with the same check.
Files changed (from git diff)
vitest.config.ts: put back the@→./srcpath aliassrc/shipping.ts: members qualify for free shipping at exactly $25 again (>= 25)test/shipping.test.ts: random weight replaced with fixed weights covering the allowed range; same check
Final check output
src/shipping.ts | 2 +-
test/shipping.test.ts | 5 +++--
vitest.config.ts | 2 ++
3 files changed, 6 insertions(+), 3 deletions(-)
Already modified before this run
- none
You: approved
Test suite: passing
Before: the test file couldn't load (0 of 9 tests ran) · After: 0 failed / 9 total
Command: npm test (vitest run)
Fixed
| Test(s) | Category | Root cause | Fix |
|---|---|---|---|
Whole file (Cannot find package '@/shipping') | Environment/setup | Commit e649fbb removed the @ alias from the vitest config. tsconfig.json still maps @/* to src/*. | vitest.config.ts:5: put the resolve.alias back and kept test.include |
freeShippingEligible › members qualify from exactly $25 | Code bug | Commit e649fbb changed >= 25 to > 25, which contradicts the docstring ("from $25"). | src/shipping.ts:38: back to >= 25 |
shippingCost › prices any allowed weight | Flaky | The random weight (0.1 to 50.1 kg) often went over the 30 kg limit. | test/shipping.test.ts:21: fixed weights 0.1, 1, 2, 2.1, 15, 29.9 and 30 kg; same check; passed 5 out of 5 runs on its own |
shippingCost › charges the international base rate | Outdated test | Commit d8f0192 and CHANGELOG 1.1.0 raised the international base rate to $18. | test/shipping.test.ts:9: .toBe(15) → .toBe(18) |
Needs your decision
none
Unresolved
none
Test integrity (checked against git diff)
One expected value was changed: charges the international base rate, from 15 to 18, after you approved
this test change ("approved"). The other test edit is the flaky fix: prices any allowed weight now uses fixed weights instead of a random one, with the same check. No tests were deleted, skipped or loosened.
Files changed (from git diff)
vitest.config.ts: put back the@→./srcpath aliassrc/shipping.ts: members qualify for free shipping at exactly $25 again (>= 25)test/shipping.test.ts: fixed weights instead of a random one, same check; international base rate expectation 15 → 18 (approved: test change)
Final check output
src/shipping.ts | 2 +-
test/shipping.test.ts | 7 ++++---
vitest.config.ts | 2 ++
3 files changed, 7 insertions(+), 4 deletions(-)
Already modified before this run
- none
Nothing is committed yet.
Tip: green tests don't prove they'd catch a regression. The Mutation-Verified Test Generator skill measures that with a mutation score.
Connects securely to your tools. The creator never sees your data.
About this skill
The problem
Ask an AI agent to "make the tests pass" and it often will, by editing the
expected value, wrapping a flaky test in a retry, or adding .skip. The
suite turns green and the bug ships. Tests are your specification;
silencing them isn't fixing them.
What this skill does
It treats every failing test as evidence, and works out why it fails before changing anything. Each failure gets exactly one category:
| Category | What it means | What the agent changes |
|---|---|---|
| Code bug | The code is wrong, the test is right | The source, with the smallest fix |
| Outdated test | Behaviour changed on purpose (commit, changelog, docs) | Nothing until you decide. It shows the evidence and the exact diff, then asks: yes, no or leave it (see below) |
| Environment/setup | Missing alias, wrong config, moved fixture file, missing dependency | In-repo config; anything outside the repo is given to you as a command |
| Flaky | Passes and fails on the same code | Removes the nondeterminism (time, randomness, ordering, shared state) |
When the evidence is unclear, it assumes the test is right.
When a test looks outdated, you choose:
- yes: it updates the test's expected value as shown.
- no: the test is right, so the source should change instead. It doesn't edit anything yet. It shows the evidence that the source change looked deliberate, the exact source diff, a warning that this reverses an intentional-looking change, and what else depends on the value. Then it asks again: yes to apply that source change, or leave it.
- leave it: nothing changes; the test is reported as unresolved and the suite stays failing.
Each edit needs its own "yes" to its own question, and the report says which approval covered which change.
Hard rules. It never deletes or skips a test, loosens an assertion,
changes an expected value, updates snapshots, or adds retries or sleeps,
unless you explicitly approve after it explains why the test itself is
wrong. It never installs packages without asking, and never opens .env
or other secrets.
Who it's for
Anyone who's had a suite break after a refactor, merge or dependency bump, and wants it fixed properly. Also teams who want an agent they can point at CI failures without worrying it will quietly hollow out their tests.
What the agent does, step by step
- Runs your project's own test command and groups failures by shared root cause.
- Collects evidence for each one: the failure, the code at the trace, recent git history of the test and the source, docs and changelog, isolated and repeated runs.
- Assigns a category and fixes environment issues first, then code bugs, then flaky tests. For outdated tests, it asks (yes / no / leave it) and edits nothing for that test until you answer.
- Re-runs the full suite (at most three passes through steps 2–4, so it won't thrash).
- Reports what was fixed and how, what needs your decision, what's unresolved, and a test integrity line confirming nothing was weakened.
Example output
From a real run on a broken TypeScript + Vitest project (the first report, before any answer; verbatim, shortened after the question). The full run, including the report after "approved", is in the example file.
## Test suite: still failing, needs your decision
**Before:** the test file couldn't load (0 of 9 tests ran) · **After:** 1 failed / 9 total
**Command:** `npm test` (`vitest run`)
### Fixed
| Test(s) | Category | Root cause | Fix |
|---|---|---|---|
| Whole file (`Cannot find package '@/shipping'`) | Environment/setup | Commit `e649fbb` ("Tidy vitest config") removed the `@` alias from the vitest config. `tsconfig.json` still maps `@/*` to `src/*`. | `vitest.config.ts:5`: put the `resolve.alias` back and kept the new `test.include` |
| `freeShippingEligible › members qualify from exactly $25` | Code bug | The same commit changed `orderTotal >= 25` to `> 25`. That contradicts the docstring, which says members get free shipping "from $25". | `src/shipping.ts:38`: back to `>= 25` |
| `shippingCost › prices any allowed weight` | Flaky | The test picked a random weight from 0.1 to 50.1 kg, so about 40% of runs used a weight over 30 kg, which the code rejects. | `test/shipping.test.ts:21`: the random weight is replaced with fixed weights 0.1, 1, 2, 2.1, 15, 29.9 and 30 kg, which cover the whole allowed range and its edges. The check (`toBeGreaterThan(0)`) is unchanged. It passed 5 out of 5 runs on its own. |
### Needs your decision
| Test | Why I think the test is wrong | Proposed change |
|---|---|---|
| `shippingCost › charges the international base rate` | The test expects 15 and the code returns 18. Commit `d8f0192` ("Raise international base rate to $18 (carrier contract renewal)") and the `CHANGELOG.md` 1.1.0 entry both show the $18 rate was deliberate. | `test/shipping.test.ts:9`: `.toBe(15)` → `.toBe(18)` |
Reply **yes** to update the test as shown, **no** if the test is right and the source should change instead (I'll propose that change and ask again before editing anything), or **leave it** to change nothing.
Supported
| Tested | Jest, Vitest and pytest projects (code bugs, outdated tests, setup problems, flaky tests, a missing dependency) |
| Also works | Any test runner the project uses (node:test, Mocha, unittest, Go and others). The workflow is framework-independent |
| Tested agents | Claude Code. Built on the open SKILL.md standard, so it should also work in other agents that support SKILL.md skills. |
| Models | Works best with strong tool-calling models. Smaller or "lite" models may skip steps or follow the rules less reliably. In testing with a full-size Claude model and the small Claude Haiku, no test was weakened, outdated tests were always left for your decision, and approval was never claimed without a real "yes". With a very small "lite" model, the approval rule was not reliably followed, so use a strong model and review the final git diff it reports. |
| Requirements | None. No scripts, instructions only |
Limitations (honest)
- It fixes failing tests; it doesn't write new tests or improve coverage.
- It won't change an expected value on its own, so a suite with outdated tests ends "still failing, needs your decision" until you answer. That's deliberate.
- Answering no doesn't revert your source in one step. It proposes the source change and asks again, so fixing a test the "no" way takes two answers.
- Fixes outside the repo (installing packages, runtime versions, services, CI secrets) are handed to you as exact commands rather than done automatically.
- If it can't run your test command at all, it says so and reports what it could determine, rather than guessing results.
Tags
failing-tests, debugging, flaky-tests, ci, jest, vitest,
pytest, test-maintenance
How to use
Skills on Agensi run inside your AI agent. Copy the prompt, paste it into your agent, and it connects to Agensi and installs this skill for you. If a payment is needed, your agent shows it to you first.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free forever
No account required to browse
Trust & safety
Security scanned
Verified clean 1 day ago
- Free to download with an account
Requires