Skip to main content

Build

Implement Patch

Trail of BitsOfficialCertified

Use when a confirmed local bug needs an invariant-level fix, variant search, tests, and one local commit.

  • New
  • v1.0.0
  • Reviewed Oct 21
  • No reviews yet

Capabilities

  • When NOT to Use

    Do not use for speculative bug hunting, proof of a completed patch, or a change that

  • Procedure

    Use the declared scope as the repair brief

Getting started

Full instructions

Install the skill, then ask your AI tool for the task in plain words. The full SKILL.md below shows what it covers.

Instructions: SKILL.mdv1.0.0

Implement Patch

When to Use

Use after independent validation confirms one claim. Read the
record contract.
Before target commands, follow its project guidance.

When NOT to Use

Do not use for speculative bug hunting, proof of a completed patch, or a change that
cannot be exercised by the local compiler or runtime.

Procedure

  1. Before editing, run uv run --no-project <script> check --before-repair <run-dir>
    with the record validator. If this check fails,
    stop and return its errors for an INCONCLUSIVE report. The gate requires
    finding.repair_scope with a usable case plan and a consistent attempt count.
    Use the declared scope as the repair brief. Identify the broken
    invariant and search within its boundary for every instance of the
    same violation. Read the threat model only to preserve intended behavior; it is
    not a gate.

  2. Run the project's existing suite and record its results. Write a regression test
    that fails on the baseline for the named bug and any fixed variant. Observe the
    failure. Fix the invariant within the repair brief with the smallest reviewable change.

  3. Run the regression test and full existing suite again. Compare before and after
    failures. Fix new failures or explain a pre-existing one from receipts.

  4. Record every variant as fixed or not_fixed with a reason. Produce exactly one
    local commit. Never push or open a PR. From the baseline, write fix.patch for
    production changes and tests.patch for test changes in patch/attempt-N/.

  5. Write patch.json with the two commit SHAs, changed-file and line counts,
    variants, suite results, and your agent identity. If the attempt produced no commit,
    record patch_commit: null and return it as failed. Manifest the entire attempt
    directory, including both patch files and the record, using
    uv run --no-project <script> manifest <patch-attempt-dir>. Check it with the
    record validator.

    Patch record schema:

json
{
  "schema_version": 1,
  "attempt": 1,
  "baseline_commit": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "patch_commit": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
  "files_changed": 2,
  "lines_added": 3,
  "lines_removed": 1,
  "variants": [],
  "suite_before": {"command": "pytest", "passed": 9, "failed": 1, "skipped": 0},
  "suite_after": {"command": "pytest", "passed": 10, "failed": 0, "skipped": 0},
  "agent": "patcher-1"
}

Rationalizations to Reject

Shortcut Required action
Only the reported line matters. Search for the same invariant violation.
Minimal means the fewest lines. Make the smallest reviewable invariant-level fix.
Tests pass after the patch. Show the regression test failed before it.

Explore more skills

Browse all
This skill doesn’t include stateful context yet, instructions only. Learn about stateful skills.

Security

Loading security scan...

Signing

SignedSLSA L2
Signed by
skills-hub.ai distributor
Method
Distributor-signed by skills-hub.aiSigned with the skills-hub.ai Ed25519 distributor key over this exact slug, version and content. Check it with `npx @skills-hub-ai/cli verify`.
Key
skills-hub-ed25519-2026-11
Signed

Reviews (0)

More from Trail of Bits

View source →

Frequently asked questions about implement-patch

What does the implement-patch skill do?

Use when a confirmed local bug needs an invariant-level fix, variant search, tests, and one local commit. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.

How do I install the implement-patch skill?

Run `npx @skills-hub-ai/cli install trail-of-bits-implement-patch` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/trail-of-bits-implement-patch/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.

Which AI tools does implement-patch work with?

implement-patch runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.

Is the implement-patch skill free?

Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.

How do I use implement-patch after installing it?

In Claude Code, type `/trail-of-bits-implement-patch` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.

Can I share the implement-patch skill with my team?

Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.

Badge for your README

Show that this skill is on Skills Hub. The badge links back to this page and shows the live install count.

Install on Skills Hub badge preview
Markdown
[![Install on Skills Hub](https://skills-hub.ai/api/badges/skill/trail-of-bits-implement-patch)](https://skills-hub.ai/skills/trail-of-bits-implement-patch)
HTML
<a href="https://skills-hub.ai/skills/trail-of-bits-implement-patch"><img src="https://skills-hub.ai/api/badges/skill/trail-of-bits-implement-patch" alt="Install on Skills Hub"></a>

More options in the badge docs.