Skip to content
Agentmart
Submit a tool

bug-to-contract

Promote a review finding or bug fix into a contract test that prevents the underlying invariant violation from recurring.

Skill by ultimatile

IndexedMIT
Write a review

Chalk Labs

Need help deploying bug-to-contract?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/ultimatile-bug-to-contract

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

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.

Use cases: documents, testing, security

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/bug-to-contract

What's inside

Skill name
bug-to-contract
Description
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.
License
MIT
Instructions
96 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Bug-to-Contract

Review findings and bug fixes address symptoms. This skill asks: **what implicit specification was violated, and is that specification now tested?**

## Inputs

This skill works from two kinds of input. The fix-commit lane uses a **root** on `diff-root`'s consumer contract, halt included; the review-findings lane uses none.

| 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 <root-rev>..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.

## Core procedure

### 1. Collect signals

**From review findings:**

- For each actionable finding that resulted in a code change, note what the issue was and what changed.

**From fix commits:**

- Examine the diff of each fix commit:
  ```bash
  git log <root-rev>..HEAD --oneline --grep="fix" -i
  git show <commit-sha>
  ```

### 2. Ask the contract question

For each signal, determine:

1. **What broke?** — The specific symptom (wrong output, crash, silent corruption, reviewer complaint, etc.)
2. **What implicit specification was violated?** — The unstated property that users expect to hold. This is the contract. Examples:
   - Memory layout should not affect computation results
   - Operation order in einsum should not affect results (up to floating-point tolerance)
   - Transpose is an involution: `transpose(transpose(A)) == A`
   - Scalar type promotion should be consistent across operations
   - Empty inputs should produce empty outputs with correct shape
3. **Is this contract already tested?** — Search for existing tests that verify this property in general, not just the specific case that broke.

### 3. Search for existing contract tests

Look for tests that verify the identified contract beyond the specific case:

```bash
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.

### 4. Classify the contract

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)` |

### 5. Propose the contract test

Write a test (or propose one) that verifies the **general contract**, not just the specific case that broke. The test should:

- **Vary the representation**: If it's a layout bug, test with all valid layouts
- **Use multiple inputs**: Not just the one that triggered the issue
- **State the contract explicitly**: The test name and/or comment should name the property being verified

### 6. Check for related contracts

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.

### 7. Report

Present to the user:

1. **The implicit contract** that was violated (one sentence)
2. **Whether it was already tested** (yes/no + evidence)
3. **Proposed contract test** (code or description)
4. **Related contracts** that may also be untested

## Important principles

- **Name the contract**: If you can't name the implicit specification in one sentence, you haven't understood the issue yet.
- **Patterns are escalation-worthy**: A cluster of findings in the same category (e.g., three layout-related issues in one review cycle) indicates a systematically untested contract. Escalate this to the user.
- **Don't boil the ocean**: One contract test per finding is enough.

From ultimatile/development-skills, MIT.

More from ultimatile/development-skills

Signals

Stars
0
Forks
0
Open issues
71
Last commit (this folder)
Oct 11, 2026 (19 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from ultimatile

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get bug-to-contract running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying bug-to-contract?

CallGet help
Cite this page

bug-to-contract skill. Agent Mart. https://agentmart.dev/skills/ultimatile-bug-to-contract (last updated 2026-10-24)