Agent skill

Merge Conflict Resolver

by cashew-labs in cashew-labs/libretto

Resolves Git merge, rebase and cherry-pick conflicts by reading the PRs behind each side, keeping both intents and asking you when they truly clash.

MITAuto-check passedDevelopment

Install Merge Conflict Resolver

skills CLI
$ npx skills add cashew-labs/libretto --skill fix-merge-conflicts -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install cashew-labs/libretto fix-merge-conflicts --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/cashew-labs/libretto.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/fix-merge-conflicts .claude/skills/fix-merge-conflicts && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
fix-merge-conflicts
GitHub stars
904
Token cost
~1.1k tokens
SKILL.md length
494 words
Files
1
Skills in repo
21
Repo updated
First seen
Licence
MIT

At a glance

Resolves Git merge, rebase and cherry-pick conflicts by reading the PRs behind each side, keeping both intents and asking you when they truly clash.

  • Works in 8 steps: Preflight: Ensure a Conflict Exists → Identify Conflict Scope → Map Commits to PRs → …
  • Resolving conflict markers after a merge, rebase or cherry-pick
  • SKILL.md covers Workflow, 0) Preflight: Ensure a…, 1) Identify Conflict Scope and 2) Map Commits to PRs, plus 5 more sections
  • Calls git, pnpm and gh

What it does

Conflicts are resolved by intent rather than line order. The skill starts with a preflight: if no unmerged paths exist, it fetches and merges origin/main to surface conflicts, and if there are still none it reports that and stops.

With conflicts present, it lists the conflicted files and uses git log --left-right --merge to find the commits behind them, maps each commit to its pull request through the GitHub API (falling back to git show and the commit message), and reads each PR's title and description to write a short intent summary per side. When intents diverge, for example both sides changing the same behavior with incompatible outcomes, it stops and asks you before resolving that hunk. Otherwise it merges both intents, validates with targeted checks and summarizes the decisions and tradeoffs.

When your agent uses it

  • Resolving conflict markers after a merge, rebase or cherry-pick
  • Choosing between two sides of a conflict by reading the PRs behind them
  • Syncing a branch with origin/main and handling whatever breaks
  • Getting a summary of conflict decisions and tradeoffs

Example prompts

  • “My rebase onto main stopped with conflicts in three files. Resolve them and explain the choices.”
  • “Merge the latest origin/main into this branch and fix whatever conflicts appear.”
  • “Cherry-picking this fix hit conflicts. Check the PR descriptions before picking a side.”

Requirements

  • Git
  • The GitHub CLI (`gh`) to look up PRs for conflicting commits

Workflow steps

8 steps, taken from the step headings in SKILL.md.

  1. Preflight: Ensure a Conflict Exists
  2. Identify Conflict Scope
  3. Map Commits to PRs
  4. Extract Intent
  5. Divergence Checkpoint (User Intervention Required)
  6. Resolve by Preserving Intent
  7. Validate
  8. Report

What it can do on your machine

Read from SKILL.md and the folder at commit 41ab782. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • git
    • pnpm
    • gh

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git, pnpm and gh, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Merge Conflict Resolver loads about 1.1k tokens when it runs. Until then it costs about 72 tokens; SKILL.md has 494 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~72
When it runs · the whole SKILL.md, loaded when a task matches
~1.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from cashew-labs/libretto at commit 41ab782, republished under its MIT licence (© cashew-labs). 494 words, ~1,129 tokens.

Download SKILL.mdSave it as .claude/skills/fix-merge-conflicts/SKILL.md (or your agent's skills folder).
name
fix-merge-conflicts
description
Resolve Git merge, rebase, or cherry-pick conflicts by preserving intent from both sides. Use when unmerged paths or conflict markers are present, especially when you must inspect the PR title and description tied to conflicting commits before choosing a resolution.

Resolve conflicts by intent, not by line order.

Workflow

  1. Run preflight conflict detection. If no local merge/rebase/cherry-pick conflicts are present, automatically fetch and merge origin/main.
  2. Identify conflicted files and candidate commits.
  3. Map each conflicting commit to its PR.
  4. Read PR title and description to extract intent.
  5. Detect intent divergence and request user intervention.
  6. Resolve conflicts to preserve both intents when compatible.
  7. Validate behavior with targeted checks.
  8. Summarize decisions and any tradeoffs.

0) Preflight: Ensure a Conflict Exists

If there are no active unmerged paths, proactively merge latest origin/main to surface conflicts:

bash
git status --porcelain
git diff --name-only --diff-filter=U

Decision rule:

  • If git diff --name-only --diff-filter=U returns files, skip auto-merge and continue to conflict analysis.
  • If it returns nothing, run:
bash
git fetch origin
git merge origin/main

Then re-check:

bash
git diff --name-only --diff-filter=U
  • If conflicts now exist, continue with the rest of this workflow.
  • If still no conflicts, report that no merge conflicts were detected and stop.

