Fix merge conflicts

From MoonLadderStudios/MoonMind · View interactive version

Fix merge conflicts is an AI agent skill from the GitHub repository MoonLadderStudios/MoonMind. Sync the branch with the latest PR base branch from `origin`, merge the PR base ref, resolve conflicts end-to-end, then commit and push the current branch.

How to use this skill

Skill file

Fix Merge Conflicts

Run this as an end-to-end sync and conflict resolution workflow:

  1. Fetch latest PR base branch from origin.
  2. Merge the PR base ref into the current branch.
  3. Resolve any conflicts.
  4. Validate no conflict markers remain.
  5. Commit and push the current branch.

Inputs

release/2.x). The merge target is always origin/<base>.

base_unavailable. Never silently substitute a default branch for a PR

that targets another base branch.

Default Prompt

Fetch the latest PR base branch from origin for `inputs.base`, merge `origin/<base>` into the current branch, resolve all merge conflicts, verify no conflict markers remain, then commit and push. If `inputs.base` is missing or empty, stop as blocked with reason `base_unavailable`.

Workflow

  1. Resolve helpers exclusively from the run's immutable active bundle.
FIX_MERGE_CONFLICTS_SKILL_DIR="${FIX_MERGE_CONFLICTS_SKILL_DIR:-${MOONMIND_ACTIVE_SKILLS_DIR:+$MOONMIND_ACTIVE_SKILLS_DIR/fix-merge-conflicts}}"
ACTIVE_SKILLS_DIR="${MOONMIND_ACTIVE_SKILLS_DIR:-$(dirname "$FIX_MERGE_CONFLICTS_SKILL_DIR")}"
test -n "$FIX_MERGE_CONFLICTS_SKILL_DIR" && test -f "$FIX_MERGE_CONFLICTS_SKILL_DIR/SKILL.md"

helper below resolves from it; a checked-in .agents/skills directory must

never shadow the selected snapshot. Outside MoonMind, set

FIX_MERGE_CONFLICTS_SKILL_DIR to the directory containing this SKILL.md

(no MoonMind-only environment variables required). A missing selected

helper is a materialization/packaging error: stop as blocked instead of

substituting stale repository code.

  1. Resolve the merge target from authoritative sources before any mutation:

branch name (for example main or release/2.x). The merge target is

always origin/<base>. If the base is missing or empty, stop as blocked

with reason base_unavailable; never silently substitute a default branch

for a PR that targets another base branch. This non-merging skill takes no

finish mode.

authoritative PR itself (gh pr view --json number,headRefName,baseRefName,headRepository)

before mutating. If inputs.base disagrees with the PR's base, or the

base ref changed since task start, stop as blocked instead of merging a

changed/wrong base.

combination the authorized boundary cannot safely mutate, stop before

mutation as blocked with reason unsupported_source instead of pushing

across authority boundaries.

not block fetching or attempting the merge on missing identity: read only

the already-configured identity (git config --get user.name

and git config --get user.email, honoring repository-local configuration

first) just before committing, and revalidate both values before each

write. Do not invent, default, or export a fallback author/email and do

not write identity from unvalidated inputs or environment defaults.

without committing or pushing: report the missing identity and the

supported setup (git config user.name "<name>" /

git config user.email "<email>") so the operator can provide authorized

configuration. A clean, fast-forward, or already-up-to-date merge that

creates no commit needs no identity and must not be blocked by this check.

  1. Sync remote refs for the PR base branch.

unstaged, and untracked work, local branch state, and configured Git

identity; take no mutation that would discard or absorb unrelated changes.

  1. Merge the latest PR base ref into the current branch.

git merge --autostash origin/<base> so pre-existing staged/unstaged

work is stashed and restored automatically. If the merge still refuses,

or --autostash is unsupported, perform the merge in an isolated

worktree with bounded restoration instead of stalling.

  1. Resolve conflicts in each unmerged file.

intended behavior of both sides, not merely contain no marker strings.

(git add <intentional-file> [...]). Never use git add -A, git add .,

or any unconditional/broad staging, and never stage or commit unrelated

pre-existing staged, unstaged, or untracked files.

When delegated by pr-resolver, commit through its pr_resolve_commit.py

helper; a refused commit is local_commit_failed, never publish_unavailable.

  1. Validate resolution completeness.

the semantic merge result and run the targeted checks from step 6. A

marker-free tree with broken or regressed behavior is not resolved.

  1. Run quick verification.
  1. Commit and push only intentional task changes.

unrelated local changes: leave pre-existing staged, unstaged, and untracked

files unmodified and uncommitted in clean-merge, conflict, fast-forward,

and no-op paths, and do not alter local branch state beyond the task's own

commits.

dropped connection, ambiguous tool output), reconcile first: re-read the

remote branch head and PR state and continue from the reconciled state

instead of pushing or merging again blindly.

a verified primary effect and never cause another push/merge on their own.

```bash

python3 "$ACTIVE_SKILLS_DIR/_shared/publish_evidence.py" write-pushed \

--skill-id fix-merge-conflicts \

--repo "$REPO" \

--branch "$BRANCH"

```

```bash

python3 "$ACTIVE_SKILLS_DIR/_shared/publish_evidence.py" write-no-op \

--skill-id fix-merge-conflicts \

--repo "$REPO" \

--branch "$BRANCH"

```

```bash

python3 "$ACTIVE_SKILLS_DIR/_shared/publish_evidence.py" write-blocked \

--skill-id fix-merge-conflicts \

--repo "$REPO" \

--branch "$BRANCH" \

--reason publish_unavailable

```

Do not report success.

Output

Provide:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.