Agent skill
ai-resolve-conflicts
Use when git reports merge conflicts during rebase, merge, cherry-pick, or revert operations.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/ai-resolve-conflicts-arcasilesgroup-ai-engineering
SKILL.md
Resolve Conflicts
Purpose
Intelligent git conflict resolution. Detects conflict type, categorizes files by resolution strategy, and resolves conflicts with awareness of both sides' intent. Handles lock files, migrations, and code conflicts differently.
Trigger
- Command:
/ai-resolve-conflicts - Context: git operation resulted in conflicts (rebase, merge, cherry-pick, revert).
- Auto-detect:
git statusshows "Unmerged paths" or "both modified".
Procedure
-
Detect conflict type -- determine the operation that caused conflicts:
bash# Check which operation is in progress test -d .git/rebase-merge || test -d .git/rebase-apply # rebase test -f .git/MERGE_HEAD # merge test -f .git/CHERRY_PICK_HEAD # cherry-pick test -f .git/REVERT_HEAD # revert -
List conflicted files --
git diff --name-only --diff-filter=U -
Categorize each file by resolution strategy:
Category File patterns Strategy Lock files *.lock,poetry.lock,Cargo.lock,package-lock.json,uv.lockAccept theirs, regenerate Migrations migrations/,alembic/versions/Ask user (order matters) Generated *.min.js,*.min.css,dist/,build/Accept theirs, rebuild Config *.yml,*.toml,*.json(non-lock)AI merge with validation Code everything else AI analysis -
Resolve by category:
Lock files: accept incoming version, then regenerate:
bashgit checkout --theirs <lockfile> # Then regenerate: npm install / cargo generate-lockfile / uv lock / etc.Migrations: present both sides to user with context. Migration ordering is semantic -- never auto-resolve. Show the migration graph and ask which order to apply.
Generated files: accept theirs, rebuild from source after resolution.
Config files: read both versions, merge intelligently preserving both sides' additions. Validate result against schema if available.
Code conflicts: for each conflict hunk: a. Read surrounding context (50 lines each side) b. Identify intent of each change (what was the goal?) c. Check commit messages for both sides d. Propose resolution preserving both intents e. If intents conflict, present options to user
-
Stacked PR detection -- if resolving conflicts between branches in a stack: a. Compare base, HEAD, and incoming for similarity b. If high overlap, likely a stacked PR rebase -- prefer incoming (later branch) c. Warn user about potential cascade to downstream branches
-
Validate resolution:
- Run
git diffto review all resolutions - Run stack-specific checks (build, lint, test)
- Present summary before continuing the operation
- Run
-
Continue operation:
bashgit add <resolved-files> git rebase --continue # or merge --continue, etc.
Common Mistakes
| Mistake | Why it is wrong |
|---|---|
| Auto-resolving migration conflicts | Migration order is semantic; wrong order corrupts data |
| Keeping both sides of a lock file | Lock files must be regenerated from the manifest |
| Resolving without reading commit messages | Loses context about intent |
Quick Reference
/ai-resolve-conflicts # auto-detect and resolve current conflicts
No arguments needed -- the skill reads git state directly.
$ARGUMENTS
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?