# Upstream patches

> Upstream patches is an open-source agent skill for developer tools. Lets an agent create, amend, remove and rebase Terraform provider submodule patches. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/pulumi/agent-skills/tree/main/package-maintenance/skills/upstream-patches
- **Repository:** https://github.com/pulumi/agent-skills
- **GitHub stars:** 82
- **License:** Apache-2.0
- **Skill name:** upstream-patches
- **Collection:** https://github.com/pulumi/agent-skills
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-03

## About

This skill manages a set of patch files that sit on top of an upstream Terraform provider git submodule. It walks the agent through finding which patch owns a given file or hunk, then amending that patch commit rather than adding a new one, so regressions get fixed in place. It also covers deleting a whole patch, stripping selected hunks or files out of a patch, and rebasing the patch stack onto a newer upstream commit.

The workflow is built around the upstream.sh helper, which switches the submodule into a checkout mode where patches become commits, and then writes them back to patch files on check-in. The guide prefers non-interactive history rewriting with cherry-picks and warns against hand-editing patch files, interactive rebases and destructive re-initialization. It also gives a checklist for verifying patch counts before and after check-in and explains how to recover an interrupted checkout.

It expects a Terraform provider repository laid out with an upstream/ submodule and a patches/ folder, plus git and ripgrep or grep available in the shell.

## When your agent uses it

> Create, amend, remove, and rebase patches for Terraform provider submodules using `./scripts/upstream.sh`. Use when `upgrade-provider` or manual patch work needs owning-patch lookup, patch conflict fixes, patch/hunk removal, or upstream rebase.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/pulumi/agent-skills/tree/HEAD/package-maintenance/skills/upstream-patches)
- [License: Apache-2.0](https://github.com/pulumi/agent-skills/tree/HEAD/package-maintenance/skills/upstream-patches)

## Features

- **Owning patch lookup:** Finds which patch file and commit touched a given path or unique code snippet.
- **Amend existing patches:** Rewrites the owning patch commit and replays later patches so fixes stay in the right place.
- **Remove patches or hunks:** Deletes a full patch file or reverts selected files and hunks from one patch.
- **Rebase onto upstream:** Moves the patch stack onto a new upstream commit and writes updated patch files.
- **Checkout and check-in flow:** Uses upstream.sh to switch the submodule into patch-editing mode and back.
- **Recovery guidance:** Explains how to resume an interrupted checkout or rebase without losing work.

## Good for

- Fix a regression introduced by an earlier provider patch
- Remove a patch that is no longer needed after an upstream change
- Strip unwanted doc changes out of an existing patch
- Rebase the provider patches onto a new upstream release
- Find which patch modifies a particular file in the provider

## Install

### Claude Code

This skill ships in the `pulumi` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add pulumi/agent-skills
/plugin install pulumi@pulumi-agent-skills
```

Or copy only this skill to `~/.claude/skills/upstream-patches`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/pulumi/agent-skills.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/upstream-patches &&
cp -R "$tmp/package-maintenance/skills/upstream-patches" ~/.claude/skills/upstream-patches &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/upstream-patches` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/upstream-patches` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/pulumi/agent-skills.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/upstream-patches &&
cp -R "$tmp/package-maintenance/skills/upstream-patches" ~/.agents/skills/upstream-patches &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/upstream-patches` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/upstream-patches` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/pulumi/agent-skills.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/upstream-patches &&
cp -R "$tmp/package-maintenance/skills/upstream-patches" ~/.cursor/skills/upstream-patches &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/upstream-patches` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/pulumi/agent-skills.git --path package-maintenance/skills/upstream-patches
```

Or copy the folder to `~/.gemini/skills/upstream-patches` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/upstream-patches`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/pulumi/agent-skills.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/upstream-patches &&
cp -R "$tmp/package-maintenance/skills/upstream-patches" ~/.copilot/skills/upstream-patches &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/upstream-patches` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/pulumi/agent-skills.git
```

Then copy `agent-skills/package-maintenance/skills/upstream-patches` into your agent's skills folder as `upstream-patches`. Agents that support SKILL.md read one folder per skill.

## FAQ

### When does Upstream patches trigger?

It is meant for upgrade-provider runs or manual patch work that needs owning-patch lookup, patch conflict fixes, patch or hunk removal, or an upstream rebase.

### Will Upstream patches create new patches by default?

No. The guide says to amend the owning patch for regressions and to create a new patch only when the user explicitly asks.

### Does Upstream patches require any scripts?

It relies on ./scripts/upstream.sh in the provider repository; the skill folder itself contains no scripts.

### Are edits under upstream/ kept?

Edits made outside checkout mode are ephemeral during upgrade-provider, because the tool resets submodule state.

### How do I install Upstream patches in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/upstream-patches to use it in all your projects, or to .claude/skills/upstream-patches in one project. Or install the pulumi plugin, which includes it: /plugin marketplace add pulumi/agent-skills, then /plugin install pulumi@pulumi-agent-skills.

### Does Upstream patches run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Upstream patches?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Upstream patches?

The closest alternatives to Upstream patches are Pulumi upgrade provider, Patching bugs, Using knowledge patch, Rebase current branch and Provider upgrade.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Pulumi upgrade provider](https://ai-powered.com/skills/pulumi-upgrade-provider): Pulumi upgrade provider is an open-source agent skill for developer tools.
- [Patching bugs](https://ai-powered.com/skills/patching-bugs): Patching bugs is an open-source agent skill for developer tools.
- [Using knowledge patch](https://ai-powered.com/skills/using-knowledge-patch): Using knowledge patch is an open-source agent skill for developer tools.
- [Rebase current branch](https://ai-powered.com/skills/rebase-current-branch): Rebase current branch is an open-source agent skill for developer tools.
- [Provider upgrade](https://ai-powered.com/skills/provider-upgrade): Provider upgrade is an open-source agent skill for cloud and infrastructure.
- [JSON patch](https://ai-powered.com/skills/json-patch): JSON patch is an open-source agent skill for developer tools.
- [Implement patch](https://ai-powered.com/skills/implement-patch): Implement patch is an open-source agent skill for developer tools.
- [Refactor seams](https://ai-powered.com/skills/refactor-seams): Refactor seams is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/upstream-patches
