SKILL.md
Merge conflict resolution planner
An evidence-first workflow to resolve conflicting intent while preserving both branches' tested invariants.
- Revision
- 2
- Verified
- 2026-10-20
Compatibility and paths
Codex
skills/merge-conflict-plan/SKILL.mdClaude Code
.claude/skills/merge-conflict-plan/SKILL.mdVS Code
.github/skills/merge-conflict-plan/SKILL.mdTrust and provenance
Curated record reviewed 2026-10-20. Results still depend on the supplied context and target environment.
Generated assetReady to copy or download
---
name: merge-conflict-plan
description: Plans semantic conflict resolution from base and both branch intents. Use when marker-free code or choosing one side would discard a tested requirement; separate ordinary merge stages from rebase and preserve unrelated owner work.
license: CC-BY-4.0
compatibility: Complete Node.js22.13+ program requires an installed Git with switch/init initial-branch support. It creates and retains only a new random owned temp repository with original fixture files, no remotes/hooks/global-config writes. Do not point it at an existing repo.
metadata:
author: oneliners
version: "2.0.0"
---
# Merge conflict resolution planner
## Recover both intents before editing
Read current status, merge operation, common base and each side's diff/tests/ownership. Record dirty/untracked user work and never reset or overwrite it to simplify a conflict. Distinguish a text conflict from incompatible product invariants; resolve ambiguity with the owner. In ordinary merge stages1/2/3 refer to ancestor/HEAD/MERGE_HEAD; do not transfer ours/theirs assumptions blindly to a rebase.
## Complete actual Git reproduction
Save the entire block as owned-merge.mjs and run node owned-merge.mjs with Node.js22.13+ and Git installed. It creates its own random temporary folder, never accepts a target repository and writes/commits only fictional policy data there. No remote is configured, no hooks run, no existing project is merged, and the folder is retained rather than deleted. Both branch requirements are stated in the program's assertions.
```js
import assert from "node:assert/strict";
import {mkdtemp,mkdir,writeFile,readFile} from "node:fs/promises";
import {tmpdir} from "node:os";
import {join} from "node:path";
import {spawnSync} from "node:child_process";
async function runOwnedMergeLab() {
const directory = await mkdtemp(join(tmpdir(), "oneliners-owned-merge-"));
const hooks = join(directory, "empty-hooks"), config = join(directory, "empty-global-config");
await mkdir(hooks); await writeFile(config, "");
const git = (args, expected = 0) => {
// Do not inherit GIT_DIR/WORK_TREE/INDEX_FILE or injected config from the invoking repository.
const env = { PATH: process.env.PATH, GIT_CONFIG_NOSYSTEM: "1", GIT_CONFIG_GLOBAL: config, GIT_TERMINAL_PROMPT: "0", GIT_EDITOR: "true" };
if (process.env.SystemRoot) env.SystemRoot = process.env.SystemRoot;
const result = spawnSync("git", ["-c", "core.hooksPath=" + hooks, "-c", "core.autocrlf=false", "-c", "commit.gpgsign=false", "-c", "user.name=Owned fixture", "-c", "user.email=fixture@example.invalid", ...args], { cwd: directory, encoding: "utf8", timeout: 6000, env });
assert.ifError(result.error); assert.equal(result.status, expected, result.stderr || result.stdout); return result.stdout.trim();
};
git(["init", "--quiet", "--initial-branch=codex/base", "--template="]);
const file = join(directory, "policy.json"), writePolicy = (value) => writeFile(file, JSON.stringify(value) + "\n");
await writePolicy({ maxAttempts: 3, timeoutMs: 1000 }); git(["add", "policy.json"]); git(["commit", "--quiet", "-m", "owned base"]);
git(["switch", "--quiet", "-c", "codex/retry"]); await writePolicy({ maxAttempts: 5, timeoutMs: 1000 }); git(["add", "policy.json"]); git(["commit", "--quiet", "-m", "owned retry intent"]);
git(["switch", "--quiet", "codex/base"]); git(["switch", "--quiet", "-c", "codex/deadline"]); await writePolicy({ maxAttempts: 3, timeoutMs: 2500 }); git(["add", "policy.json"]); git(["commit", "--quiet", "-m", "owned deadline intent"]);
git(["switch", "--quiet", "codex/retry"]); git(["merge", "--no-edit", "codex/deadline"], 1);
const stages = [1, 2, 3].map((stage) => ({ stage, policy: JSON.parse(git(["show", ":" + stage + ":policy.json"])) }));
const unmergedBefore = git(["ls-files", "--unmerged", "--", "policy.json"]);
const valid = (policy) => policy.maxAttempts === 5 && policy.timeoutMs === 2500;
assert.equal(valid(stages[1].policy), false); assert.equal(valid(stages[2].policy), false);
const combined = { maxAttempts: 5, timeoutMs: 2500 }; assert.equal(valid(combined), true);
await writePolicy(combined); git(["add", "policy.json"]); assert.equal(git(["ls-files", "--unmerged"]), "");
git(["commit", "--quiet", "-m", "owned preserve both invariants"]);
assert.deepEqual(JSON.parse(await readFile(file, "utf8")), combined);
const mergeParents = git(["rev-list", "--parents", "-n", "1", "HEAD"]).split(/\s+/).length - 1;
assert.equal(mergeParents, 2); assert.equal(git(["remote"]), "");
return { stages, unmergedStagesBefore: unmergedBefore.split("\n").length, oursPreservesBoth: valid(stages[1].policy), theirsPreservesBoth: valid(stages[2].policy), combined, unmergedAfter: 0, mergeParents, remotes: 0, directory, scope: "Actual Git conflict/resolution in newly owned random temporary repository only. It is retained for inspection, not deleted. No owner repository, remote, global config, hooks or real release modified." };
}
console.log(JSON.stringify(await runOwnedMergeLab(),null,2));
```
## Worked semantic resolution
The actual ordinary merge exits1 with three unmerged index stages for policy.json. Stage1 contains the common base {maxAttempts:3,timeoutMs:1000}; stage2 is current HEAD on codex/retry {5,1000}; stage3 is MERGE_HEAD from codex/deadline {3,2500}. Stage labels here are for this ordinary merge, not an assumption about rebase's ours/theirs meanings.
Choosing either complete side gives valid JSON without markers but fails the combined acceptance invariant: ours loses the new2500ms deadline, theirs loses the retry change to5. The reviewed combined result {5,2500} preserves both explicit fictional requirements, is staged with no remaining unmerged entries and committed as a real two-parent merge. Syntax success and marker disappearance alone would not have proved intent preservation.
In a real conflict, inspect base and both changes, ownership, caller behavior, generated/lockfile rules and tests; do not blindly combine policies whose intents are genuinely incompatible. Agree ambiguous behavior with the owner and stop before staging unknown user edits. Verify caller-level invariants after resolving, not just the one conflicted function. The program uses only a new owned random temp repository, disables hooks/signing for its Git calls, has no remotes and leaves the directory available for inspection. It does not reset, clean, checkout-overwrite, merge or push the current project. No real branch or release was resolved by this exercise.
## Report the real resolution gates
[Git merge documentation](https://git-scm.com/docs/git-merge) explains index stages and preserving pre-merge work; [git ls-files](https://git-scm.com/docs/git-ls-files) defines the unmerged-stage view. Return per-file base/side intent, ownership decisions, minimal resolution, semantic regression results, remaining conflicts and commit/abort constraints. A review request alone does not authorize merging/pushing a user's real branch. Do not regenerate a lockfile, discard either side or invoke abort/reset/clean against unrelated edits without confirming the operation and recovery path.
Real example
Input
Run only the complete new-owned-temp-repository merge example in SKILL.md. Compare actual stages1/2/3 and both stated branch invariants, prove each one-sided valid-JSON choice loses intent, and verify combined semantic checks/unmerged entries/two-parent commit. Never target the current project.
Expected result
The actual ordinary merge exits1 with three unmerged index stages for policy.json. Stage1 contains the common base {maxAttempts:3,timeoutMs:1000}; stage2 is current HEAD on codex/retry {5,1000}; stage3 is MERGE_HEAD from codex/deadline {3,2500}. Stage labels here are for this ordinary merge, not an assumption about rebase's ours/theirs meanings.
Choosing either complete side gives valid JSON without markers but fails the combined acceptance invariant: ours loses the new2500ms deadline, theirs loses the retry change to5. The reviewed combined result {5,2500} preserves both explicit fictional requirements, is staged with no remaining unmerged entries and committed as a real two-parent merge. Syntax success and marker disappearance alone would not have proved intent preservation.
In a real conflict, inspect base and both changes, ownership, caller behavior, generated/lockfile rules and tests; do not blindly combine policies whose intents are genuinely incompatible. Agree ambiguous behavior with the owner and stop before staging unknown user edits. Verify caller-level invariants after resolving, not just the one conflicted function. The program uses only a new owned random temp repository, disables hooks/signing for its Git calls, has no remotes and leaves the directory available for inspection. It does not reset, clean, checkout-overwrite, merge or push the current project. No real branch or release was resolved by this exercise.