AgentSkillsCN

git-smart-resolver

迁移并运行Claude命令git/smart-resolver.md中的工作流程。当被要求执行与“智能合并冲突解决”相关的任务时,例如:凭借对代码库的深刻理解,高效完成智能合并冲突的化解。

SKILL.md
--- frontmatter
name: "git-smart-resolver"
description: "Migrate and run the workflow from Claude command git/smart-resolver.md. Use when asked to perform tasks matching git-smart-resolver, for example: Perform an intelligent merge conflict resolution with deep understanding of our codebase."

Git Smart Resolver

Overview

Use this skill to execute the existing workflow migrated from git/smart-resolver.md. Follow the playbook below and adapt commands to the current repository context.

Playbook

Perform an intelligent merge conflict resolution with deep understanding of our codebase.

Pre-resolution analysis:

  1. Understand what each branch was trying to achieve: git log --oneline origin/main..HEAD git log --oneline HEAD..origin/main

  2. Check if there are any related issues or PRs: git log --grep="fix" --grep="feat" --oneline -20

  • use the github cli as needed
  1. Identify the type of conflicts (feature vs feature, fix vs refactor, etc.)

  2. Think hard about your findings and plan accordingly

Resolution strategy:

For different file types:

Source code conflicts (.js, .ts, .py, etc.):

  • Understand the business logic of both changes
  • Merge both features if they're complementary
  • If conflicting, check which has better test coverage
  • Look for related files that might need updates

Test file conflicts:

  • Usually merge both sets of tests
  • Ensure no duplicate test names
  • Update test descriptions if needed

Configuration files:

  • package.json: Merge dependencies, scripts
  • .env.example: Include all new variables
  • CI/CD configs: Merge all jobs unless duplicate

Documentation conflicts:

  • Merge both documentation updates
  • Ensure consistency in terminology
  • Update table of contents if needed

Lock files (package-lock.json, poetry.lock):

  • Delete and regenerate after resolving package.json/pyproject.toml

Post-resolution verification:

  1. Run linters to check code style
  2. Run type checkers if applicable
  3. Run test suite
  4. Check for semantic conflicts (code that merges but breaks functionality)
  5. Verify no debugging code was left in

Final steps:

  1. Create a detailed summary of all resolutions
  2. If any resolutions are uncertain, mark them with TODO comments
  3. Suggest additional testing that might be needed
  4. Stage all resolved files

Begin by analyzing the current conflict situation with git status and understanding both branches.