Git patch workflow
Skill 6543/git-patch-workflow
Generic workflow for implementing tasks on any git repo or provided file set and delivering verified git-format-patch files the user applies with git am. ONLY activate when user explicitly invokes with /git-patch-workflow or says "use git-patch-workflow". Do NOT auto-trigger on git URLs, repo mentions, patch requests, or coding tasks.From its SKILL.md
npx -y skills add 6543/git-patch-workflowAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
3 things to look at
- 20 days oldThe repository was created 20 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
7.0 KB, ~1.6k tokens by cl100k_base, as published. Nobody here has run it
Git Patch Workflow
Produce minimal, tested, git am-ready patches against the exact state the user applies onto.
On activation — print this first
Print the apply snippet in the user's default shell. Default to bash; if a pref declares another shell, translate the loop and note which was used.
Apply patches — bash:
```bash
for f in *.patch; do git am "$f"; done
```
Keep only one revision per number in the apply dir (see Numbering), else the glob applies duplicates.
Bootstrap
Two modes, by what the user gave.
A — repo URL / git ref given. That ref is the anchor. Clone if absent; if reusing a checkout, confirm its remote matches and preserve unrelated user changes (never stash/discard to get a clean tree). Resolve the anchor to a commit.
Identity — do not clobber. Use the existing repo/user user.name/user.email. If either is missing, ask; set it only in this checkout. Never overwrite with a Claude default.
Sync before every task — git fetch, then rebase local work onto the anchor: git rebase <anchor>. Never blind git pull, never reset --hard onto upstream (nukes unpushed stand-in commits).
- Upstream unchanged → no-op.
- Your patches landed (patch-id match) → they drop empty on rebase; verify an altered upstream impl before dropping the local stand-in.
- Upstream moved with foreign commits → replay, resolve only understood conflicts, regenerate affected patches.
- Ambiguous authorship/equivalence → ask.
The apply target may be a PR head or a locally-prepared tree, not main: fetch that ref (git fetch origin pull/<N>/head:pr-<N>) or replay the user's cleanups, commit as baseline, build on top.
B — files only, no upstream. git init, reproduce the given paths (none → repo root), commit unchanged as baseline, identity as above. No fetch/rebase; assume delivered patches are applied, build on local commits.
Record the base after sync, before editing — every patch is generated and verified against it:
APPLY_BASE=$(git rev-parse HEAD)
If the target changes, re-sync and reset APPLY_BASE. For a rework, APPLY_BASE is the rejected commit's parent.
If the mode is unclear, ask. On first activation, note in one line which shell and identity were used.
Task intake
- Read structure, repo instructions (
AGENTS.md,CONTRIBUTING.md, CI config), relevant sources, tests. - Research unknown APIs/libs from authoritative sources. Don't guess.
- Re-read files right before editing. Stale context breaks
str_replace. - Plan in ≤3 bullets. Ask only if a missing choice changes the result or an op is destructive.
Go: read go.mod first; ensure the available Go satisfies the declared go/toolchain version, install/activate it if possible, else report what couldn't be verified.
Implementation
- Smallest diff that solves it. No drive-by renames, restructuring, or re-scoping; preserve the author's deliberate patterns.
- TDD where practical: add/failing test → implement → green.
- One logical, bisectable change per commit.
- Update docs/README in the same commit as the behavior change.
- Preserve unrelated user changes; never discard them for a clean tree.
- More than one materially different fix, or ambiguous behavior → ask.
Formatting
Pick format/validate commands once per series, preferring repo/CI/tool-config declarations. Else the language default — for Go, gofumpt only if the project uses it, else gofmt.
Probe baseline without dirtying the tree (check flag, or run then git checkout -- .). Not formatter-clean → don't format (no churn). Clean → format every patch before committing.
Commit
Conventional Commits. Subject ≤72 chars. Body = why, not what. No AI attribution. Inspect the staged diff first — only the intended change.
fix(scope): concise imperative summary
Why it's needed and any tradeoff.
Refs #123
Generate patches
Clear stale patches first — /mnt/user-data/outputs/ persists across sessions and branches.
cd "$REPO_DIR"
git add <files>; git commit -m "..."
rm -f /mnt/user-data/outputs/*.patch # or just the NNNN-* you're regenerating
# N = your session counter; generate against the recorded base
git format-patch --start-number N "$APPLY_BASE..HEAD" -o /mnt/user-data/outputs/
Confirm patch count == commits in APPLY_BASE..HEAD. Names NNNN-subject.patch; rework NNNN-subject-vN.patch (rename manually — never git format-patch -vN, its v2- prefix breaks sort order).
Verify before delivery — mandatory
Never present_files unverified. Detached worktree at the recorded base, git am the batch, run the repo's real checks there (format, focused tests, build) — not just apply-ability:
V=$(mktemp -d)/wt
git worktree add --detach "$V" "$APPLY_BASE"
git -C "$V" am /mnt/user-data/outputs/*.patch && echo AM_OK # then fmt/test/build in "$V"
git worktree remove --force "$V"
Any am or check failure → fix base/source, regenerate, re-verify. Deliver only all-clean, with the exact git am command and any old files to delete. git am, never git apply — apply silently drops mismatched hunks into .rej and a hollow commit.
Numbering: new / follow-up / rework / abandon
Counter is per session. Default: a delivered patch was applied; don't re-derive it. Pick the case before naming.
- New / follow-up — next unused number, build on current HEAD. Never squash/replace a delivered patch; append.
- Rework (rejected/broken, still wanted) — rebuild from the rejected commit's parent (preserve old history on a backup branch, cherry-pick later dependents). Reuse the same number +
-v2,-v3. Commit body notes what was wrong. Tell the user which old file to delete. - Abandon (change dropped) — drop the commit, burn the number (leave a gap), next work takes the next fresh number. Tell the user to delete the file. No
-vN.
Unclear whether a patch was applied → ask. An applied change needs a follow-up or revert, not a same-number rework.
Pitfalls
- Sync = fetch + rebase, never
pull/reset --hard— local carries stand-ins for delivered patches. - Verify with real checks on a clean worktree before delivery; catches wrong-base rejects and stray-file pollution.
git am, nevergit apply.- Don't clobber Git identity — the user cares about authorship.
- Outputs dir persists across sessions/branches; clear stale patches, one revision per number.
- Smallest diff; no drive-by refactors.
- No toolchain = no compile check. Say so.
- Number reuse only for rework (
-vN); abandon burns; new/follow-up take the next.
What ships with it: 1 file
1.9 KB alongside SKILL.md
- README.md1.9 KB
Gives 1 of the 12 instructions most pr commit review skills give in ~1.6k tokens
Counted across 888 of the 1,342 authors here whose files we hold, read 2026-08-07
- Use conventional commits formathere, and in 127 of 888, across 115 files
- Keep subject line under 72 charactersin 62 of 888, across 48 files
- Delete branches after mergein 51 of 888, across 38 files
- Use imperative mood in subject linein 51 of 888, across 42 files
- Use imperative mood in commit messagesin 44 of 888
- Verify directory is ignored before creating worktreein 43 of 888, across 12 files
- Generate a conventional commit messagein 43 of 888
- Add unignored worktree directories to gitignorein 42 of 888, across 10 files
- Make atomic commitsin 39 of 888, across 27 files
- Run tests before committingin 36 of 888, across 25 files
- Verify clean test baselinein 35 of 888, across 9 files
- Split unrelated changes into separate commitsin 35 of 888, across 30 files
Said here and by no other author read
- print the apply snippet in the user's default shell
- clone the repository if absent
- rebase local work onto the anchor
- read repository instructions and relevant sources
- clear stale patches before generating
- verify patches in a detached worktree before delivery
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.