{"id":"f4beda2f-9682-413e-97ca-19402f6fd93d","shortId":"NJ3VXN","kind":"skill","title":"fix-pr-conflict","tagline":"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.","description":"# Fix PR Conflict\n\nResolve merge conflicts on a pull request so it becomes mergeable.\n\n## 1. Identify the PR\n\nDetermine the PR number using these sources, in order of priority:\n\n1. Explicit number from the user's request.\n2. A PR created earlier in this conversation (check chat history for `gh pr create` output or PR URLs).\n3. The current branch via `gh pr view`.\n\n```bash\n# Try the current branch first\ngh pr view --json number,headRefName,baseRefName,mergeable,mergeStateStatus 2>/dev/null\n\n# Or by explicit number\ngh pr view <number> --json headRefName,baseRefName,mergeable,mergeStateStatus\n```\n\nIf the PR is already mergeable, report that and stop.\n\n## 2. Prepare\n\n```bash\ngit fetch origin <baseRefName> <headRefName>\ngit checkout <headRefName>\n```\n\nVerify the working tree is clean before proceeding.\n\n## 3. Rebase onto Base Branch\n\n```bash\ngit rebase origin/<baseRefName>\n```\n\nIf the rebase completes with no conflicts, skip to step 5.\n\n## 4. Resolve Conflicts\n\nWhen the rebase stops on a conflict:\n\n1. **List conflicting files**: `git diff --name-only --diff-filter=U`\n2. **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:\n   - Accept either side to unblock the rebase (e.g. `git checkout --theirs <file>` or `git checkout --ours <file>`), `git add <file>`, and continue.\n   - 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.\n3. **For each remaining conflicting file**, understand both sides:\n   - Read the file to see the conflict markers.\n   - Check what the base branch changed: `git log --oneline origin/<baseRefName> -- <file>` and read the relevant commits.\n   - Check what the PR branch changed: review the current commit being applied (`git log --oneline -1 REBASE_HEAD`).\n   - **For >5 conflicting files, fan out the per-file analysis** to `Explore` subagents (`model: sonnet`, per `subagent-model-routing` — semantic intent matters; classification requires understanding both sides' design) per `parallelize-subagents` and `delegate-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 with `Status: ...` per `subagent-prompt-contract`. Main agent applies resolutions sequentially via `Edit` (Explore is read-only; it analyzes, you apply).\n4. **Classify the conflict**:\n   - **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.\n   - **Semantic**: both sides changed the same logic or API in incompatible ways. Attempt to resolve if the correct outcome is clear from context.\n   - **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.\n5. **After resolving each file**: `git add <file>`\n6. **Continue the rebase**: `git rebase --continue`\n7. **Repeat** until the rebase completes or an ambiguous conflict requires escalation.\n\n## 5. Verify\n\nRun verification per [verify-when-complete](../verify-when-complete/SKILL.md). If failures stem from a bad conflict resolution, fix and amend the relevant commit. If errors are unrelated, report them.\n\n## 6. Force Push\n\n```bash\ngit push --force-with-lease\n```\n\nThen verify the PR is now mergeable:\n\n```\ngh pr view <number> --json mergeable,mergeStateStatus\n```\n\nReport the result. If GitHub still reports conflicts (can take a few seconds to recompute), wait and re-check once.\n\n## 7. Summarize Semantic Resolutions\n\nIf any conflict resolutions were **semantic** (changed logic, adapted APIs, reconciled incompatible changes) rather than purely mechanical:\n\n1. Ask the user whether a summary of the conflict resolutions should be added as a comment on the PR.\n2. If yes, post a concise comment:\n   ```bash\n   gh pr comment <number> --body \"...\"\n   ```\n   The comment should summarize what was resolved and any decisions made during resolution. Keep it brief: focus on what a reviewer needs to know.\n\nIf all resolutions were mechanical (adjacent-line merges, independent additions), skip this step.","tags":["fix","conflict","skill","issue","paultyng","agent-skills","ai-tools","claude-code","cursor","dotfiles"],"capabilities":["skill","source-paultyng","skill-fix-pr-conflict","topic-agent-skills","topic-ai-tools","topic-claude-code","topic-cursor","topic-dotfiles"],"categories":["skill-issue"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/paultyng/skill-issue/fix-pr-conflict","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add paultyng/skill-issue","source_repo":"https://github.com/paultyng/skill-issue","install_from":"skills.sh"}},"qualityScore":"0.454","qualityRationale":"deterministic score 0.45 from registry signals: · indexed on github topic:agent-skills · 8 github stars · SKILL.md body (4,605 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T19:09:00.992Z","embedding":null,"createdAt":"2026-05-18T13:21:26.150Z","updatedAt":"2026-05-18T19:09:00.992Z","lastSeenAt":"2026-05-18T19:09:00.992Z","tsv":"'-1':339 '/dev/null':118 '/verify-when-complete/skill.md':551 '1':52,67,187,637 '2':75,117,141,200,657 '3':94,157,292 '4':177,429 '5':176,343,516,542 '6':523,572 '7':530,616 '80':403 'abort':495,500 'accept':243 'ad':650 'adapt':628 'add':259,282,522 'addit':447,703 'adjac':445,699 'adjacent-lin':698 'agent':414 'alreadi':135 'ambigu':397,482,538 'amend':280,562 'analysi':352 'analyz':426 'api':467,629 'appli':335,415,428 'ask':31,638 'attempt':236,471 'bad':557 'base':16,160,312 'base/pr':390 'baserefnam':114,128 'bash':102,143,162,575,664 'becom':50 'bodi':668 'branch':17,97,106,161,313,328 'brief':684 'buf':272 'chang':314,329,436,450,455,462,626,632 'chat':84 'check':83,201,309,324,614 'checkout':148,252,256 'classif':366,394 'classifi':430 'clean':154 'clear':479 'code':212,216 'code-gener':211 'comment':653,663,667,670 'commit':287,323,333,391,565 'complet':169,265,535,550 'concis':662 'conflict':4,7,27,34,40,43,172,179,186,189,208,240,296,307,344,386,432,484,511,539,558,602,622,646 'context':481 'continu':261,524,529 'contract':412 'convers':82 'correct':457,476 'creat':78,89 'current':96,105,332 'decis':488,678 'deleg':378 'delegate-investig':377 'descript':508 'design':371,487 'determin':56 'diff':192,197 'diff-filt':196 'dir':233 'e.g':250,444 'earlier':79 'edit':220,419 'either':244 'error':567 'escal':502,541 'etc':278 'exist':515 'explicit':68,121 'explor':354,420 'failur':553 'fan':346 'fetch':145 'file':190,204,209,268,297,303,345,351,384,520 'filter':198 'first':107,205 'fix':2,33,38,560 'fix-pr-conflict':1 'focus':685 'follow':285 'follow-up':284 'forc':573,579 'force-with-leas':578 'format':458 'function':449 'gen.go':230 'generat':203,213,217,226,273,275,277 'gh':87,99,108,123,589,665 'git':144,147,163,191,251,255,258,315,336,498,521,527,576 'github':599 'go':274 'head':341 'header':221 'headrefnam':113,127 'histori':85 'identifi':53 'import':446 'incompat':469,631 'independ':443,702 'instead':242 'intent':364,441,493 'investig':379 'involv':485 'json':111,126,592 'keep':453,682 'know':692 'known':225 'leas':581 'like':228 'line':438,700 'list':188 'log':316,337 'logic':465,627 'look':214 'made':679 'main':413 'marker':241,308,387 'match':224 'matter':365 'mechan':395,433,636,697 'merg':6,26,42,238,701 'mergeabl':24,51,115,129,136,588,593 'mergestatestatus':116,130,594 'model':356,361 'name':194 'name-on':193 'nearbi':437 'need':690 'number':59,69,112,122 'one':383 'onelin':317,338 'onto':14,159 'option':514 'order':64 'origin':146,165,318 'outcom':477 'output':90,227,232,291 'parallel':374 'parallelize-subag':373 'path':223 'pb.go':229 'per':350,358,372,408,546 'per-fil':349 'plus':398 'post':660 'pr':3,21,37,39,55,58,77,88,92,100,109,124,133,327,585,590,656,666 'prefix':405 'prepar':142 'prioriti':66 'proceed':156 'prompt':411 'propos':401 'pull':10,46 'pure':635 'push':574,577 'rather':633 're':613 're-check':612 'read':301,320,382,423 'read-on':422 'rebas':13,158,164,168,182,249,264,340,497,499,526,528,534 'recomput':609 'reconcil':630 'regener':266,290 'relev':322,389,564 'remain':295 'repeat':531 'report':137,570,595,601 'request':11,47,74 'requir':367,489,540 'resolut':400,416,559,619,623,647,681,695 'resolv':5,41,178,451,473,518,675 'result':597 'return':392 'review':330,689 'rout':362 'run':544 'second':607 'see':305 'semant':363,396,459,618,625 'sequenti':417 'side':245,300,370,435,461 'skill' 'skill-fix-pr-conflict' 'skip':173,704 'sonnet':357 'sourc':62,271 'source-paultyng' 'sqlc':276 'sqlc/openapi':231 'status':407 'stem':554 'step':175,706 'still':600 'stop':140,183,494 'subag':355,360,375,381,410 'subagent-model-rout':359 'subagent-prompt-contract':409 'summar':617,672 'summari':643 'take':604 'topic-agent-skills' 'topic-ai-tools' 'topic-claude-code' 'topic-cursor' 'topic-dotfiles' 'tradeoff':490 'tree':152 'tri':103 'u':199 'unblock':247 'unclear':492 'understand':298,368 'unrel':448,569 'url':93 'use':18,60 'user':30,72,505,640 'verif':545 'verifi':149,543,548,583 'verify-when-complet':547 'via':98,418 'view':101,110,125,591 'wait':610 'way':470 'whether':641 'word':404 'work':151 'yes':659","prices":[{"id":"cde24733-3a2a-4403-9544-3eb7d2158c9c","listingId":"f4beda2f-9682-413e-97ca-19402f6fd93d","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"paultyng","category":"skill-issue","install_from":"skills.sh"},"createdAt":"2026-05-18T13:21:26.150Z"}],"sources":[{"listingId":"f4beda2f-9682-413e-97ca-19402f6fd93d","source":"github","sourceId":"paultyng/skill-issue/fix-pr-conflict","sourceUrl":"https://github.com/paultyng/skill-issue/tree/main/skills/fix-pr-conflict","isPrimary":false,"firstSeenAt":"2026-05-18T13:21:26.150Z","lastSeenAt":"2026-05-18T19:09:00.992Z"}],"details":{"listingId":"f4beda2f-9682-413e-97ca-19402f6fd93d","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"paultyng","slug":"fix-pr-conflict","github":{"repo":"paultyng/skill-issue","stars":8,"topics":["agent-skills","ai-tools","claude-code","cursor","dotfiles"],"license":"mit","html_url":"https://github.com/paultyng/skill-issue","pushed_at":"2026-05-18T18:26:54Z","description":"Personal Claude Code / Cursor agent skills, rules, and config","skill_md_sha":"606f4db0b73dff596319b041be0a40665d0b836a","skill_md_path":"skills/fix-pr-conflict/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/paultyng/skill-issue/tree/main/skills/fix-pr-conflict"},"layout":"multi","source":"github","category":"skill-issue","frontmatter":{"name":"fix-pr-conflict","description":"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."},"skills_sh_url":"https://skills.sh/paultyng/skill-issue/fix-pr-conflict"},"updatedAt":"2026-05-18T19:09:00.992Z"}}