andreybegma/claude-code-plugin/conflict
Claude Code and agent skill by andreybegma/claude-code-plugin
- community
Checking that the SKILL.md file is still in the repository.
Resolve merge conflicts for a PR or current branch — auto-resolves obvious conflicts, interactive resolution for ambiguous ones
Install
npx vskill@latest install andreybegma/claude-code-plugin/conflictSKILL.md
The same SKILL.md was published earlier as andreybegma/claude-code-plugin/conflict.
PR Merge Conflict Resolver
You are a senior engineer resolving merge conflicts. Given a PR number or current branch, you detect conflicts, auto-resolve obvious ones (imports, formatting, non-overlapping additions), and interactively resolve ambiguous ones.
Inputs
$ARGUMENTS — PR number (optional). If empty, uses current branch.
Step 1: Gather Context
1.1: Determine branches
If PR number given:
If command fails (non-zero exit code, or PR not found), output:
Stop here.
Parse JSON → HEAD_BRANCH = headRefName, BASE_BRANCH = baseRefName, PR_TITLE = title, PR_NUMBER = number.
Checkout the PR branch:
If checkout fails (branch not found locally or remotely), try:
If still fails, output error and stop.
If no PR number:
Set HEAD_BRANCH to current branch. If HEAD is detached, output:
Stop here.
Detect base branch by looking up the open PR for this branch first:
If the result is a non-empty JSON array:
- Parse →
BASE_BRANCH= baseRefName,PR_NUMBER= number,PR_TITLE= title
If the result is empty (no open PR found), fall back to remote default branch:
If that also fails (no remote, no network), fall back:
Use the first branch that exists. If none exist, output:
Stop here.
Set BASE_BRANCH to the result. If PR was not found via gh pr list, set PR_NUMBER to empty, PR_TITLE to empty.
1.2: Check working tree & save restore point
If output is non-empty (uncommitted changes exist):
Save STASHED = true. If stash fails, output:
Stop here.
If working tree is clean, set STASHED = false.
Then save restore point:
Save the output as RESTORE_SHA. This is the fallback for abort.
1.3: Fetch and attempt merge
If merge succeeds (exit code 0): no conflicts exist.
If STASHED = true:
Output:
Stop here. Do not proceed to Step 2.
If merge fails (exit code 1): conflicts exist. Continue to Step 2.
Step 2: Identify Conflicted Files
Save as CONFLICT_FILES. Output the numbered list:
Step 3: Analyze & Categorize Conflicts
Read each file in CONFLICT_FILES using the Read tool. For each file, find all conflict regions (delimited by <<<<<<<, =======, >>>>>>>).
Categorize each conflict region into one of these types:
AUTO-resolvable categories
| Category | Detection | Strategy | |
|---|---|---|---|
| Import ordering | Both sides add/reorder import statements, no semantic overlap | Merge + deduplicate + sort alphabetically | |
| Formatting-only | Diff is whitespace, semicolons, trailing commas, quote style only | Accept HEAD (ours) | |
| Non-overlapping additions | Both sides add new code at the same location but the additions are independent (different functions, different properties, different lines) | Keep both — ours first, then theirs | |
| Deleted vs unchanged | One side deletes code, other side keeps it unchanged (no modifications) | Accept deletion | |
| Lock files | File is package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb, Gemfile.lock, poetry.lock, composer.lock | Accept theirs to clear conflict state, then flag for regeneration |
MANUAL-resolution categories
| Category | Detection | |
|---|---|---|
| Overlapping logic | Both sides modify the same lines of functional code | |
| Structural conflict | Changes to function signatures, class structure, type definitions that affect both sides | |
| Same insertion point | Both sides add different functional code at the exact same location |
Build a summary for each file:
Step 4: Present Analysis & Confirm
Output the full categorized summary as plain text:
Then use AskUserQuestion:
- question: "How should conflicts be resolved?"
- options (exactly 3):
| Option | Description | |
|---|---|---|
| Proceed (Recommended) | Auto-resolve obvious conflicts, then handle manual ones interactively | |
| Review each | Review every conflict interactively, including auto-resolvable ones | |
| Abort | Cancel merge and restore branch to original state |
If Abort → jump to Abort Procedure.
If Review each → treat all conflicts as MANUAL in Steps 5 and 6.
Step 5: Auto-Resolve
Process files one at a time (skip if user chose "Review each"). For each file with AUTO conflicts:
- Resolve ALL conflict regions in the file — apply the resolution strategy using the Edit tool for each region, removing conflict markers (
<<<<<<<,=======,>>>>>>>) and applying the merged content - Only after ALL regions in the file are resolved, stage it:
Important: If a file has mixed regions (some AUTO + some MANUAL), do NOT stage it in Step 5. Leave it for Step 6 — resolve the remaining MANUAL regions first, then stage.
For lock files: do NOT edit textually. Clear the conflict state so they don't block the commit:
Note them for the regeneration reminder in Step 7 (regeneration will overwrite this placeholder).
After all auto-resolutions, output:
If no MANUAL conflicts remain, skip to Step 7.
Step 6: Manual Resolution
For each MANUAL conflict (or all conflicts if "Review each" was chosen):
6.1: Show conflict context
Display the conflict with both sides clearly labeled:
6.2: Ask for resolution
Use AskUserQuestion:
- question: "How to resolve this conflict? (<FILE>:<LINES>)"
- options (exactly 4):
| Option | Description | |
|---|---|---|
| Ours | Keep HEAD version (current branch) | |
| Theirs | Keep base branch version | |
| Merge both | Combine both changes into one | |
| Skip | Leave unresolved for now |
If Ours: Edit the file to keep only the ours side, remove conflict markers.
If Theirs: Edit the file to keep only the theirs side, remove conflict markers.
If Merge both: Propose a merged version that combines both changes. Show the proposed code, then use AskUserQuestion:
- question: "Accept this merged code?"
- options (exactly 2):
| Option | Description | |
|---|---|---|
| Accept (Recommended) | Use the proposed merged code | |
| Edit | Describe what to change |
If Edit, apply the user's requested changes, show the updated code, and re-confirm with the same Accept/Edit question. Then Edit the file with the final version.
If Skip: Leave the conflict markers in place. Note as skipped.
6.3: Stage resolved files
After processing all regions for a file, check if ALL conflict regions in that file are resolved (none were Skipped). If yes:
If any region in the file was Skipped, do NOT stage the file — it still contains conflict markers.
After all manual resolutions, output:
Step 7: Finalize
7.1: Check remaining conflicts
If any files remain unresolved (were Skipped), git will NOT allow a merge commit. Handle this:
If ALL conflicts were skipped (nothing staged):
Run the Abort Procedure. Stop here.
If some conflicts were skipped (partial resolution):
Use AskUserQuestion:
- question: "How to handle unresolved files?"
- options (exactly 3):
| Option | Description | |
|---|---|---|
| Accept ours (Recommended) | Keep HEAD version for all unresolved files, complete the merge | |
| Accept theirs | Keep base branch version for all unresolved files, complete the merge | |
| Abort | Cancel merge and restore branch to original state |
If Abort → run Abort Procedure.
If Accept ours or Accept theirs: for each unresolved file:
or:
7.2: Lint check
Read package.json and extract all lint-related scripts (keys containing lint or biome, case-insensitive).
If no lint scripts found: skip this step entirely.
If lint scripts found:
Detect the package manager from lock file presence:
bun.lockb→bun runpnpm-lock.yaml→pnpm runyarn.lock→yarnpackage-lock.jsonor fallback →npm run
Run each detected lint script in order:
(Skip scripts that are clearly fix-only, e.g. lint:fix, biome:fix — run those only during auto-fix.)
If all lint scripts pass: continue to 7.3.
If any lint script fails: show the full error output, then use AskUserQuestion:
- question: "Lint errors found after conflict resolution. How to proceed?"
- options (exactly 3):
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/conflict/SKILL.md
Popularity
- Repository stars
- 1
- Repository forks
- 1
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/andreybegma/claude-code-plugin/conflict)