mcpbeat Sign in

Generating Patches Skill for Claude

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.

939 tokens
context cost
the whole folder, loaded on every use
2
files
instructions only
0
copies elsewhere
how many repositories repackaged it
137
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/oaustegard/claude-skills --skill generating-patches

The instruction itself

8 sections, as written by the author

Generating Patches

Generate portable git patch files from codebase modifications, enabling users to apply Claude's edits to their local repositories.

When to Use

Activate after modifying files in an uploaded codebase when the user needs to transfer changes back to their local environment. Typical workflow: user uploads zip → Claude edits files → this skill exports changes as a patch.

Prerequisites

Verify git is available and the working directory is a git repository (or can be initialized as one):

git status 2>/dev/null || git init

If working with an uploaded codebase that lacks git history, initialize and create a baseline commit before making edits:

git init
git add -A
git commit -m "Baseline: original uploaded state"

Generating the Patch

After completing edits, generate a unified diff:

# For uncommitted changes (working tree modifications)
git diff > /mnt/user-data/outputs/changes.patch

# If changes are staged but not committed
git diff --cached > /mnt/user-data/outputs/changes.patch

# For both staged and unstaged
git diff HEAD > /mnt/user-data/outputs/changes.patch

For committed changes (preserves commit messages and metadata):

# All commits since baseline
git format-patch --stdout baseline..HEAD > /mnt/user-data/outputs/changes.patch

# Or specify number of commits
git format-patch --stdout -n 3 > /mnt/user-data/outputs/changes.patch

Handling Edge Cases

Binary files: Git diff excludes binaries by default. Warn the user if binary files were modified:

git diff --name-only --diff-filter=M | xargs file | grep -v "ASCII\|UTF-8\|empty"

Large patches: For extensive changes, consider splitting by directory or file type:

git diff -- "*.py" > /mnt/user-data/outputs/python-changes.patch
git diff -- src/ > /mnt/user-data/outputs/src-changes.patch

No changes detected: Verify files were actually modified. Common issues:

  • Edits made to copies outside the git tree
  • Files not tracked by git (need git add first)

Output Requirements

Always output to /mnt/user-data/outputs/ with a descriptive filename. Provide the download link:

[Download changes.patch](computer:///mnt/user-data/outputs/changes.patch)

User Instructions

Include these instructions with every patch delivery:


To apply this patch locally:

cd /path/to/your/repo

# Preview changes (dry run)
git apply --check changes.patch

# Apply to working tree
git apply changes.patch

If using format-patch output (includes commit metadata):

git am changes.patch

Troubleshooting:

  • git apply --reject changes.patch — applies what it can, writes .rej files for conflicts
  • git apply -R changes.patch — reverses a previously applied patch
  • git apply --3way changes.patch — enables three-way merge for conflicts

Optional: PR Description

When requested, generate a pull request description from the patch:

# Extract summary of changes
echo "## Summary"
git diff --stat
echo ""
echo "## Changes"
git diff --name-only | while read f; do echo "- \`$f\`"; done

Combine with a brief description of what was changed and why, suitable for GitHub PR body.

Other skills for the same job

different authors, same section of the catalogue
MCP Builder
by anthropics
vendor ×13

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

30k tokens scripts
Changelog Generator
by frostant
×9

Automatically creates user-facing changelogs from git commits by analyzing commit history, categorizing changes, and transforming technical commits into clear, customer-friendly release notes. Turns hours of manual changelog writing into minutes of automated generation.

774 tokens
Finishing A Development Branch
by ZhanlinCui
×7

Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup

1k tokens
MCP Builder
by JayZeeDesign
×7

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

37k tokens scripts
Vercel React Native Skills
by vercel-labs
vendor ×6

React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.

39k tokens
Vercel React Best Practices
by ratacat
×5

React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.

34k tokens
Next Best Practices
by vercel-labs
vendor ×4

Next.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling

20k tokens
Using Git Worktrees
by ZhanlinCui
×4

Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification

1k tokens

How to use it

Copy the folder

Take oaustegard/generating-patches from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.