We've been building in your codebase, and we kept seeing the same thing: with a lot of agents committing fast, they quietly step on each other. Same migration version, same files, same fix, twice. So we read across the whole repo to see how it actually happens, and built a small skill that does the 30 seconds of bookkeeping that catches it up front. Read-only, git + gh only. Copy it, paste it to your agent, and it runs before the next PR.
app.module.ts is a conflict magnet: 100+ commits, 6+ hands, and an afternoon of feat then revert then reship when two module registrations raced.Reads the versions on main AND every open PR, and hands you the next one that's free across all of it. Closes the gap the single-branch linter can't see. Unique against everything in flight at scan time.
Lists the open PRs and recent merges touching your files or subsystem, so you see a neighbor before you collide or duplicate. A heads-up, not a blocker. Always flags app.module.ts.
A ~30-line CI check that rejects any PR whose migration version is already taken across main and open PRs. Zero adoption needed, and it closes the one gap the scan can't: two agents racing in the same few seconds.
Run this before you start a work unit in this repo. It is read-only bookkeeping, do it first, then paste the result into your PR.
1) MIGRATION VERSION (only if you are adding a Supabase migration)
Use a version that is free across main AND every open PR, then take the next one up in the same timestamp style the touched files already use. Do not hand-pick a version.
git fetch origin main -q
# highest version already on main:
git ls-tree -r --name-only origin/main supabase/migrations | grep -oE '[0-9]{14}' | sort | tail -1
# highest version across all open PRs:
for b in $(gh pr list --state open -L 100 --json headRefName -q '.[].headRefName'); do gh pr diff "$b" --name-only 2>/dev/null; done | grep 'supabase/migrations/' | grep -oE '[0-9]{14}' | sort | tail -1
# use max(of those two) + 1
2) IN-FLIGHT OVERLAP (always)
See who else is in your files or subsystem before you start.
gh pr list --state open -L 100 --json number,author,title,headRefName
# for any PR near your area: gh pr diff --name-only
gh pr list --state merged -L 40 --json number,author,title,mergedAt
If someone else is touching your files or subsystem, coordinate before you duplicate or collide. Treat apps/backend/src/app.module.ts as a conflict magnet: append your registration to the current tail, do not merge-race it.
3) Paste into your PR body: the version you allocated, and who else is in-flight in your area. Then start.
# Run on every PR. Fails if the PR's new migration version is already taken
# across main + open PRs. Needs: gh (with repo read) on PATH.
set -euo pipefail
BASE=origin/main
git fetch origin main -q
NEW=$(git diff --name-only "$BASE"...HEAD | grep 'supabase/migrations/' | grep -oE '[0-9]{14}' | sort | tail -1 || true)
[ -z "${NEW:-}" ] && { echo "no migration in this PR"; exit 0; }
MAIN_MAX=$(git ls-tree -r --name-only "$BASE" supabase/migrations | grep -oE '[0-9]{14}' | sort | tail -1)
PR_MAX=$(for b in $(gh pr list --state open -L 100 --json headRefName -q '.[].headRefName'); do
gh pr diff "$b" --name-only 2>/dev/null; done | grep 'supabase/migrations/' | grep -oE '[0-9]{14}' | sort | tail -1 || true)
MAX=$(printf '%s\n%s\n' "$MAIN_MAX" "${PR_MAX:-0}" | sort | tail -1)
if [ ! "$NEW" \> "$MAX" ]; then
echo "Migration version $NEW is <= max in-flight $MAX. Rebase to a higher version."; exit 1
fi
echo "migration version $NEW is clear (max in-flight $MAX)"
Give it a try on your next PR. Tweak it to fit how your lane works. If it's not useful, no harm, no foul. If it saves one silent collision, it paid for itself.