본문으로 건너뛰기
Skillpedia
일반 코딩6.2k · #14386

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가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/agentscope-ai/agentscope-java/blob/main/agentscope-examples/agents/agentscope-codingagent/src/main/resources/workspace-templates/skills/apply-patch/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

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

  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.

자주 묻는 질문

적용 전에 패치를 확인하나요?

네, 적용하기 전에 패치를 확인합니다.

패치가 실패하면 어떻게 되나요?

에이전트가 현재 파일 줄을 다시 읽고 새 패치를 만듭니다.

전부 적용되거나 전혀 적용되지 않나요?

패치는 하나의 변경으로 적용되므로, 전부 적용되거나 전혀 적용되지 않는 방식을 의도합니다.

상세 정보

작성자의 원본 설명

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.

repo: agentscope-ai/agentscope-java

인기도

GitHub 스타
6.2k
순위
#14386
라이선스
Apache-2.0
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