fix-pr-conflict
Skill8 starsChanged 3 months agoMITView on GitHub
Resolve merge conflicts on a pull request by rebasing onto the base branch. Use when a PR is not mergeable, has merge conflicts, or the user asks to fix conflicts on a PR.
- Deletes or force-pushes
- Commits and pushes
We split this skill into the rules it gives an agent
14 rules. About 0 are common, 12 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈12
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 26
If the PR is already mergeable, report that and stop.
- Distinctive: line 35
Verify the working tree is clean before proceeding.
- Distinctive: line 43
If the rebase completes with no conflicts, skip to step 5.
- Distinctive: line 47
When the rebase stops on a conflict:
- Distinctive: line 50
Check for generated files first: if a conflicting file is code-generated (look for
- Very specific: line 52
After the rebase completes, regenerate the file from its source (buf generate, go generate, sqlc generate, etc.) and amend or add a …
- Distinctive: line 54
Read the file to see the conflict markers.
- Very specific: line 55
Check what the base branch changed: git log --oneline origin/<baseRefName> -- <file> and read the relevant commits.
- Distinctive: line 56
Check what the PR branch changed: review the current commit being applied (git log --oneline -1 REBASE_HEAD).
- Distinctive: line 68
Run verification per verify-when-complete.
- Distinctive: line 86
If any conflict resolutions were semantic (changed logic, adapted APIs, reconciled incompatible changes) rather than purely mechanical:
- Distinctive: line 88
Ask the user whether a summary of the conflict resolutions should be added as a comment on the PR.
- Distinctive: line 89
If yes, post a concise comment:
- Distinctive: line 95
If all resolutions were mechanical (adjacent-line merges, independent additions), skip this step.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Fix PR Conflict
Resolve merge conflicts on a pull request so it becomes mergeable.
1. Identify the PR
Determine the PR number using these sources, in order of priority:
- Explicit number from the user's request.
- A PR created earlier in this conversation (check chat history for
gh pr createoutput or PR URLs). - The current branch via
gh pr view.
# Try the current branch first
gh pr view --json number,headRefName,baseRefName,mergeable,mergeStateStatus 2>/dev/null
# Or by explicit number
gh pr view <number> --json headRefName,baseRefName,mergeable,mergeStateStatusIf the PR is already mergeable, report that and stop.
2. Prepare
git fetch origin <baseRefName> <headRefName>
git checkout <headRefName>Verify the working tree is clean before proceeding.
3. Rebase onto Base Branch
git rebase origin/<baseRefName>If the rebase completes with no conflicts, skip to step 5.
4. Resolve Conflicts
When the rebase stops on a conflict:
- List conflicting files:
git diff --name-only --diff-filter=U - Check for generated files first: if a conflicting file is code-generated (look for
// Code generated ... DO NOT EDIT.headers, or paths matching known generator outputs like*.pb.go,*_gen.go, sqlc/openapi output dirs), do not attempt to merge the conflict markers. Instead:- Accept either side to unblock the rebase (e.g.
git checkout --theirs <file>orgit checkout --ours <file>),git add <file>, and continue. - After the rebase completes, regenerate the file from its source (
buf generate,go generate,sqlc generate, etc.) and amend or add a follow-up commit with the regenerated output.
- Accept either side to unblock the rebase (e.g.
- For each remaining conflicting file, understand both sides:
- Read the file to see the conflict markers.
- Check what the base branch changed:
git log --oneline origin/<baseRefName> -- <file>and read the relevant commits. - Check what the PR branch changed: review the current commit being applied (
git log --oneline -1 REBASE_HEAD). - For >5 conflicting files, fan out the per-file analysis to
Exploresubagents (model: sonnet, persubagent-model-routing— semantic intent matters; classification requires understanding both sides' design) perparallelize-subagentsanddelegate-investigation. Each subagent reads one file's conflict markers + the relevant base/PR commits, returns a classification (mechanical / semantic / ambiguous) plus a resolution proposal in ≤80 words, prefixed withStatus: ...persubagent-prompt-contract. Main agent applies resolutions sequentially viaEdit(Explore is read-only; it analyzes, you apply).
- Classify the conflict:
- Mechanical: both sides changed nearby lines but the intent is independent (e.g. adjacent import additions, unrelated function changes). Resolve by keeping both changes with correct formatting.
- Semantic: both sides changed the same logic or API in incompatible ways. Attempt to resolve if the correct outcome is clear from context.
- Ambiguous: the conflict involves a design decision, requirement tradeoff, or unclear intent. Stop, abort the rebase (
git rebase --abort), and escalate to the user with a description of the conflict and what options exist.
- After resolving each file:
git add <file> - Continue the rebase:
git rebase --continue - Repeat until the rebase completes or an ambiguous conflict requires escalation.
5. Verify
Run verification per verify-when-complete. If failures stem from a bad conflict resolution, fix and amend the relevant commit. If errors are unrelated, report them.
6. Force Push
git push --force-with-leaseThen verify the PR is now mergeable:
gh pr view <number> --json mergeable,mergeStateStatusReport the result. If GitHub still reports conflicts (can take a few seconds to recompute), wait and re-check once.
7. Summarize Semantic Resolutions
If any conflict resolutions were semantic (changed logic, adapted APIs, reconciled incompatible changes) rather than purely mechanical:
- Ask the user whether a summary of the conflict resolutions should be added as a comment on the PR.
- If yes, post a concise comment:
The comment should summarize what was resolved and any decisions made during resolution. Keep it brief: focus on what a reviewer needs to know.gh pr comment <number> --body "..."
If all resolutions were mechanical (adjacent-line merges, independent additions), skip this step.
In this repository38 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- active-readSkill
- active-reviewSkill
- analyze-knowledgeSkill
- audit-accomplishmentsSkill
- audit-historySkill
- bisectSkill
- ci-debug-loopSkill
- create-decision-documentSkill
- create-jira-itemSkill
- create-prSkill
- create-ruleSkill
- create-skillSkill
- discover-patternsSkill
- evaluate-dependencySkill
- implement-planSkill
- match-voiceSkill
- push-and-watchSkill
- rebase-pr-chainSkill
- review-allSkill
- review-api-compatSkill
- review-ciSkill
- review-codeSkill
- review-coverageSkill
- review-databaseSkill
- review-documentationSkill
- review-infrastructureSkill
- review-observabilitySkill
- review-performanceSkill
- review-planSkill
- review-reliabilitySkill
- review-securitySkill
- review-trajectorySkill
- set-session-contextSkill
- ship-itSkill
- simplify-proseSkill
- start-daySkill
- verify-when-completeSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

