オプション
家 Skill コードレビュー pull-changes-resolve-conflicts

pull-changes-resolve-conflicts

cognitedata/builder-skills cognitedata/builder-skills

複数の貢献者が関与するプロジェクト(Flowsアプリを含む)において、メインブランチやその他のブランチからの更新を取得する際に、作業内容がこっそりと破棄されることなく行うための標準的なワークフローです。このフローでは、データの取得やマージの手順を案内し、マージコンフリクトを明示的に一覧表示するほか、会話履歴やリポジトリの状況をもとに自分側と相手側の内容を分析し、優先順位付けされた推奨事項を提示します。また、コンフリクトマーカーを編集したりマージを完了させたりする前に、ユーザーからの回答を得るようになっています。トリガーとしては、mainからのプル、mainのマージ、originのマージ、リベース、マージコンフリクト、未マージのパッチなどがあります。

...すべて拡張します
11
更新された時間 2026年8月26日

pull-changes-resolve-conflictsについて

複数人で協力して開発するプロジェクトにおいて、あるブランチを別のブランチに統合する際(通常はmainブランチを機能ブランチにプルまたはマージする場合)に、意図的に作業した内容が無視されることなく処理を進められるよう設計されたガイド付きワークフローです。Gitベースのあらゆるチームワークフローに適用可能で、特にFlows/Reactアプリでは、コンフリクトがアプリのシェル部分、トップナビゲーション、ルートモジュール、共有可能なlib/やhooks/ディレクトリに集中しやすいとされています。この手法の基本原則は、分析を行う前に「main側が正しい」や「自分たちの側が正しい」と決めつけてはならず、また、コンフリクトマーカーを修正する前にユーザーに対して生じるトレードオフを明確に示す必要があるという点です。

ワークフローは段階的に進行します。まずgit fetchを実行し、必要に応じてgit merge origin/mainを行い、その後未マージのファイルを一つずつ明示的に報告し、何が不一致となったかについて簡潔に説明します。次に、会話履歴やPRD.md、最近のコミットといったリポジトリ内の情報、さらにgit show :2:path(自分側のコンフリクト部分)およびgit show :3:path(相手側のコンフリクト部分)を用いて状況を分析します。コンフリクトは、組み合わせても問題ない「直交型」、選択または手動でマージが必要な「重複型」、不適切なマージによって重複したブロックが生じている「破損リスク型」の3つに分類されます。分析結果は、削除されたルートや廃止された機能、変更されたデータやAPI契約といった構造的・製品上の変更に該当するP0から、間隔調整やクラス名の変更といった表示面の微調整に該当するP3まで、優先度順に整理された推奨事項や具体的な質問として提示されます。

厳格なルールにより、自動的な無音処理は禁止されており、ユーザーが提案された計画に同意するか、明示的に推奨事項に従うと指示するまで、コンフリクトマーカーは削除されず、git addも実行されません。このスキルは大規模なファイルを無理やり処理するのではなく、コンフリクトが発生した箇所で処理を停止し、git merge --abortやgit rebase --abortを使って処理を中止することも可能です。また、リポジトリ全体で--oursや--theirsを選択する、短い要約なしに長いコードのダンプの中にコンフリクトリストを隠すといった避けるべき反パターンも挙げられています。オプションのコマンド例やマージメッセージのテンプレートは、別途用意されたreference.mdに記載されています。

よくある質問

このスキルはいつ使うべきですか?

現在の機能ブランチに別のブランチ(通常はmainブランチ)を統合する際、またはマージやリベース後にgit statusで未マージのパスが表示された場合に使用します。Gitベースのあらゆるチームワークフローに適用可能で、特にFlows/Reactアプリでよく見られます。

自動的にコンフリクトを解決してくれますか?

いいえ。厳格なルールにより自動的な無音処理は禁止されており、ユーザーが提案された計画に同意するか、推奨事項に従うと明示的に指示するまで、コンフリクトマーカーは削除されず、git addも実行されません。まずコンフリクトを検出し、それを報告します。

どのコンフリクトから先に対処するかはどのように決定されますか?

コンフリクトは影響度に応じて順序付けられ、削除されたルートや廃止された機能、変更されたデータやAPI契約といった構造的・製品上の変更に該当するP0から、間隔調整やクラス名、テキストの表現といった表示面の微調整に該当するP3までの順に処理されます。

変更前にコンフリクトを分析するためにどのような情報が利用されますか?

ブランチに含まれていた内容に関する会話履歴、PRD.mdや最近のコミットといったリポジトリ内の情報、ファイルの所有者情報、さらにgit show :2:pathを使って自分側のコンフリクト部分、git show :3:pathを使って相手側のコンフリクト部分を確認する情報が利用されます。

マージを中止したいだけの場合はどうすればよいですか?

このスキルでは、状況に応じてgit merge --abortやgit rebase --abortを実行することをサポートしており、その操作によって現在進行中の統合状態が失われることを確認します。

全ファイル

2ファイル reference.md 0.7 KB 表示 SKILL.md 5.5 KB 表示

GitHubで見る

