agentleFS
nfeuernfeuer/project-foundation-kit/.claude/skills/branch-conflict-check/SKILL.md

branch-conflict-check

Skill0 starsChanged 5 months agoMITView on GitHub

Detect file-level overlap between the current branch and every other open PR so merge order gets decided deliberately, not discovered at conflict time

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Always pass --exclude-dir={.git,.venv,node_modules,__pycache__,.claude/worktrees,dist,build} (or the find -prune equivalent).

    line 21
  2. Distinctive:

    When uncertain: merge the smaller or less-dependent PR first, then rebase the other onto the updated base.

    line 65
  3. Very specific:

    If gh is unavailable or not authenticated, check.sh exits 0 silently.

    line 70

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Branch Conflict Check

Run this when you open a PR or any time you want to verify merge safety. It answers: "which other open PRs touch the same files I do?" The parallel-work skill prevents live worktree collisions; this is the complement — it prevents the merge-time collisions that slip through when two PRs land on the same path days apart.

Profile-driven. The base branch for diff commands is trunk_branch in .claude/kit.yaml (default: main). check.sh reads the same value automatically.

Search hygiene

  • Broad grep and find must prune stale and generated trees to avoid false positives.
  • Always pass --exclude-dir={.git,.venv,node_modules,__pycache__,.claude/worktrees,dist,build} (or the find -prune equivalent).
grep -r ... --exclude-dir={.git,.venv,node_modules,__pycache__,.claude/worktrees,dist,build}

Workflow

1. Get this branch's changed files

# trunk_branch from kit.yaml (default: main)
git diff main...HEAD --name-only

trunk_branch in .claude/kit.yaml sets the default base; replace main in the command above with that value if you have overridden it.

2. List other open PRs

gh pr list --state open --json number,headRefName,url

3. Fetch changed files per PR

gh pr view <n> --json files --jq '.files[].path'

Or run the bundled helper, which does all three steps and prints overlaps grouped by PR (check.sh reads trunk_branch from .claude/kit.yaml as its default base):

bash .claude/skills/branch-conflict-check/check.sh [base-branch]

4. Compute the intersection

Compare the file sets manually or let check.sh do it with comm -12. Any path in both sets is a potential merge conflict.

5. Act on overlaps

SituationAction
No overlapMerge in any order.
Overlap, different layers (e.g. schema + UI calling it)Sequence: schema PR first, then the caller.
Overlap in the same function or same test fileRebase the later branch onto the earlier one, or split the change at the source.
Overlap is intentional (shared fixture refactor)Note it in both PR bodies; merge the depended-on PR first and document the order.

When uncertain: merge the smaller or less-dependent PR first, then rebase the other onto the updated base.

Guardrails

  • This check is advisory — it does not block merges. An overlap means "coordinate," not "abandon."
  • If gh is unavailable or not authenticated, check.sh exits 0 silently. Verify manually via the GitHub PR file-diff UI in that case.
  • Re-run after any rebase or force-with-lease push to a base branch — the changed-file set can shift.

Output

## Branch Conflict Check
- Branch: <current-branch>
- Base: <trunk_branch from .claude/kit.yaml>
- Changed files on this branch: <N>
- Other open PRs checked: <K>

Overlaps:
  PR #<n>  (<head-ref>): <file1>, <file2>
  PR #<m>  (<head-ref>): <file3>

  — OR —

  None found.

Action: <merge in any order / rebase <branch> onto <branch> first / split <what> / coordinate merge order: #<n> then #<m>>

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.