apply-patch

apply-patch is a skill for Claude Code, Codex from agentscope-ai/agentscope-java. It costs 38 tokens per session (345 once invoked), scanned A, original, Apache-2.0.

A file-editing skill for applying several or difficult changes together with Git’s patch system. Git is a tool for tracking changes to code.

In plain words
What is it for?
Use it for changes across multiple files or when an edit cannot be matched safely.
Why use it?
It reduces failed edits and helps keep multi-file changes together when ordinary file matching is unreliable.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it for changes across multiple files or when an edit cannot be matched safely.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/agentscope-ai/agentscope-java/apply-patch
About the project

AgentScope Java is a framework for building distributed software agents that use language models to perform tasks over extended sessions. It is intended for enterprise applications needing agent coordination, controlled tool use, isolated workspaces, event streaming, and distributed session management. The catalogue entries provide skills and instructions for working with this framework.

agentscope-ai/agentscope-java · 6,023 stars · on GitHub · java.agentscope.io

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add agentscope-ai/agentscope-java --skill apply-patch
Clone the repo
git clone --depth 1 https://github.com/agentscope-ai/agentscope-java

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for apply-patch

README.md
[![agentmods](https://agentmods.dev/badge/skills/agentscope-ai/agentscope-java/apply-patch/github.svg)](https://agentmods.dev/skills/agentscope-ai/agentscope-java/apply-patch)
Your own site
<a href="https://agentmods.dev/skills/agentscope-ai/agentscope-java/apply-patch"><img src="https://agentmods.dev/badge/skills/agentscope-ai/agentscope-java/apply-patch/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for apply-patch

Your own site · 80×15
<a href="https://agentmods.dev/skills/agentscope-ai/agentscope-java/apply-patch"><img src="https://agentmods.dev/badge/skills/agentscope-ai/agentscope-java/apply-patch.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 38 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 345 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00038 $0.00345
Opus 5.5 $0.00015 $0.00138
Sonnet 5.5 $0.00008 $0.00069
Haiku 4.5 $0.00004 $0.00034

Measured 1mo ago against content hash 8d2605e691a0, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

apply-patch scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agentscope-examples/agents/agentscope-codingagent/src/main/resources/workspace-templates/skills/apply-patch/SKILL.md · 37 lines

What it actually says

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.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 37 lines · 38 tokens per session scan A 8d2605e691a0

Subscribe to this mod's changes

apply-patch is a skill published in the GitHub repository agentscope-ai/agentscope-java (6,023 stars, last pushed today), licensed Apache-2.0. It adds 38 tokens to every session and 345 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.