Minimise
Testing & QualityminimiseMinimise is an Agent Skill for testing & quality published in the chalk-lab/Mooncake.jl repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Prune a bug fix or new tests down to the smallest correct diff through multiple elimination passes. Use before committing any fix or test addition.
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Inspect the Agent Skill at https://github.com/chalk-lab/Mooncake.jl/blob/HEAD/.claude/skills/minimise/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/minimise, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
Minimise
The goal is to remove every line that is not strictly required for correctness, then verify the result still passes the relevant tests.
Process
Repeat the following until no further reductions are possible:
-
Read the diff. Run
git diff HEAD(orgit diff --cachedif staged) and read every changed file in full. -
Challenge each change. For every changed line ask:
- Would removing this line cause a test to fail or a bug to reappear?
- Is this a cleanup, rename, refactor, or comment that is not load-bearing?
- For new tests: does an existing test already cover this behaviour? If so, drop the new test entirely.
-
Remove non-essential changes. Delete anything that does not answer "yes" to the first question above. Prefer shrinking an existing case over adding a new one.
-
Run the minimal test group. Use the smallest focused test group that exercises the changed code (see
test/runtests.jlfor group names). Confirm all tests pass before continuing. -
Repeat from step 1 until a full pass produces no further removals.
Heuristics
- A one-line fix is better than a five-line fix.
- A new test case added to an existing
@testsetis better than a new@testset. - A new value constructor in
src/test_resources.jlshould be the minimum needed to instantiate the type under test; no extra fields or variants. - Comments and blank lines added alongside a fix are not load-bearing; remove them unless they explain something non-obvious.
- Helper functions introduced solely for the fix are a red flag; inline them.
When to stop
Stop when every remaining line answers "yes" to: if I remove this, the targeted bug reappears or the targeted test fails. At that point report the final diff and suggest committing.