Skip to content
Skills Library
Programming · Automation

apply-patch

/apply-patch

Apply multi-file or tricky edits atomically with git apply instead of many fragile edit_file calls. Use when changing several files at once or when edit_file fails to match.

Licence
Apache-2.0
Last repository change
25.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 25.10.2026, without references to retired models or APIs.

Licence

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

What it does and when to use it

Apply multi-file or tricky edits atomically with git apply instead of many fragile edit_file calls. Use when changing several files at once or when edit_file fails to match.

Original author description

Apply multi-file or tricky edits atomically with git apply instead of many fragile edit_file calls. Use when changing several files at once or when edit_file fails to match.

How it works

  1. Procedure
  2. When to prefer this
Original SKILL.md headings · 33 lines, 171 words
SKILL.md preview
---
name: apply-patch
description: Apply multi-file or tricky edits atomically with git apply instead of many fragile edit_file calls. Use when changing several files at once or when edit_file fails to match.
---

# Apply Patch

The built-in `edit_file` does an exact string match on a single file and has no fuzzy
tolerance. For multi-file changes, or when `edit_file` keeps failing to find the string,
construct a unified diff and apply it atomically with git.

## Procedure

1. Write the unified diff to a file in the sandbox (use `write_file` or a heredoc via `execute`):

   ```
   diff --git a/path/to/file b/path/to/file
   --- a/path/to/file
   +++ b/path/to/file
   @@ -10,7 +10,7 @@ context line
   -old line
   +new line
   ```

2. Validate before applying: `git apply --check changes.patch`
3. Apply: `git apply changes.patch` (use `-p0` if paths are not `a/`...`b/`...).
4. If `git apply` rejects the hunk, the surrounding context is stale — `read_file` the exact
   lines again, regenerate the diff with correct context, and retry.

## When to prefer this

- Editing 3+ files for one logical change (atomic, all-or-nothing).
- Repetitive or whitespace-sensitive edits where `edit_file` exact-match struggles.
- Re-applying a patch produced elsewhere (e.g. from a PR or `git diff`).

Always run the verify-changes skill afterwards.

Versions

The database has no other skills named apply-patch.

Database snapshot: 13.11.2026 · package version a3249d42319e (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 90evo-patch-generate-apply
    Generates git-compatible unified diff patches from original and modified file contents, writes them to numbered patch files, and applies them to the repository using git apply or GNU patch. Use when you need to create code patches, apply fixes to source files, or automate code…
  • 100safe-patch
    Deliver a change as one patch for git am that is proven to apply on its base commit and to pass the tests there, without touching the owner's working tree, with a written rollback. Also checks a patch someone else made, and audits a release (inventory, versions, artifacts,…
  • 90duck-patch
    Surgical implementation for small, bounded code edits after direction is clear. Use when: "apply this fix", "make a targeted edit", "patch this", "implement the agreed change".
  • 100duck-patch
    Surgical implementation for small, bounded code edits after direction is clear. Use when: "apply this fix", "make a targeted edit", "patch this", "implement the agreed change".
  • 100batch-operations
    Apply one change across many files safely - preview, execute, verify. Use for renames, bulk edits and migrations.
  • 100generating-patches
    Generates git patch files from codebase modifications for local application. Use when user mentions patch, diff, export changes, bring changes back, apply locally, or after editing uploaded codebases.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.