From development-skills
Promote a review finding or bug fix into a contract test that prevents the underlying invariant violation from recurring. Companion to finding-to-audit, which elevates to diff-time rules instead.
How this skill is triggered — by the user, by Claude, or both
Slash command
/development-skills:bug-to-contractThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Review findings and bug fixes address symptoms. This skill asks: **what implicit specification was violated, and is that specification now tested?**
Review findings and bug fixes address symptoms. This skill asks: what implicit specification was violated, and is that specification now tested?
A single fix prevents one bug. A contract test prevents the entire class.
This skill works from two kinds of input:
| Input | What to collect |
|---|---|
| Review findings | Actionable findings from any review pass (codex, Copilot, human reviewer) that resulted in code changes. The reviewer's framing of the issue. |
| Fix commits | Branch commits whose subject signals a fix: git log main..HEAD --oneline --grep="fix" -i, then git show <sha>. |
When both are available, prefer review findings — a reviewer saying "this doesn't handle column-major layout" is a stronger signal than a commit message.
From review findings:
From fix commits:
git log main..HEAD --oneline --grep="fix" -i
git show <commit-sha>
For each signal, determine:
transpose(transpose(A)) == ALook for tests that verify the identified contract beyond the specific case:
grep -r "test.*layout\|test.*order\|row_major.*column_major" --include="*.rs" tests/
If a test exists that covers the general contract, the contract is already guarded. Report this and stop.
Identifying the category helps write a general test rather than a point fix test.
| Category | Description | Example |
|---|---|---|
| Representation invariance | Result is independent of internal representation choices | Memory layout, stride order, storage format |
| Algebraic identity | Mathematical property that must hold | Involution, associativity, commutativity |
| Structural preservation | Shape, type, or metadata properties preserved through operations | Output shape matches specification, dtype preserved |
| Boundary behavior | Correct handling of edge cases | Empty input, zero-size dimension, single element |
| Semantic equivalence | Different spellings of the same operation produce the same result | einsum("ij,jk->ik", A, B) == matmul(A, B) |
Write a test (or propose one) that verifies the general contract, not just the specific case that broke. The test should:
Once a contract is identified, look for related contracts in the same category. If memory layout invariance was violated for GEMM, it could also be violated for SVD, QR, eigendecomposition, solve, etc.
Propose tests for related operations if they are missing.
Present to the user:
Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub ultimatile/development-skills --plugin development-skills