AGENT SKILL

git-resolve-conflicts

Resolve Git merge or rebase conflicts in the current repository without staging, continuing, or committing the result.

License 许可
MIT
所属仓库
xhd2015/agent-pro
最近更新
2026-11-12
Stars
★ 1
Forks
0

01 前言 Front Matter

name
git-resolve-conflicts
description
Resolve Git merge or rebase conflicts in the current repository without staging, continuing, or committing the result.

02 资源文件 1

03 SKILL.md 正文

You are a Git conflict resolution specialist. Use this skill when the user asks you to resolve conflicts, finish a merge/rebase conflict, or inspect conflict markers.

Scope

Resolve conflicted files in the current repository only. Do not run:

  • git add
  • git rebase --continue
  • git merge --continue
  • git commit
  • commands that abort, reset, checkout, or otherwise discard user work unless the user explicitly asks for that operation

Your job ends after the working tree files are edited so conflict markers are gone and the intended content is present. Tell the user what you fixed and what command they should run next.

Required Workflow

  1. Confirm the repository state:
    • Run git rev-parse --show-toplevel.
    • Check whether .git/rebase-merge, .git/rebase-apply, or MERGE_HEAD exists via Git or filesystem inspection.
    • Run git status --short or git status --porcelain=v1 and identify unmerged paths (UU, AA, AU, UA, DU, UD).
  2. If the repo is not in a merge or rebase, or there are no conflicted files, report that clearly and stop.
  3. For each conflicted file, inspect both sides before editing:
    • Use git diff --ours -- <path> and git diff --theirs -- <path>.
    • Use git show :2:<path> and git show :3:<path> when useful.
    • Read the working copy file with conflict markers.
  4. Determine intent:
    • During a merge, ours is the current branch (HEAD) and theirs is the incoming branch (MERGE_HEAD).
    • During a rebase, Git's labels can be counterintuitive: ours is the branch/commit already checked out as the rebase target, and theirs is the commit being replayed. Use git status, rebase metadata, commit messages, and surrounding code to identify what the current working tree and incoming change are trying to do.
  5. Edit files to remove conflict markers and preserve the correct combined behavior. Prefer the repository's existing style and nearby patterns.
  6. Verify:
    • Run rg -n '^(<<<<<<<|=======|>>>>>>>)' on resolved text files.
    • Run git diff --check.
    • Run focused tests or formatters only when they are cheap and directly relevant; do not let verification stage or continue Git operations.
  7. Final response:
    • List each file resolved and the decision made.
    • State that no git add, continue, or commit was run.
    • Suggest the next command, usually git add <files> followed by git rebase --continue or git merge --continue, depending on state.

Resolution Principles

  • Do not blindly choose one side. Understand both changes and combine them when both are valid.
  • If one side deletes a file and the other edits it, inspect why before keeping or deleting.
  • If generated files are conflicted, prefer regenerating from source when the repo has an established generator.
  • If the conflict requires product or domain judgment that cannot be inferred, stop after explaining the competing choices and ask the user.

04 同仓库更多 Skills

xhd2015
xhd2015/agent-pro

verify-with-prototype

Prototype-before-production workflow for risky host integrations (sudo, privileges, system config). Use when a feature touches the real OS, when behavior must be proven with a small script before full implementation, or when the user mentions prototype verification, POC script, or verify-with-prototype. Run after investigate/followup and before doctest-TDD integration.

★ 1
xhd2015
xhd2015/agent-pro

verify-on-behalf-of-user

Run human-style scenario verification after an agent claims work is done: git status, build into ~/.sandbox/bin (default sandbox mode) or opt-in host mode (outside sandbox: wrk --reinstall-local / change-scoped install), real integration/E2E scenarios (start servers, browser-agent for UI), always-labeled depth, markdown transcript written and inlined for review. Use for "verify on my behalf", before commit. Complements doctests; does not replace them. Load a sub-topic with: agent-pro skill --show verify-on-behalf-of-user/<topic>

★ 1
xhd2015
xhd2015/agent-pro

test-case-tree-design-expert

Use when the user wants a decision-tree style test case design with inherited setup and per-leaf assertions.

★ 1
xhd2015
xhd2015/agent-pro

test-case-design-expert

Use when the user wants comprehensive user-facing end-to-end test scenarios for a feature description.

★ 1
xhd2015
xhd2015/agent-pro

tdd-expert

Use when the user has a test-case-tree output and wants runnable Go tests plus stub implementation following Test-Driven Development.

★ 1
xhd2015
xhd2015/agent-pro

summarize-a-skill

Meta-skill: distill durable high-signal guidance (worked vs failed, wrong → correct, and anything else that quickens future similar tasks) into a brief reusable skill document with YAML frontmatter. When the user does not explicitly ask for a new skill/file, prefer updating an existing skill over creating one. Writes skills/<name>/SKILL.md (or docs|doc/skills/…). Use for /summarize-a-skill, "summarize what worked", "lessons learned into a skill", or "write a skill from this session".

★ 1