test-shieldlisted
Install: claude install-skill adnanmokhtar/refract
# Skill: test-shield
## Purpose
A behaviour-preserving fix (refactor, dedup, dead-code, parallelize, cache) is only *safe* if the green suite actually covers the code it touches. On an **uncovered branch**, "tests still pass" proves nothing — the fix can flip behaviour and no test notices. `test-shield` makes the guarantee real: it **pins current behaviour with a test BEFORE the fix**, so any post-fix divergence turns the suite red.
This is the pre-sweep counterpart to `smoke-verify` (which runs after). Dead-code removal is already coverage-gated via `dead-branch-scan`; this closes the same gap for the refactoring + perf verbs.
## When to use
- Dispatched in **Phase 0** of `/optimize` and `/audit` (before any structural/perf fix), per in-scope file set.
- On demand: `pin coverage before refactoring <area>`.
- N/A for pure additive work (new feature, new file) — there's no existing behaviour to preserve.
## Procedure (stack-conditional via PROJECT_KIND + project test runner)
1. **Determine the touched set**: the files/functions the planned fix will modify (from the optimize/audit finding's scope).
2. **Measure coverage** of that set using the project's coverage tool (reuse `testing/skills/coverage-gap/SKILL.md`; runner from `ai/stack.md` § Scripts — `pytest --cov` / `vitest --coverage` / `jest --coverage` / `go test -cover` / etc.).
3. **For each touched branch with no covering test**:
- Dispatch `/add-test` to write a **characterization test** that asserts the CURRE