Skip to content
SkillModel-led700 tokens in use

implement-patch

The patcher stage of patching-bugs: find the broken invariant, write a regression test that fails first, fix it, and leave one local commit.

8,319 stars on the repository CC-BY-SA-4.0trailofbits/skills · plugins/patching-bugs/skills/implement-patch
/plugin marketplace add trailofbits/skills
View source

Install command as written in the repository's README

Skill label

measured from its files

What installing implement-patch costs

26tokens idle
700tokens in use

Idle is what sits in context while the skill is installed. In use is its instructions, loaded when it runs. Counts are approximate, made offline with cl100k_base.

Model dependence Model-led

Script-ledMixedModel-led

Mostly instructions, so how well it works depends on the model that follows them.

This describes the skill's structure, how much of it is scripts. It does not say how well it works.

Touches

shelldetected

Declared tags come from the skill's frontmatter; detected ones from its scripts, its code blocks and the commands it names in inline code. This is detected, not audited.

How it scores

Quality

How well the skill is written, counted from its own files: its frontmatter, its steps, examples, stated output and constraints, its size and whether every file it ships is one it names.How we score it →
Good
  • Frontmatter12/15
  • Structure22/25
  • Examples6/15
  • Output10/15
  • Size11/15
  • Resources10/15

Security

Starts at 100 and loses points for each thing in the skill's files that a reader should look at first.How we score it →
Excellent

No findings.

Repository health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
Good
  • Development activity100
  • Maintenance52
  • Community64
  • Maturity32
  • Momentum40

Implement-patch is used after independent validation confirms one bug claim. The agent checks that a repair scope exists, identifies the invariant that was broken, and searches inside its boundary for every other instance of the same violation.

It writes a regression test that fails on the baseline, makes the smallest reviewable fix, reruns the full suite, and records every variant as fixed or not fixed. The result is one local commit, two patch files and a patch record with a manifest.

What You Get

  • A single local commit that carries the fix and its regression test
  • fix.patch for production changes and tests.patch for test changes, taken from the baseline
  • A patch.json with both commit SHAs, file and line counts, variants, suite results and the agent identity
  • A manifest covering the whole attempt directory

Common Use Cases

  • Repairing a bug that a validator has confirmed
  • Finding sibling instances of the same invariant violation before closing a bug
  • Retrying a repair after a prover rejected an earlier attempt

What Makes It Unique

The skill refuses to start when the record check fails and returns an inconclusive report with the errors. It asks for the invariant to be fixed, so every instance in the declared boundary is searched, and it requires the regression test to be seen failing before the fix. It stops at one local commit and never pushes or opens a pull request.

Under The Hood

The agent reads a short SKILL.md and a record contract shared with the other patching stages. It runs a bundled Python record validator through uv before editing and again to write a manifest. It runs the project’s own test suite before and after, edits source and test files, creates one Git commit and writes patch files and a JSON record. It makes no network calls and never pushes.

Join founders building with open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on SubstackJoin 750+ subscribers