Software DevelopmentOfficial · trailofbits

Implement Patch skill for Claude

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

Implement Patch SKILL.md

The full skill file from trailofbits/skills (CC-BY-SA-4.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:

{
  "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

ShortcutRequired 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.

How to install Implement Patch

Claude Code

Copy the skill into your personal skills folder (or into .claude/skills/ inside a project):

npx degit trailofbits/skills/plugins/patching-bugs/skills/implement-patch#main ~/.claude/skills/implement-patch

Codex

npx degit trailofbits/skills/plugins/patching-bugs/skills/implement-patch#main ~/.codex/skills/implement-patch

Claude.ai and Claude Desktop

Download the skill folder from GitHub, zip it, and upload it under Settings → Capabilities → Skills.

Frequently asked questions

+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.

+How do I install Implement Patch in Claude Code?

Copy the skill folder into ~/.claude/skills/implement-patch, for example with "npx degit trailofbits/skills/plugins/patching-bugs/skills/implement-patch#main ~/.claude/skills/implement-patch". Claude Code loads it automatically and uses it when a task matches.

+Does Implement Patch work with ChatGPT or Codex?

Yes. Implement Patch uses the open SKILL.md format. In Codex, put the folder in ~/.codex/skills/implement-patch. In Claude.ai, zip the folder and upload it under Settings → Capabilities → Skills.

+Is Implement Patch free?

Implement Patch is published on GitHub by trailofbits under the CC-BY-SA-4.0 license, which allows free use.

Related software development skills

  1. Code Review

    Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes: Standards (does the code follow this repo's…

    mattpocock/skills★ 327k
  2. Using Agent Skills

    Discovers and invokes agent skills. Use when starting a session, or when you need to decide which skill or workflow applies to the piece of…

    addyosmani/agent-skills★ 119k
  3. Build

    Fully automate a coding task with make-plan, do, and babysit.

    thedotmack/claude-mem★ 118k
  4. Modern Cpp

    Official

    Guides C++ code toward modern idioms (C++20/23/26). Use when writing new C++ code, modernizing legacy patterns, or working on…

    trailofbits/skills★ 8.3k
  5. Modern Python

    Official

    Configures Python projects with modern tooling (uv, ruff, ty).

    trailofbits/skills★ 8.3k
  6. Open Sourcing

    Official

    This skill should be used when the user asks to "open source this project", "prepare this repository for public release", "make this repo…

    trailofbits/skills★ 8.3k
  7. Patching Bugs

    Official

    Use when a known bug or falsifiable bug hypothesis in a local codebase needs a patch commit and reviewable proof report.

    trailofbits/skills★ 8.3k
  8. Post Patch Validation

    Official

    Validates security patches with reproducible baseline-versus-patched evidence, including original exploits, root-cause variants, behavior…

    trailofbits/skills★ 8.3k
  9. Prepare Regression

    Official

    Use when pinning before/after sources and collecting PR or commit context for a regression investigation.

    trailofbits/skills★ 8.3k

See all software development skills →

More skills from trailofbits

  1. Interpreting Culture Index

    Official

    Interprets Culture Index (CI) surveys, behavioral profiles, and personality assessment data.

    trailofbits/skills★ 8.3k
  2. Let Fate Decide

    Official

    Draws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated.

    trailofbits/skills★ 8.3k
  3. Libafl

    Official

    Builds custom fuzzers with LibAFL, the modular Rust fuzzing library.

    trailofbits/skills★ 8.3k

All skills by trailofbits →

Give your whole team an AI agent with skills

Cody runs managed AI agents your team can message in Slack, Teams, WhatsApp and the web, with 50+ business integrations, scheduled tasks and memory. No terminal required.