Retroactive test check

From SDiamante13/dotfiles · View interactive version

Retroactive test check is an AI agent skill from the GitHub repository SDiamante13/dotfiles. Use when adding a test to an existing codebase for behavior that is already implemented. Ensures the test is meaningful by mutation-verifying it — breaking the production code to confirm the test fails for the expected reason. Triggers when the user says "add a test for existing behavior", "backfill

How to use this skill

Skill file

Retroactive Test Coverage Verification

When adding tests for behavior that is already implemented (the test passes on first run without any code changes), you MUST verify the test is meaningful by performing mutation-style verification.

When This Applies

Required Process

  1. Write the test and confirm it passes.
  2. Break the behavior — make a targeted change to the implementation that should cause the test to fail (e.g., remove a header, change a status code, return a wrong value).
  3. Run the test and verify it fails for the expected reason — the failure message should clearly indicate the broken behavior, not an unrelated error.
  4. Restore the implementation to its original state.
  5. Run the test again and verify it passes.

What "Break the Behavior" Means

Make the smallest change that invalidates what the test asserts. Examples:

If the test has multiple assertions covering different aspects, verify at least one mutation per distinct behavior being tested.

Common Failure Modes (why first-run-green is a yellow flag)

Why

A test that passes without ever failing proves nothing. Mutation verification is lightweight and provides confidence that the test suite will actually catch regressions.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.