1) Identify Conflict Scope

Run:

bash
git status --porcelain
git diff --name-only --diff-filter=U
git log --left-right --merge --oneline

Use git log --left-right --merge as the starting set of commits that influenced the conflicted hunks.

2) Map Commits to PRs

Prefer GitHub metadata when available.

  1. Parse owner/repo from origin.
  2. For each conflicting commit SHA, query associated PRs.
bash
gh api graphql \
  -f query='query($owner:String!,$repo:String!,$sha:GitObjectID!){repository(owner:$owner,name:$repo){object(oid:$sha){... on Commit{associatedPullRequests(first:5){nodes{number title body url mergedAt baseRefName headRefName}}}}}}' \
  -F owner=OWNER -F repo=REPO -F sha=COMMIT_SHA

If no associated PR is found, fall back to git show --stat COMMIT_SHA and commit message context.

3) Extract Intent

For each relevant PR, capture:

  • Goal stated in title
  • Constraints, caveats, or behavioral expectations from description
  • Any explicitly non-goals

Write a short intent summary per side before editing code.

Show full SKILL.md (254 more words)Show less

4) Divergence Checkpoint (User Intervention Required)

Before finalizing any hunk where intents conflict, notify the user and ask for direction.

Treat these as divergence signals:

  • Both sides change the same behavior with incompatible outcomes
  • One side explicitly rejects behavior the other side introduces
  • Either PR description states a constraint that the other side would violate

When divergence is detected:

  1. Pause editing for that hunk.
  2. Provide a short comparison of intent A vs intent B.
  3. Ask one explicit resolution question.
  4. Wait for user response before applying the final hunk resolution.

Question format:

text
Intent divergence detected in <file>:<hunk>.
Option A (PR #X): <one-line intent>
Option B (PR #Y): <one-line intent>
Which intent should be primary for this hunk?

If the user chooses one side, preserve that side and salvage any non-conflicting behavior from the other side. If the user requests a hybrid, restate the hybrid rule before applying edits.

5) Resolve by Preserving Intent

For each conflict hunk:

  1. Explain what each side is trying to preserve.
  2. Keep both behaviors if they are compatible.
  3. If incompatible, keep repository invariants and adapt the losing side's goal into a safe equivalent.
  4. Never silently drop behavior that was explicitly called out in a PR description.

Avoid resolving by "take ours/theirs" unless the PR intent proves one side is obsolete.

6) Validate

Run focused checks that cover touched behavior. In this repository, prefer:

bash
pnpm --filter libretto-cli type-check
pnpm --filter libretto-cli test -- <relevant-test-file>

Run broader checks when conflict scope is wide.

7) Report

Provide a concise summary:

  • Files resolved
  • PR intents preserved
  • Any intentional compromise and why
  • Follow-up risk or test gap, if any

If intent is ambiguous after reading PR metadata, ask one specific question before finalizing.

© cashew-labs, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/fix-merge-conflicts of cashew-labs/libretto.

Open the folder on GitHubat commit 41ab782

Compare with similar skills

Merge Conflict Resolver next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Merge Conflict Resolver compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Merge Conflict Resolver this skillcashew-labs/libretto904—~1.1kAutomated safety check: PassMIT
Contributor-First PR MergeHKUDS/OpenHarness16k1 repos~847Automated safety check: PassMIT
Create Pull Requestcline/cline70k1 repos~1.6kAutomated safety check: PassApache-2.0
Create Pull Request with Work Item IDmakeplane/plane61k—~824Automated safety check: PassAGPL-3.0
Creating Description For Gh PRredis/jedis12k—~838Automated safety check: PassMIT
Pascal Editor PR Openerpascalorg/editor25k—~619Automated safety check: PassMIT

Similar skills

  • Merges external GitHub pull requests while keeping the original author credited, and fixes conflicts after the merge instead of rewriting the contribution.

    16k GitHub starsUsed in 1 repo~847 tokens
    DevelopmentAuto-check passed
  • Opens a GitHub pull request from your current branch with the gh CLI, after reviewing the commits and diff and gathering the details the PR needs.

    70k GitHub starsUsed in 1 repo~1.6k tokens
    DevelopmentAuto-check passed
  • Opens a pull request for the current branch using the repo's template, a work item ID in the title and a description filled in from the actual diff.

    61k GitHub stars~824 tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Official

    Generate a clear, concise GitHub PR title and description from the diff between two local git branches, and save it to prDescription.md in the repo root.

    12k GitHub stars~838 tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Pascal Editor PR Opener

    pascalorg/editor

    Opens or refreshes a pull request on pascalorg/editor from the current branch, describing only what the branch's commits and diff actually contain.

    25k GitHub stars~619 tokensUpdated today
    DevelopmentAuto-check passed
  • React Router Pull Request Creator

    remix-run/react-router

    Packages finished React Router work into a draft pull request: branch, commit, push, a written PR body and the right GitHub labels.

    57k GitHub stars~2.5k tokensUpdated yesterday
    DevelopmentAuto-check passed