Use this skill whenever integrating another branch (usually main) into the current feature branch, or when git status shows unmerged paths after a merge or rebase. Applies to any Git-based team workflow; Flows/React apps are a common case where conflicts cluster in app shells and shared libraries.

Goals

  • Preserve intentional work on the current branch; do not assume “main wins” or “ours wins” without analysis.
  • Make trade-offs visible to the user before any conflict resolution edits.
  • Order discussion by impact: structural / feature / API / data-model changes before styling, copy, or spacing.

Hard rules

  1. No silent resolution — Do not remove <<<<<<< / ======= / >>>>>>> or run git add on conflicted files until the user has agreed to the plan (or explicitly says “use your recommendations”).
  2. Stop at conflicts — If a merge or rebase introduces conflicts, pause and report; do not bulldoze through large files by picking one side wholesale unless the user explicitly requests that.
  3. Prioritize impact — When presenting conflicts, group and order roughly as:
    • P0 — Structural / product: removed routes, deleted modules, dropped features, changed data or API contracts, SDK or schema changes, auth or routing shell.
    • P1 — Behavior: logic, hooks, queries, filters, error handling, loading states.
    • P2 — UI structure: layout regions, new or removed sections, navigation.
    • P3 — Presentation: tokens, spacing, class names, copy tweaks.

Workflow

1. Fetch and integrate (or diagnose)

  • Prefer git fetch then git merge origin/main (or the named branch) unless the user asked for rebase.
  • If merge is already in progress, run git status and list every unmerged file.

2. Report conflicts to the user (explicit)

Output a clear list:

  • Branch state: current branch, target branch (e.g. origin/main), merge vs rebase.
  • Unmerged files: paths only, then optionally git diff --name-only --diff-filter=U.
  • Per file (short): one line on what diverged (e.g. “AlertsPage — layout + new data scope”) if inferable from paths and git diff without resolving.

3. Analyze before editing

Use all of:

  • Conversation history — What was the user or team trying to ship on this branch?
  • Repo signals — Product or architecture docs if present (e.g. PRD.md), recent commits on the current branch, file ownership (e.g. large feature module vs shared lib/).
  • Conflict hunks — git show :2:path (ours) vs git show :3:path (theirs) during merge, or read conflict markers; identify duplicated vs orthogonal changes.

Classify each conflicted area as:

  • Orthogonal — safe to combine (e.g. import sort + new prop).
  • Overlapping — must choose or manually merge (same lines).
  • Corruption risk — duplicated blocks (common after bad merges); flag and recommend reconstructing from one side then re-applying the other side’s intent manually.

4. Recommendations + questions (required)

Present to the user:

  1. Summary table or bullets — file → recommended side or “manual merge” → one-line why.
  2. Ordered by P0 → P3 — call out anything that removes a feature or changes public behavior first.
  3. Explicit questions — anything ambiguous (e.g. “Keep main’s global behavior or the branch’s scoped variant?”).
  4. Ask for direction — e.g. “Reply with: (a) follow recommendations, (b) keep branch for file X, (c) keep main for file Y, (d) abort merge.”

Only after the user confirms (or gives a precise mapping), apply resolutions:

  • Prefer small, surgical edits; preserve both sides’ intent when possible.
  • Re-run git status; ensure no conflict markers remain; run tests or lint the user cares about for touched areas.

5. If the user wants to abort

  • git merge --abort or git rebase --abort as appropriate; confirm they lose in-progress integration state for that operation.

Anti-patterns (do not do)

  • Picking --ours / --theirs on the whole repo without user approval.
  • “Resolving” by deleting a feature branch’s work because main touched the same file.
  • Hiding conflict lists inside a long code dump without a short executive summary.
  • Fixing low-impact style conflicts first while leaving P0 decisions implicit.

Quick reference

  • Ours vs theirs (merge): stage 2 = current branch (HEAD), stage 3 = incoming (MERGE_HEAD). Verify with git checkout --conflict=merge <file> if needed.
  • Typical high-touch paths in full-stack or Flows apps: root app shell, top navigation, route modules, and shared lib/ or hooks/.

For optional command snippets and a merge message template, see reference.md.

すべてのファイル

0件のファイル

pull-changes-resolve-conflictsをインストール

該当するスキルファイルをダウンロードし、.claude/skills/ ディレクトリに展開してください。

ZIPをダウンロード

リポジトリをクローンし、スキルファイルをプロジェクトにコピーしてください。

git clone https://github.com/cognitedata/builder-skills/blob/main/skills/pull-changes-resolve-conflicts/SKILL.md # Copy SKILL.md to your .claude/skills/ directory

コピー コピー
クイックセットアップ: スキルフォルダを .claude/skills/ にコピーしてください。Claudeが自動的にそのスキルを検出し、利用します。
リポジトリ cognitedata/builder-skills

関連スキル

code-simplify
更新された時間 2026年7月2日
requesting-code-review
更新された時間 2026年6月29日
Git Commit Helper
更新された時間 2026年6月29日
commit-standards
更新された時間 2026年6月29日
OR