One agent skill for tests: it stops low-value tests at write time, cuts an existing suite down to the tests that matter, and moves the rest of the intent into Markdown specs.
Most tests in an agent-written repo are a second copy of the logic: they assert constants, mock the helpers the code calls, compute the expected value with the function under test, and stay green when the real bug ships. They also cost every agent run minutes and tokens.
Deleting all of them throws away the part that is not a copy: intent. "The total is never negative" lives in a README or an issue, not in the code, and nothing in the code can check it. testectomy keeps that part and drops the rest.
- Intent goes into
SPEC.md. One file per area, next to the code: numbered rules, example tables, non-goals, open questions. Written from the README, issues and you, never copied from the code.
- Only tests a reader can't replace survive. External boundaries, money and security, concurrency and time, parsers, real past regressions, public contracts. One test per rule, named with the rule ID, at the public boundary.
- Disagreements become bugs, not green tests. When the code contradicts clear intent, the test is written from intent and marked as an expected failure, and the report lists it as a bug.
- Every kept test is bite-checked. The agent breaks the code the rule describes and confirms the test fails on an assertion, then reverts.
- Test-only production code goes too. Exports, reset hooks, injection parameters and dead paths that only tests called are deleted with the tests that kept them alive.
Quick start
npx skills add felipebasurto/testectomy -g
Then, in your agent:
/testectomy
/testectomy src/billing
With no argument it works on the whole repo, one area at a time. Codex uses $testectomy, the Claude Code plugin uses /testectomy:testectomy.
Three modes
| Mode | When | What it does |
|---|
| Gate | Automatically, whenever the agent writes, changes or reviews a test | Asks which rule the test guards, what regression makes it fail and why existing coverage misses it, and rejects it if it matches a junk pattern. Never deletes anything. |
| Pass | You run /testectomy [path] | Specs, a verdict for every test, deletions, gaps filled, bite checks, report |
| Campaign | You ask to prune a whole subsystem in a large repo | The pass split into lanes, with a written ledger per chunk of tests, a layer plan, and an independent review that hunts for contracts that lost their only proof (CAMPAIGN.md) |
The gate loads on its own. Deleting tests only happens when you ask for a pass or a campaign.

Watch it with sound.
For agents
If a user sent you this repo and said "use this":
- Install the skill, unless
testectomy is already in your skills folder: npx skills add felipebasurto/testectomy -g (drop -g for the current project only).
- Pick the scope. The path the user named, or the whole repo. On large repos, do one area per pass.
- Run the skill. Invoke
testectomy, or open skills/testectomy/SKILL.md and follow its nine steps by hand: baseline, inventory, intent, specs, classify, apply, bite-check, AGENTS.md, report.
- Don't commit unless the user asked. End with the report the skill defines, including Bugs and Open questions: those need a human.
How it works
Three layers, cheapest first:
| Layer | Holds | Checked by |
|---|
SPEC.md | Rules, examples, non-goals, open questions | The agent, before and after every change |
| Types and schemas | Shapes, nullability, exhaustiveness | The compiler |
| Executable tests | Only rules that pass the keep bar | The test runner, filtered to the rules a change touches |
Every rule in a spec says how it's checked: type, read (the default) or test. A rule earns test only if at least one of these holds: