Apply patch

Apply Git-style diff hunks to target files with validation.

2|2|Updated Feb 12, 2026
One-click install
npx skills add https://github.com/bishwashere/cowCode --skill apply-patch-bishwashere
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Apply patch
Source: https://github.com/bishwashere/cowCode/tree/main/skills/apply-patch
Command: npx skills add https://github.com/bishwashere/cowCode --skill apply-patch-bishwashere

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Patch management for code bases by applying Git-style diff hunks to files, enabling precise, automated updates without manual edits.

Core Features & Use Cases

  • Apply a diff hunk to a target file by matching context and performing add/remove.
  • Fails gracefully if the surrounding context does not match, preserving file integrity.
  • Use cases include applying patches from code reviews, pasted diffs, or quick single-file updates during debugging.

Quick Start

Provide the target file path and the unified diff hunk, then trigger the patch application.

Frequently Asked Questions about Apply patch

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I apply a git diff patch to a local file?

To apply a git diff patch, provide the target file path and the unified diff hunk. The tool matches the surrounding context and performs the add/remove edits to update the file.

What happens if the surrounding context does not match when patching a file?

If the diff hunk context does not match the target file, the patch application fails gracefully. This validation prevents incorrect edits and preserves your original file integrity.

Can I apply a single-file patch from a code review without manual edits?

Yes, you can apply single-file patches from code reviews or pasted diffs. By matching the diff hunk context, the tool automates the add/remove updates without requiring manual text editing.

Do I need a full git repository to apply a diff hunk to a file?

You do not need a full git repository to apply a diff hunk. The tool operates directly on single files within a local workspace by parsing and applying the provided unified diff.

What is the best way to apply a unified diff hunk during debugging?

The best way to apply a unified diff hunk during debugging is providing the file path and hunk directly. This allows quick, precise single-file updates without manual copy-pasting errors.

Why does my diff patch fail to apply to the target file?

A diff patch fails to apply when the surrounding context lines in the hunk do not match the target file. This context matching validation ensures only correct patches are applied.