Best use case
gsd-reapply-patches is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Reapply local modifications after a GSD update
Teams using gsd-reapply-patches should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/gsd-reapply-patches/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How gsd-reapply-patches Compares
| Feature / Agent | gsd-reapply-patches | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Reapply local modifications after a GSD update
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
<cursor_skill_adapter>
## A. Skill Invocation
- This skill is invoked when the user mentions `gsd-reapply-patches` or describes a task matching this skill.
- Treat all user text after the skill mention as `{{GSD_ARGS}}`.
- If no arguments are present, treat `{{GSD_ARGS}}` as empty.
## B. User Prompting
When the workflow needs user input, prompt the user conversationally:
- Present options as a numbered list in your response text
- Ask the user to reply with their choice
- For multi-select, ask for comma-separated numbers
## C. Tool Usage
Use these Cursor tools when executing GSD workflows:
- `Shell` for running commands (terminal operations)
- `StrReplace` for editing existing files
- `Read`, `Write`, `Glob`, `Grep`, `Task`, `WebSearch`, `WebFetch`, `TodoWrite` as needed
## D. Subagent Spawning
When the workflow needs to spawn a subagent:
- Use `Task(subagent_type="generalPurpose", ...)`
- The `model` parameter maps to Cursor's model options (e.g., "fast")
</cursor_skill_adapter>
<purpose>
After a GSD update wipes and reinstalls files, this command merges user's previously saved local modifications back into the new version. Uses intelligent comparison to handle cases where the upstream file also changed.
</purpose>
<process>
## Step 1: Detect backed-up patches
Check for local patches directory:
```bash
# Global install — detect runtime config directory
if [ -d "$HOME/.config/opencode/gsd-local-patches" ]; then
PATCHES_DIR="$HOME/.config/opencode/gsd-local-patches"
elif [ -d "$HOME/.opencode/gsd-local-patches" ]; then
PATCHES_DIR="$HOME/.opencode/gsd-local-patches"
elif [ -d "$HOME/.gemini/gsd-local-patches" ]; then
PATCHES_DIR="$HOME/.gemini/gsd-local-patches"
else
PATCHES_DIR=".cursor/gsd-local-patches"
fi
# Local install fallback — check all runtime directories
if [ ! -d "$PATCHES_DIR" ]; then
for dir in .config/opencode .opencode .gemini .claude; do
if [ -d "./$dir/gsd-local-patches" ]; then
PATCHES_DIR="./$dir/gsd-local-patches"
break
fi
done
fi
```
Read `backup-meta.json` from the patches directory.
**If no patches found:**
```
No local patches found. Nothing to reapply.
Local patches are automatically saved when you run /gsd-update
after modifying any GSD workflow, command, or agent files.
```
Exit.
## Step 2: Show patch summary
```
## Local Patches to Reapply
**Backed up from:** v{from_version}
**Current version:** {read VERSION file}
**Files modified:** {count}
| # | File | Status |
|---|------|--------|
| 1 | {file_path} | Pending |
| 2 | {file_path} | Pending |
```
## Step 3: Merge each file
For each file in `backup-meta.json`:
1. **Read the backed-up version** (user's modified copy from `gsd-local-patches/`)
2. **Read the newly installed version** (current file after update)
3. **Compare and merge:**
- If the new file is identical to the backed-up file: skip (modification was incorporated upstream)
- If the new file differs: identify the user's modifications and apply them to the new version
**Merge strategy:**
- Read both versions fully
- Identify sections the user added or modified (look for additions, not just differences from path replacement)
- Apply user's additions/modifications to the new version
- If a section the user modified was also changed upstream: flag as conflict, show both versions, ask user which to keep
4. **Write merged result** to the installed location
5. **Report status:**
- `Merged` — user modifications applied cleanly
- `Skipped` — modification already in upstream
- `Conflict` — user chose resolution
## Step 4: Update manifest
After reapplying, regenerate the file manifest so future updates correctly detect these as user modifications:
```bash
# The manifest will be regenerated on next /gsd-update
# For now, just note which files were modified
```
## Step 5: Cleanup option
Ask user:
- "Keep patch backups for reference?" → preserve `gsd-local-patches/`
- "Clean up patch backups?" → remove `gsd-local-patches/` directory
## Step 6: Report
```
## Patches Reapplied
| # | File | Status |
|---|------|--------|
| 1 | {file_path} | ✓ Merged |
| 2 | {file_path} | ○ Skipped (already upstream) |
| 3 | {file_path} | ⚠ Conflict resolved |
{count} file(s) updated. Your local modifications are active again.
```
</process>
<success_criteria>
- [ ] All backed-up patches processed
- [ ] User modifications merged into new version
- [ ] Conflicts resolved with user input
- [ ] Status reported for each file
</success_criteria>Related Skills
gsd-undo
Safe git revert. Roll back phase or plan commits using the phase manifest with dependency checks.
gsd-ultraplan-phase
[BETA] Offload plan phase to Cursor's ultraplan cloud — drafts remotely while terminal stays free, review in browser with inline comments, import back via /gsd-import. Cursor only.
gsd-spike
Spike an idea through experiential exploration, or propose what to spike next (frontier mode)
gsd-spike-wrap-up
Package spike findings into a persistent project skill for future build conversations
gsd-spec-phase
Socratic spec refinement — clarify WHAT a phase delivers with ambiguity scoring before discuss-phase. Produces a SPEC.md with falsifiable requirements locked before implementati...
gsd-sketch
Sketch UI/design ideas with throwaway HTML mockups, or propose what to sketch next (frontier mode)
gsd-sketch-wrap-up
Package sketch design findings into a persistent project skill for future build conversations
gsd-secure-phase
Retroactively verify threat mitigations for a completed phase
gsd-scan
Rapid codebase assessment — lightweight alternative to /gsd-map-codebase
gsd-join-discord
Join the GSD Discord community
gsd-ingest-docs
Scan a repo for mixed ADRs, PRDs, SPECs, and DOCs and bootstrap or merge the full .planning/ setup from them. Classifies each doc in parallel, synthesizes a consolidated context...
gsd-inbox
Triage and review all open GitHub issues and PRs against project templates and contribution guidelines