skills/resolving-merge-conflicts/SKILL.md
Use when git merge or rebase fails with conflicts, you see 'unmerged paths' or conflict markers (<<<<<<< =======), or need help resolving conflicted files. Triggers: 'merge conflict', 'fix the conflicts', 'conflicting changes', 'resolve conflicts', 'can't merge'.
npx skillsauth add axiomantic/spellbook resolving-merge-conflictsInstall 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.
--ours/--theirs = amputation.Every line of code in a branch represents thought, debugging, and testing. Choosing --ours declares the other developer's work worthless. Choosing --theirs declares the current branch's work worthless. Both branches exist because both were needed.
If you cannot figure out how to synthesize, that is a signal to ask for help, not a signal to amputate.
| Input | Required | Description |
|-------|----------|-------------|
| conflict_files | Yes | List of files with merge conflicts (from git status) |
| merge_base | Yes | Common ancestor commit (from git merge-base) |
| ours_branch | Yes | Current branch name |
| theirs_branch | Yes | Branch being merged |
| Output | Type | Description |
|--------|------|-------------|
| resolution_plan | Inline | Per-file synthesis strategy with base/ours/theirs analysis |
| resolved_files | Files | Conflict-free source files with synthesized changes |
| verification_report | Inline | Test results, lint status, behavior confirmation |
Proceed only when synthesis strategy clear and surgical.
| Type | Files | Resolution | |------|-------|------------| | Mechanical | Lock files, changelogs, test fixtures | Auto: regenerate locks, chronological changelog merge | | Binary | Images, compiled assets | Ask user to choose (synthesis impossible) | | Complex | Source, configs, docs | 3-way analysis + synthesis required |
| Pattern | Resolution | |---------|------------| | Both modified same function | Merge both changes (logging AND error handling) | | Delete vs modify | Apply modification to new location | | Same name, different purpose | Rename to distinguish | | Same name, same purpose | True merge into unified implementation |
Both branches modified the same validation function. Ours added rate limiting. Theirs added input sanitization.
<<<<<<< ours
function validateRequest(req) {
if (rateLimiter.isExceeded(req.ip)) {
throw new RateLimitError('Too many requests');
}
return processRequest(req);
}
=======
function validateRequest(req) {
const sanitized = sanitizeInput(req.body);
return processRequest({ ...req, body: sanitized });
}
>>>>>>> theirs
WRONG - Selecting "ours": Lost input sanitization. XSS vulnerability reintroduced.
WRONG - Selecting "theirs": Lost rate limiting. API now vulnerable to abuse.
CORRECT - Synthesis:
function validateRequest(req) {
if (rateLimiter.isExceeded(req.ip)) {
throw new RateLimitError('Too many requests');
}
const sanitized = sanitizeInput(req.body);
return processRequest({ ...req, body: sanitized });
}
// Rate limiting AND sanitization. Both authors' work honored.
The correct synthesis requires understanding WHY each branch made its change, not just WHAT changed. The 3-way analysis (Reasoning Schema) surfaces the "why."
| Thought | Reality |
|---------|---------|
| "User said simplify, so use theirs" | Simplify = new third option simpler than EITHER |
| "Basically the same" | Conflict exists because they differ |
| "I'll adopt their approach" | --theirs with extra steps |
| "Tests need updating anyway" | Understand test purpose first |
| "This is cleaner" | Cleaner is not the goal. Preserving both intents is. |
| Bad (binary, over-interpreted) | Good (surgical, specific) | |--------------------------------|---------------------------| | "Ours or theirs?" | "What specifically needs to change?" | | "Is master's better?" | "What from master should we adopt?" | | "Should I simplify?" | "Which specific lines are unnecessary?" |
Binary questions get binary answers, then extrapolate to wholesale changes never approved.
Accidental --theirs without command:
Prevention: Approval for ONE aspect is NOT approval for all. Each deletion requires separate verification.
Only with explicit user consent after tradeoff explanation:
## Resolution: [filename]
**Base:** [original state]
**Ours:** [change + intent]
**Theirs:** [change + intent]
**Synthesis:** [how combining both]
**Risk:** [edge cases, concerns]
Before completing resolution:
<<<<<<< markers remain)Mechanical Synthesis Test: For each resolved conflict, describe your resolution in one sentence. If that sentence contains ANY of these phrases, you are selecting, not synthesizing. Go back and rewrite:
A valid synthesis sentence sounds like: "Combined ours' rate limiting with theirs' input sanitization into a single validation pipeline." It names contributions from BOTH sides.
If ANY item unchecked or synthesis test fails: STOP and fix.
<FINAL_EMPHASIS> You are a Git Archaeology Expert. Your reputation depends on synthesis, not selection. Every time you choose one branch over the other, you erase hours of another developer's work. The only acceptable outcome is unified code that honors both intents. If synthesis seems impossible, stop and ask — do not amputate. </FINAL_EMPHASIS>
testing
Use when creating new skills, editing existing skills, or verifying skills work before deployment. Triggers: 'write a skill', 'new skill', 'create a skill', 'skill doesn't work', 'skill isn't firing', 'edit skill', 'skill quality'. NOT for: general prompt improvement (use instruction-engineering) or command creation (use writing-commands).
development
Use when you have a spec, design doc, or requirements and need a detailed implementation plan before coding. Triggers: 'write a plan', 'create implementation plan', 'plan this out', 'break this down into steps', 'convert design to tasks', 'implementation order'. Also invoked by develop during planning. NOT for: reviewing existing plans (use reviewing-impl-plans).
testing
Use when creating new commands, editing existing commands, or reviewing command quality. Triggers: 'write command', 'new command', 'create a command', 'review command', 'fix command', 'command doesn't work', 'add a slash command'. NOT for: skill creation (use writing-skills).
development
Use when about to claim discovery during debugging. Triggers: "I found", "this is the issue", "I think I see", "looks like the problem", "that's why", "the bug is", "root cause", "culprit", "smoking gun", "aha", "got it", "here's what's happening", "the reason is", "causing the", "explains why", "mystery solved", "figured it out", "the fix is", "should fix", "this will fix". Also invoked by debugging, scientific-debugging, systematic-debugging before any root cause claim.