branch-preflight
Skill40 starsChanged 39 days agoMITView on GitHub
Sanity-check the working tree before starting plan execution or new branch work. Catches inherited damage that silently breaks verification later — merge conflict markers committed to tracked files, outstanding stash entries that may bleed into your work, uncommitted changes you may not realize you have. Runs in ~1 second. Trigger BEFORE invoking superpowers:executing-plans or superpowers:subagent-driven-development, BEFORE creating a new feature branch off main, or when verification mysteriously fails on files you did not touch.
In this repository29 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- cleaning-up-merged-branchesSkill
- diagnoseSkill
- grill-meSkill
- grill-with-docsSkill
- handoffSkill
- improve-codebase-architectureSkill
- inkwell-retrofitSkill
- open-knowledgeSkill
- pb-collectionSkill
- reviewable-pr-slicingSkill
- setup-matt-pocock-skillsSkill
- shadcnSkill
- shipSkill
- source-command-build-nextSkill
- source-command-qcheckSkill
- source-command-triage-prsSkill
- to-issuesSkill
- verify-frontend-changeSkill
- branch-preflightSkill
- claude-code-primitivesSkill
- cleaning-up-merged-branchesSkill
- inkwell-retrofitSkill
- pb-collectionSkill
- reviewable-pr-slicingSkill
- verify-frontend-changeSkill
- verify-gsdSkill
The file
Files
branch-preflight — Catch inherited working-tree damage early
When to invoke
Trigger this skill BEFORE any of:
- Starting plan execution (
superpowers:executing-plans,superpowers:subagent-driven-development) - Creating a new feature branch off
main(git switch -c feat/...) - Investigating a verification failure on files you do not recognize as yours
You should also volunteer to run it if the user mentions:
- "let's start implementing"
- "execute the plan"
- "kick off the work"
Why it exists
Damage inherited from main (conflict markers committed to a tracked file, a forgotten autostash, stray uncommitted edits) surfaces later as an unrelated parse or test failure partway through a plan, forcing an out-of-plan fix. This script catches that class of damage in under a second, before any plan step depends on a clean tree.
What it checks
- Merge conflict markers in tracked files. Greps
git ls-filesfor<<<<<<<,=======, or>>>>>>>line prefixes. Tracked-files-only avoids false positives on.Codex/scratch notes. - Stash entries. A non-empty
git stash listis a yellow flag — most users don't realize an autostash is sitting there. - Uncommitted changes. Surfaces both unstaged (
git diff) and staged (git diff --cached) work.
How to use
Just run it:
bash scripts/branch-preflight.shExit code:
0— clean, safe to proceed1— at least one finding; review the output before starting
What to do with findings
| Finding | Suggested action |
| Merge conflict markers | Resolve them in a separate fix(...) commit on the current branch BEFORE starting plan execution. Do not stack feature work on top of broken files. |
| Stash entries | Run git stash list to inspect. If it's stale or unrelated, drop it (git stash drop). If it's intentional in-progress work, acknowledge and proceed. |
| Uncommitted changes | Either commit them, stash them deliberately, or revert. Don't start a plan with mystery diff in the working tree. |
Out of scope
This script does NOT check:
- Whether the branch is up to date with
main(usegit fetch && git status) - Whether dependencies are installed (use
bun install) - Whether tests currently pass (use
bun run test) - Whether CI is green for the branch (use
gh pr checks)
These are different problems with different feedback loops. This skill is the cheapest possible "is the working tree sane?" check.
Gotchas
- The merge-marker grep uses
^<<<<<<</^>>>>>>>/^={7}$regex anchored at line start, so it won't false-positive on documentation that mentions conflict markers in prose. - The stash check counts ALL stash entries, including ones from other tools (autostash from
git pull --rebase, IDE auto-stashes). It's a yellow flag, not a red one — the script exits non-zero but the message says "acknowledge before starting", not "fix immediately".
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
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.

