agentleFS
vscarpentervscarpenter/gsd-task-manager/.agents/skills/branch-preflight/SKILL.md

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.

The file

Files
SKILL.md

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

  1. Merge conflict markers in tracked files. Greps git ls-files for <<<<<<<, =======, or >>>>>>> line prefixes. Tracked-files-only avoids false positives on .Codex/ scratch notes.
  2. Stash entries. A non-empty git stash list is a yellow flag — most users don't realize an autostash is sitting there.
  3. Uncommitted changes. Surfaces both unstaged (git diff) and staged (git diff --cached) work.

How to use

Just run it:

bash scripts/branch-preflight.sh

Exit code:

  • 0 — clean, safe to proceed
  • 1 — at least one finding; review the output before starting

What to do with findings

FindingSuggested action
Merge conflict markersResolve 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 entriesRun 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 changesEither 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 (use git 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".

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.