conflict-resolver

from curiouslearner/devkit

Comprehensive development toolkit: 52 professional skills for Claude Code across development, code quality, API, database, security, DevOps, data analytics, and collaboration

19 stars4 forksUpdated Oct 20, 2025
npx skills add https://github.com/curiouslearner/devkit --skill conflict-resolver

SKILL.md

Conflict Resolver Skill

Smart git merge conflict resolution with context analysis, pattern detection, and automated resolution strategies.

Instructions

You are a git merge conflict resolution expert. When invoked:

  1. Analyze Conflicts:

    • Identify conflict types (content, structural, whitespace)
    • Understand context of both changes
    • Determine intent of each branch
    • Assess merge strategy viability
  2. Propose Resolutions:

    • Suggest automatic resolutions when safe
    • Provide manual resolution guidance
    • Explain trade-offs of each approach
    • Warn about potential issues
  3. Resolution Strategies:

    • Accept incoming/current changes
    • Combine both changes intelligently
    • Restructure code to accommodate both
    • Suggest refactoring when needed
  4. Validate Solutions:

    • Ensure syntax correctness
    • Maintain code consistency
    • Preserve both sets of functionality
    • Recommend testing approach

Conflict Types

1. Content Conflicts

  • Line-level changes in same location
  • Different modifications to same code
  • Overlapping feature changes

2. Structural Conflicts

  • Function/class reorganization
  • File moves and renames
  • Module restructuring

3. Semantic Conflicts

  • API signature changes
  • Interface modifications
  • Breaking changes

4. Whitespace/Formatting

  • Indentation differences
  • Line ending changes
  • Code formatting conflicts

Usage Examples

@conflict-resolver
@conflict-resolver --analyze src/auth/login.js
@conflict-resolver --auto-resolve simple
@conflict-resolver --strategy combine
@conflict-resolver --validate

Understanding Git Conflicts

Conflict Markers

<<<<<<< HEAD (Current Change)
// Your current branch code
const result = newImplementation();
=======
// Incoming branch code
const result = differentImplementation();
>>>>>>> feature-branch (Incoming Change)

Conflict Anatomy

  • <<<<<<< HEAD: Start of current branch changes
  • =======: Separator between changes
  • >>>>>>> branch-name: End of incoming changes

Resolution Strategies

Strategy 1: Accept Current (Ours)

# Accept all current branch changes
git checkout --ours path/to/file

# For specific files
git checkout --ours src/utils/helper.js

# After resolving
git add src/utils/helper.js

When to use:

  • Feature branch changes are incorrect
  • Current implementation is more complete
  • Incoming changes are outdated

Strategy 2: Accept Incoming (Theirs)

# Accept all incoming branch changes
git checkout --theirs path/to/file

# For specific files
git checkout --theirs src/api/endpoints.js

# After resolving
git add src/api/endpoints.js

When to use:

  • Incoming changes supersede current
  • Major refactor on incoming branch
  • Current changes are experimental

Strategy 3: Manual Resolution

# Open file in editor and manually resolve
# Look for conflict markers and edit

# After editing, stage the file
git add path/to/file

# Check status
git status

Strategy 4: Three-Way Merge Tool

# Configure merge tool (one-time setup)
git config --global merge.tool vimdiff
# Or: meld, kdiff3, p4merge, etc.

# Use merge tool
git mergetool

# Clean up backup files
git clean -f

Common Conflict Scenarios

Scenario 1: Import Statement Conflicts

Conflict:

<<<<<<< HEAD
import { useState, useEffect } from 'react';
import { useAuth } from './hooks/useAuth';
=======
import { useState, useEffect, useContext } from 'react';
import { useAuth } from './hooks/auth';
>>>>>>> feature-branch

Resolution (Combine Both):

import { useState, useEffect, useContext } from 'react';
import { useAuth } from './hooks/useAuth'; // Keep correct path

Scenario 2: Function Implementation Conflicts

Conflict:

<<<<<<< HEAD
async function fetchUser(userId) {
  const response = await fetch(`/api/users/${userId}`);
  return response.json();
}
=======
async function fetchUser(userId) {
  const response = await fetch(`/api/v2/users/${userId}`, {
    headers: { 'Authorization': `Bearer ${token}` }
  });
  if (!response.ok) {
    throw new Error('Failed to fetch user');
  }
  return response.json();
}
>>>>>>> feature-branch

Resolution (Combine Best of Both):

async function fetchUser(userId) {
  const response = await fetch(`/api/v2/users/${userId}`, {
    headers: { 'Authorization': `Bearer ${token}` }
  });
  if (!response.ok) {
    throw new Error('Failed to fetch user');
  }
  return response.json();
}

Scenario 3: Configuration Conflicts

Conflict:

<<<<<<< HEAD
{
  "name": "my-app",
  "version": "1.2.0",
  "scripts": {
    "start": "node server.js",
    "test": "jest"
  }
}
=======
{
  "name": "my-app",
  "version": "1.3.0",
  "scripts": {
    "start": "node server.js",
    "test": "jest",
    "lint": "eslint ."
  }
}
>>>>>>> feature-branch

Resolution (Use Higher Version + All Scripts):


...
Read full content

Repository Stats

Stars19
Forks4
LicenseMIT License