executing-plans-preflight
Executing Plans Preflight
Semi-automatic git state gate. Detects issues, proposes fixes, executes on confirmation. Run this before any implementation work begins — it ensures git state is ready so you start from a clean, correct baseline.
Not in a git repo? Say Not a git repository — skipping preflight. and move on.
Checks
Run in order. Pass silently when nothing is wrong — only speak up when there is something to fix.
1. Branch Context
Detect default branch via origin/HEAD. Fallback: treat main/master as
default if detection fails.
- Detached HEAD → ask which branch to switch to (cannot infer).
- On default branch → infer a branch name from the plan in conversation
(title → kebab-case, prefix with conventional commit type:
feat/,fix/,docs/,refactor/,perf/,test/,chore/,ci/,build/; defaultfeat/). Propose it, let user confirm or rename, thengit switch -c. No plan in conversation? Ask directly — don't guess from filesystem. - Otherwise → silent pass.
2. Worktree Clean
Run git status --porcelain. Everything counts as dirty (staged, unstaged,
untracked).
- Clean → silent pass.
- Dirty → list paths, ask user to resolve or say "continue" to override. Record the override — Check 3 needs to know. Don't help with commit/stash; that's the user's call, because commit scope and message are conscious decisions that shouldn't be buried inside preflight.
3. Remote Sync
Run git fetch. If fetch fails, warn and continue with local info — don't
claim remote state is fresh when it isn't.
- No upstream / ahead / up-to-date → silent pass.
- Upstream gone → ask: clear tracking or recreate?
- Behind/diverged → propose
git pull --rebase. If dirty files were overridden in Check 2, warn that pull may conflict and offer to skip sync.
New branches from Check 1 have no upstream — that's expected, don't push.
Report
One-line conclusion after all checks. Each fix gets its own line before it.
Switched to `feat/add-auth` (was on main)
Preflight passed. Ready to go.
If dirty files were overridden, end with Proceeding with uncommitted changes.
instead of Ready to go.
Why these guardrails exist
- Confirm before executing — git operations are hard to undo; one wrong
switch -corpull --rebaseon the wrong branch can cost real work. - Allow dirty override — blocking unconditionally was v2's biggest friction point. The user knows their working state better than preflight does.
- Never push — preflight manages local state only. Publishing is a separate, deliberate step.
More from shihyuho/skills
lessons-learned
Use when starting, executing, or finishing non-trivial implementation tasks where reusable constraints may matter. Recall relevant lessons before work, capture reusable corrections or discoveries during and after work, and keep project memory in `docs/lessons/`.
100fanfuaji
Use when user requests Chinese terminology conversion, checking, or ensuring terminology - "使用繁體中文", "使用台灣用語", "轉換成台灣用語", "確保都是台灣用語", "統一台灣用語", "改成台灣用語", "用台灣的說法", "簡體轉繁體", "繁體轉簡體", "全部改成繁體", "轉成台灣繁體", check/ensure Taiwan/Hong Kong/China terminology, simplified/traditional conversion, or phonetic transcription (Pinyin/Bopomofo)
60agent-install-guide
Use when creating INSTALL.md, setup guides, or configuration instructions intended to be executed by AI agents.
35harvest
Capture project memory from planning-with-files source-of-truth into Obsidian-compatible second-brain notes in docs/notes. Use for milestone summaries, decision capture, and timeline snapshots. Trigger on: harvest, /harvest, harvest this, save this to second brain, save what we just did, document this work, capture this knowledge.
29skill-design
Design and refactor Agent Skills with concise, high-signal instructions and explicit trigger metadata. Use when creating a new skill, revising SKILL.md/README.md structure, or improving skill discoverability and portability.
27writing-agents-md
Use when creating, rewriting, pruning, or reviewing `AGENTS.md` or `CLAUDE.md`, especially to remove repo summaries, stale rules, and other low-signal global instructions. Trigger when deciding what belongs in always-on agent files versus a task-specific skill.
26