Use when Housekeeper or a user asks to resolve Git merge/rebase conflicts on a pull request via rebase + force-with-lease, after GitHub reports mergeable=false. Trigger on /conflict-resolve, "resolve PR conflicts", "rebase and fix conflicts", or similar. Requires an existing PR checkout and confirmed merge conflict.
Ships in conflict-resolve. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Rebases a PR head branch onto the tip of its base, resolves conflict markers agentically, commits with SSH signing, and pushes with force-with-lease only.
This is the only Housekeeper skill allowed to rewrite PR head history.
Never use plain git push --force.
| Requirement | Details |
|---|---|
| Working tree | PR checkout on HEAD_REF (runner provides /work/...) |
BASE_REF, HEAD_REF | From Housekeeper env or JSON input |
CONFLICT_RESOLVE_MODE | write (push allowed) or dry-run (local only) |
| Signing | commit.gpgsign enabled globally by runner entrypoint |
| Python 3.9+ | Stdlib only |
Optional env: OWNER, REPO, PR_NUMBER, GITHUB_TOKEN.
python3 ~/.claude/skills/conflict-resolve/scripts/conflict_tool.py '<json_input>'
Parse stdout as JSON. On error the tool prints {"error":"..."} and exits 1.
Some failures also set "needs_human": true (lease mismatch, branch protection).
Always pass "localRepoPath" when not cwd is not the PR checkout.
prepare_rebase before editing any conflicted file.needs_human).git push --force. Only push_head (force-with-lease).HEAD_REF.push_head.rebase -i.needs_human.Stop and exit non-zero with a human-readable summary when:
package-lock conflict without an obvious mechanical fix.OK to resolve mechanically: import ordering, whitespace, trivial delete+add, clear ours/theirs when one side is pure formatting.
prepare_rebaseFetch base and head, record remote tip SHA (for lease), rebase onto origin/<base>.
Input:
{
"kind": "prepare_rebase",
"localRepoPath": "/work/owner-repo-pr42",
"baseRef": "main",
"headRef": "feature/foo"
}
Output (clean):
{ "status": "clean", "remoteHeadSha": "abc123..." }
Output (conflicts):
{
"status": "conflicted",
"remoteHeadSha": "abc123...",
"files": ["src/a.ts", "package-lock.json"]
}
Output (failed):
{ "status": "failed", "remoteHeadSha": "abc123...", "error": "..." }
Store remoteHeadSha — required for push_head.
list_conflictsInput:
{ "kind": "list_conflicts", "localRepoPath": "/work/..." }
Output:
{
"count": 1,
"conflicts": [
{
"path": "src/a.ts",
"excerpt": " 12|<<<<<<< HEAD\n 13|ours\n..."
}
]
}
commit_resolutionStage resolved paths and continue rebase. Repeats until rebase completes or new conflicts appear. Unsigned commits are rejected.
Input:
{
"kind": "commit_resolution",
"localRepoPath": "/work/...",
"paths": ["src/a.ts"]
}
Output (rebase done):
{ "status": "complete", "headSha": "def456..." }
Output (more conflicts):
{ "status": "conflicted", "files": ["other.ts"], "error": "..." }
Call again after resolving the next batch of files.
push_headForbidden in dry-run. Uses:
git push --force-with-lease=refs/heads/<head>:<remoteHeadSha> origin <head>
Input:
{
"kind": "push_head",
"localRepoPath": "/work/...",
"headRef": "feature/foo",
"remoteHeadSha": "abc123..."
}
Output:
{ "pushed": true, "headSha": "def456...", "headRef": "feature/foo" }
abort_rebaseInput:
{ "kind": "abort_rebase", "localRepoPath": "/work/..." }
Output:
{ "aborted": true }
Use when giving up or before reporting needs_human after partial work.
python3 .../conflict_tool.py '{"kind":"prepare_rebase","localRepoPath":"...","baseRef":"main","headRef":"feature"}'
clean → skip to push (write mode) or plan comment (dry-run).conflicted → continue to Step 2.failed → stop with error.python3 .../conflict_tool.py '{"kind":"list_conflicts","localRepoPath":"..."}'
Edit files to remove markers. Apply ambiguity rules above.
python3 .../conflict_tool.py '{"kind":"commit_resolution","localRepoPath":"...","paths":["file1","file2"]}'
Loop Steps 2–4 until status: complete.
Write mode:
python3 .../conflict_tool.py '{"kind":"push_head","localRepoPath":"...","headRef":"...","remoteHeadSha":"<from prepare>"}'
Dry-run: summarize what would be pushed; do not call push_head.
From any git repo with a conflicted rebase in progress:
export CONFLICT_RESOLVE_MODE=dry-run
python3 scripts/conflict_tool.py '{"kind":"list_conflicts"}'
python3 scripts/conflict_tool.py '{"kind":"push_head","headRef":"x","remoteHeadSha":"abc"}'
# → expect error: forbidden in dry-run
Unit tests (no git/network):
python3 -m unittest discover -s scripts -p 'test_*.py' -v
| Allowed | Forbidden |
|---|---|
prepare_rebase, list_conflicts, commit_resolution | git push --force |
push_head in write mode only | Push base/default branch |
abort_rebase on failure | git rebase -i |
| Mechanical conflict fixes | Guessing business logic |
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
/conflict-resolve:conflict-resolvefrom conflict-resolve
npx claudepluginhub qveys/agent-skills --plugin conflict-resolve