agentleFS
ulises-jeremiasulises-jeremias/agent-toolkit/skills/forge/fix-merge-conflicts/SKILL.md

fix-merge-conflicts

Skill19 starsChanged 2 months agoMITView on GitHub

Resolve merge conflicts non-interactively, validate build and tests, and finalize conflict resolution

  • Installs packages
  • Commits and pushes

We split this skill into the rules it gives an agent

7 rules. 1 is common, 3 are distinctive, and 3 are very specific to this project.

  • 1

    Common

    Most of the 9 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Detect conflicts: Run git status --porcelain and scan for UU/AA/DD/U* markers.

    line 32
  2. Distinctive:

    Validate: Run compile, lint, and the most relevant tests for the touched areas.

    line 38
  3. Common:

    Keep changes minimal and readable.

    line 54
  4. Very specific:

    Do not leave conflict markers (<<<<<<<, =======, >>>>>>>) in any file.

    line 55
  5. Distinctive:

    Avoid broad refactors while resolving conflicts — only what is needed to make the merge buildable.

    line 56
  6. Very specific:

    Do not push, tag, or force-push during conflict resolution.

    line 57
  7. Distinctive:

    Do not hand-edit lockfiles.

    line 58

“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Fix Merge Conflicts

Resolve merge conflicts non-interactively and return the branch to a buildable state.

When to use

  • git status shows Unmerged paths or CONFLICT, or the branch reports merge conflicts against main.
  • User asks to "fix merge conflicts", "resolve conflicts", "rebase and fix", or "make this branch mergeable".
  • A PR is blocked by conflicts after pulling main.

Prerequisites

  • Inside a Git repository with write access (git status works).
  • Conflicts come from a merge or rebase (e.g. git merge main, git pull --rebase, gh pr update-branch).
  • Toolchain available for validation: package manager (npm/yarn/pnpm/bun/uv/cargo/etc.) and git.

Workflow

  1. Detect conflicts. Run git status --porcelain and scan for UU/AA/DD/U* markers. Confirm with grep -r "<<<<<<< " --include="*.md" --include="*.ts" --include="*.js" --include="*.py" --include="*.v" --include="*.yaml" --include="*.json" -l (and git diff --check for leftover markers). List every conflicting file.
  2. Resolve each conflict with minimal, correctness-first edits. Open each file, read the <<<<<<< / ======= / >>>>>>> hunks, and choose the merge that compiles and preserves public behavior. Prefer preserving both sides when safe; otherwise pick the variant that keeps the build green and does not change external API semantics. Keep edits readable — no broad refactors while resolving.
  3. Regenerate lockfiles via the package manager — do not hand-edit. If a lockfile is conflicted (package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb, Cargo.lock, uv.lock, go.sum, Gemfile.lock, etc.), discard conflict markers and regenerate: npm install --package-lock-only, yarn install, pnpm install, bun install, cargo update --workspace, uv lock, or the repo's documented install command. Confirm the manager that owns the file (check package.json packageManager, Makefile, or README.md).
  4. Validate. Run compile, lint, and the most relevant tests for the touched areas. At minimum:
    git diff --check  # no leftover markers / whitespace issues
    # then per-stack, e.g.:
    # npm run build  /  cargo check  /  v vet  /  make build
    # npm run lint   /  ruff check .  /  ./scripts/validate-skills.vsh
    # npm test -- <changed packages>  /  pytest -q <changed modules>
    Re-run until the working tree is clean of markers and the build succeeds.
  5. Stage and finalize. git add <resolved files> then git status to confirm no remaining Unmerged paths. If a rebase/merge was in progress, run git rebase --continue or git commit as appropriate (no git push or git tag from this skill — delegate to github-cli-workflow).
  6. Summarize decisions. Report: files resolved, notable resolution choices (why each hunk was kept/merged), lockfile regeneration performed, and build/test outcome with next action.

Guardrails

  • Keep changes minimal and readable.
  • Do not leave conflict markers (<<<<<<<, =======, >>>>>>>) in any file.
  • Avoid broad refactors while resolving conflicts — only what is needed to make the merge buildable.
  • Do not push, tag, or force-push during conflict resolution. Delegate pushes to github-cli-workflow after user confirmation.
  • Do not hand-edit lockfiles; always regenerate via the owning package manager.

Output

  • Files resolved (with hunk-level rationale where non-trivial)
  • Notable resolution choices
  • Build/lint/test outcome
  • Next step (continue rebase / commit / push via github-cli-workflow)

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.