mokhovyk

fix-merge-conflicts

1
0
# Install this skill:
npx skills add mokhovyk/ai-specs --skill "fix-merge-conflicts"

Install specific skill from multi-skill repository

# Description

Fix all merge conflicts on the current Git branch non-interactively and make the repo buildable. Use when user has merge conflicts, says "fix conflicts", "resolve merge", or after a failed merge/rebase.

# SKILL.md


name: fix-merge-conflicts
description: Fix all merge conflicts on the current Git branch non-interactively and make the repo buildable. Use when user has merge conflicts, says "fix conflicts", "resolve merge", or after a failed merge/rebase.


Fix Merge Conflicts

Fix all merge conflicts on the current Git branch non-interactively and make the repo buildable and tested.

Requirements

  • Operate from the repository root. If not in a Git repo, stop and report.
  • Do not ask the user for input. Choose sensible defaults and explain decisions in a brief summary.
  • Prefer minimal, correct changes that preserve both sides' intent when possible.
  • Use non-interactive flags for any tools you invoke.
  • Do not push or tag; only commit locally.

High-Level Plan

1) Detect Conflicts

git status --porcelain | cat

Collect files with conflict markers (U statuses or files containing <<<<<<< / ======= / >>>>>>>).

2) Resolve Conflicts Per File

Open each conflicting file and remove conflict markers.

Merge both sides logically when feasible. If mutually exclusive, pick the variant that:
- Compiles and passes type checks, and
- Preserves existing public APIs and behavior.

Language-aware strategy:

File Type Strategy
package.json / pnpm-lock.yaml / yarn.lock Merge keys conservatively; run install to regenerate lockfiles
Lock files (package-lock.json, yarn.lock, pnpm-lock.yaml) Prefer regenerating via the package manager rather than manual edits
Generated files and build artifacts Prefer keeping them out of version control if applicable; otherwise prefer current branch (ours)
Config files Preserve union of safe settings; avoid deleting required fields
Text/markdown Include both unique content, deduplicate headings
Binary files Prefer current branch (ours) unless project docs indicate otherwise

3) Validate

If Node/TypeScript/JS present:
- Install deps if manifests changed (use --frozen-lockfile false equivalents)
- Run lint/typecheck/build/tests if available

If other ecosystems detected (Python, Go, etc.):
- Run their standard build/tests when available

4) Finalize

  • Stage all resolved files and any regenerated lockfiles
  • Create a single commit with message: chore: resolve merge conflicts
  • Output a concise summary of files touched and notable resolution choices

Operational Guidance

  • Assume the user isn't available; make best-effort decisions
  • If a resolution is ambiguous and blocks build/tests, prefer the variant that compiles and green-tests
  • If a file still contains conflict markers after your first pass, revisit and resolve them before proceeding
  • For large refactors causing conflicts, prefer keeping consistent imports, types, and module boundaries
  • Use exhaustive switch guards in TypeScript and explicit type annotations where needed
  • Keep edits minimal and readable; avoid reformatting unrelated code

Deliverables

  • A clean working tree with all conflicts resolved
  • Successful build/tests where applicable
  • One local commit containing the resolutions

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.