codex/skills/patch/SKILL.md
Create micro-patches from staged git changes (minimal incision) with at least one validation signal per patch. Use when asked to split work into small .patch files, export/share diffs, or produce patches instead of commits.
npx skillsauth add tkersey/dotfiles patchInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Carve changes into surgical git patch files: one coherent change, minimal blast radius, and at least one feedback signal before exporting.
This skill treats a patch as a transport artifact (a context-sensitive diff), not a magical commutative "merge atom". The goal is to make patches small, reviewable, and maximally likely to apply cleanly.
HEAD), keep patches tiny, and validate against a clean base.git apply-style patch from the index.
git apply.git am/email-style patch (requires commits).
git am.format-patch.Inspect:
git status -sbgit diffStage what you intend (prefer file-level staging in non-interactive harnesses):
git add <paths...>git restore --staged <paths...>Verify:
git diff --cached matches the intended incision.If you truly need hunk-level staging but your environment can't do interactive staging, ask the user to stage hunks locally or provide a patch you can apply.
scripts/micro_scope.py (staged vs unstaged size).Heuristics that reduce downstream conflicts:
references/loop-detection.md.Choose an output path, e.g. patches/0001-<slug>.patch.
Before exporting, sanity-check for secrets (tokens, creds, private keys). If likely, stop and ask.
Export the staged change as a binary-safe patch (deterministic diff output):
git diff --cached --binary --no-ext-diff --no-textconv --no-color > <patch-path>Verify the patch is non-empty:
test -s <patch-path>Verify patch correctness (two levels):
git apply --check --reverse --binary <patch-path>git worktree add --detach <tmp-dir> HEAD<tmp-dir>: git apply --check --binary <patch-path>git worktree remove <tmp-dir>Keep staged changes intact unless the user asks to unstage or reset.
Repeat until the working tree is clean or remaining changes are intentionally deferred.
git patch-id --stable (best-effort, not cryptographic).references/patch-theory.md.scripts/micro_scope.pyreferences/loop-detection.mdreferences/patch-theory.mdtesting
Use before local patching when bugs, regressions, malformed state, crashes, parser failures, migrations, cache drift, protocol problems, compatibility requests, tolerant readers, fallbacks, coercions, retries, catch-and-continue logic, or local workarounds may broaden accepted invalid state.
testing
Use for bug reports, PR/issue prose, reviewer comments, user diagnoses, generated summaries, memories, retrieved context, public tracker context, claimed root causes, proposed fixes, fake-minimal repro risk, or any investigation where natural-language context could anchor the implementation scope.
development
Use when non-trivial work needs Challenge Escalation, latent-intelligence activation, frame-market selection, doctrine operators, dominant-move selection, ablation/surface-tax judgment, reification, review comment law, negative capability, route receipts, or proof-bearing refusal to mutate.
development
Apply Algebra-Driven Design. Use for ADD, denotational design, combinator models, law-driven architecture, domain algebra, property tests, codebase modeling, event sourcing, workflow design, or agentic skill design. If the canonical bundle is unavailable, use this wrapper as the minimal ADD kernel and report the missing bundle path.