Skip to content
Agentmart
Submit a tool

bugfix-contract

Synthesize a bug's behavior contract before patching: a behavior matrix from the issue, every visible assertion on the same behavior, conflicts resolved in…

Skill by lasertsole

IndexedMIT★ 5
Write a review

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/lasertsole-bugfix-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

Synthesize a bug's behavior contract before patching: a behavior matrix from the issue, every visible assertion on the same behavior, conflicts resolved in the issue's favor, and a minimal patch that satisfies both. Use for bug fixes judged by tests you cannot fully see.

Use cases: documents

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 and code. 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/bugfix-contract

What's inside

Skill name
bugfix-contract
Description
Synthesize a bug's behavior contract before patching: a behavior matrix from the issue, every visible assertion on the same behavior, conflicts resolved in the issue's favor, and a minimal patch that satisfies both. Use for bug fixes judged by tests you cannot fully see.
License
MIT
Instructions
61 lines in SKILL.md · view on GitHub

Before installing

  • Instructions call the network

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Bugfix Contract

A discipline for bug-fix tasks whose acceptance criteria are **not fully visible**: derive the
behavior contract first, then patch. The failure this prevents is patching the *symptom* while
missing the intended semantics — or worse, aligning the fix with an old test that encodes the bug.

## 1. Behavior matrix

From the issue, extract a matrix of **input → expected rendering/behavior**. Put the issue's own
example(s) in it verbatim. Add the neighboring cases the same code path handles (the fix will
touch them): rule out each row explicitly or keep it as a suspected-affected row.

## 2. Collect the visible contract

Find **every existing assertion** on the same behavior: the repo's tests, doc examples, doctests,
string fixtures. Record what each expects. Two outcomes matter:

- an existing assertion that matches the issue's expectation → it is your regression anchor;
- an existing assertion on the *same behavior* that **contradicts** the issue (it asserts exactly
  what the issue calls wrong) → it is a conflict signal, not a constraint (see step 3).

## 3. Conflict rule: the issue wins

When an issue reports rendering/behavior as inaccurate and an existing test asserts that exact
behavior, the acceptance suite for such a fix usually **flips that test**. So:

- treat the conflicting old assertion as *expected to change*; do not bend the fix to satisfy it;
- derive the fix from the issue's semantics (what the correct behavior must be) and the code's
  own invariants — not from the old expectation;
- **record the trade-off explicitly** in your final reply ("test X asserted the old behavior; the
  fix intentionally changes it"), so a reviewer can see the decision instead of discovering it.

## 4. Minimal-patch discipline

- change the least mechanism that makes the matrix correct — prefer fixing the root cause over
  adding a special case for the issue's exact input;
- the patch must keep the *non-conflicting* existing tests green (run them);
- a patch that only moves the symptom (fix one input, break a sibling input) is not done:
  re-check the whole matrix.

## 5. Reach for the upstream fix (when the environment allows)

Before inventing the contract, check whether it already exists upstream: extended git history
(`git log --all`, tags beyond the checkout), the project's issue/PR tracker, or a web search.
Probe availability with one bounded attempt (a short `curl -m 5` or a search call); if the
environment is offline, say so and fall back to the matrix — do not silently skip this step.

## 6. Pre-submit self-check

Run the matrix, row by row, in the actual repo (the rows that are runnable). List the rows you
could **not** run and why. State, in one line per row, expected vs actual. "The issue's example
now renders correctly" is necessary but not sufficient — the neighboring rows are the test.

## Honest boundary

This raises the odds; it does not guarantee the hidden contract. When the intended boundary
between two defensible behaviors is genuinely underdetermined by everything visible, the honest
move is to state both readings in your reply and pick the one most consistent with the issue and
the code's invariants — not to guess silently.

From lasertsole/sherry_agent, MIT.

More from lasertsole/sherry_agent

Signals

Stars
5
Forks
1
Open issues
0
Last commit (this folder)
Oct 17, 2026 (12 days ago)
Last release
Oct 18, 2026 (10 days ago)

From GitHub (fetched Oct 24, 2026).

Details

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

More from lasertsole

Cite this page

bugfix-contract skill. Agent Mart. https://agentmart.dev/skills/lasertsole-bugfix-contract (last updated 2026-10-24)