More from cashew-labs/libretto

All 21 skills in this repo
  • System Prompt Writing Guide

    cashew-labs/libretto

    Lays out a minimal, iteration-first approach to writing system prompts for LLM agents, with model-specific notes for Claude, GPT, Gemini, and Codex.

    904 GitHub stars~570 tokensUpdated 1 mo ago
    Auto-check passed
  • Address PR Review Comments

    cashew-labs/libretto

    Works through the review comments on a pull request one by one: fetches the threads, makes the fixes, runs type-check, build and lint, pushes, and resolves the threads.

    904 GitHub stars~532 tokensUpdated 1 mo ago
    Auto-check passed
  • CLI Development

    cashew-labs/libretto

    Design rules for command-line tools: subcommand-scoped help, actionable success output, debuggable failures, stable output, meaningful exit codes and a --json mode.

    904 GitHub stars~781 tokensUpdated 1 mo ago
    Auto-check passed
  • Drives desktop Electron apps already installed on your machine, such as Slack, Discord or VS Code, by relaunching them with a debugging port and using the Libretto CLI.

    904 GitHub stars~967 tokensUpdated 1 mo ago
    Auto-check passed
  • Feature Spec Generator

    cashew-labs/libretto

    Researches the codebase and relevant docs, asks clarifying questions, then writes a spec sheet in specs/ for a significant feature or complex fix.

    904 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Glimpse Changes Walkthrough

    cashew-labs/libretto

    Turns the current session's code changes into a Markdown walkthrough shown in a native Glimpse window, with highlighted code, rendered diffs and review feedback.

    904 GitHub stars~1.5k tokensUpdated 1 mo ago
    Auto-check passed

Works with

Categories

Questions about Merge Conflict Resolver

What does Merge Conflict Resolver do?

Resolves Git merge, rebase and cherry-pick conflicts by reading the PRs behind each side, keeping both intents and asking you when they truly clash. Conflicts are resolved by intent rather than line order. The skill starts with a preflight: if no unmerged paths exist, it fetches and merges origin/main to surface conflicts, and if there are still none it reports that and stops.

When should I use Merge Conflict Resolver?

Merge Conflict Resolver fits situations like: resolving conflict markers after a merge, rebase or cherry-pick; choosing between two sides of a conflict by reading the PRs behind them; syncing a branch with origin/main and handling whatever breaks; getting a summary of conflict decisions and tradeoffs.

How do I install Merge Conflict Resolver in Claude Code?

Run `npx skills add cashew-labs/libretto --skill fix-merge-conflicts -a claude-code`. Or copy the skill folder (.agents/skills/fix-merge-conflicts in cashew-labs/libretto) into .claude/skills/fix-merge-conflicts in your project. Claude Code loads it when a task matches its description.

How do I install Merge Conflict Resolver in Codex?

Run `npx skills add cashew-labs/libretto --skill fix-merge-conflicts -a codex`. Or copy the skill folder (.agents/skills/fix-merge-conflicts in cashew-labs/libretto) into .agents/skills/fix-merge-conflicts in your project. Codex loads it when a task matches its description.

Can I use Merge Conflict Resolver in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add cashew-labs/libretto --skill fix-merge-conflicts -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/fix-merge-conflicts, .gemini/skills/fix-merge-conflicts, .github/skills/fix-merge-conflicts and .opencode/skills/fix-merge-conflicts in your project.

What does Merge Conflict Resolver need to run?

Going by SKILL.md and its folder, Merge Conflict Resolver needs the command-line tools its instructions call (git, pnpm and gh). Our summary lists: Git; The GitHub CLI (`gh`) to look up PRs for conflicting commits.

Does Merge Conflict Resolver access the network?

SKILL.md contains no URLs. Its commands use git and gh, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Merge Conflict Resolver safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Merge Conflict Resolver use?

Merge Conflict Resolver is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Merge Conflict Resolver use?

About 1.1k tokens (SKILL.md is roughly 4.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Merge Conflict Resolver?

Skills that share tags, products or a category with Merge Conflict Resolver: Contributor-First PR Merge (HKUDS/OpenHarness, 16k stars), Create Pull Request (cline/cline, 70k stars), Create Pull Request with Work Item ID (makeplane/plane, 61k stars) and Creating Description For Gh PR (redis/jedis, 12k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Merge Conflict Resolver?

cashew-labs (a GitHub organization) maintains it in cashew-labs/libretto, which has 904 GitHub stars. The repository holds 21 skills in this directory. The repository was last updated on August 21, 2026.

Source: cashew-labs/libretto on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.