apply-patch
하는 일
이 스킬은 Git을 이용해 여러 코드 변경을 하나의 패치로 적용합니다. 여러 파일을 바꿔야 하거나 단순한 편집이 텍스트 일치 문제로 계속 실패하는 개발자를 위한 스킬입니다.
사용하는 경우
- ✓한 변경에 세 개 이상의 파일 편집이 필요할 때.
- ✓텍스트가 맞지 않아 단순한 찾아 바꾸기 편집이 계속 실패할 때.
- ✓풀 리퀘스트나 git diff에서 나온 패치를 적용하고 싶을 때.
스킬 링크
https://github.com/agentscope-ai/agentscope-java/blob/main/agentscope-examples/agents/agentscope-codingagent/src/main/resources/workspace-templates/skills/apply-patch/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“이 모듈의 네 파일에 같은 이름 변경을 하나의 패치로 적용하고, 먼저 깔끔하게 적용되는지 확인해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
스킬은 변경 내용을 설명하는 unified diff를 쓰고, 적용되는지 확인한 뒤, Git으로 한꺼번에 적용합니다. 패치가 거부되면 에이전트는 현재 줄을 다시 읽고 패치를 새로 만듭니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
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
Write the unified diff to a file in the sandbox (use
write_fileor a heredoc viaexecute):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 lineValidate before applying:
git apply --check changes.patchApply:
git apply changes.patch(use-p0if paths are nota/...b/...).If
git applyrejects the hunk, the surrounding context is stale —read_filethe 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_fileexact-match struggles. - Re-applying a patch produced elsewhere (e.g. from a PR or
git diff).
Always run the verify-changes skill afterwards.
자주 묻는 질문
적용 전에 패치를 확인하나요?
네, 적용하기 전에 패치를 확인합니다.
패치가 실패하면 어떻게 되나요?
에이전트가 현재 파일 줄을 다시 읽고 새 패치를 만듭니다.
전부 적용되거나 전혀 적용되지 않나요?
패치는 하나의 변경으로 적용되므로, 전부 적용되거나 전혀 적용되지 않는 방식을 의도합니다.
상세 정보
작성자의 원본 설명
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.
인기도
- GitHub 스타
- 6.2k
- 순위
- #14386
- 라이선스
- Apache-2.0
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
agentscope-java
6.2k에이전트가 Project Reactor 위에 만들어진 다중 에이전트 프레임워크 AgentScope용 논블로킹 Java 코드를 작성하도록 돕습니다.
data-report
6.2k에이전트가 데이터셋을 평균, 합계, 범위, 추세가 담긴 보고서로 요약하고, Markdown 파일로 저장하도록 돕습니다.
data-transform
6.2k에이전트가 CSV, JSON 같은 형식 사이에서 데이터 파일을 변환해 다른 도구에서도 쓸 수 있게 돕습니다.
git-changelog
6.2k에이전트가 Git 기록에서 변경 로그나 출시 노트를 작성하도록 돕습니다. 기능, 수정, 기타 변경으로 묶어 정리합니다.