--- name: worktree-scope-hygiene description: "Use when editing, staging, committing, rebasing, merging, pushing, or opening a pull request in a Git repository: run the git preflight, keep one worktree and branch per reviewable outcome, and never start in a dirty worktree." metadata: edit: "APM lane C3 skillLint fix 2026-09-25: description only; body unchanged" --- Before any git-writing work (edit, stage, commit, rebase, merge, push, PR): run the preflight — git status -sb; git branch --show-current; git fetch origin; git rev-list --left-right --count origin/...HEAD; git diff --stat origin/...HEAD. Never start a task in a dirty worktree, never pull into one, never reuse a merged PR's worktree. One branch = one reviewable outcome: if the next change could carry a different PR title ("while I'm here", "may as well", cleanup, follow-on), split to a fresh worktree from origin/. When dirt exists, name its kind precisely: working-tree dirty (uncommitted/untracked), scope dirty (diff no longer one PR-sized job), or base dirty (stale against remote default). Fixes: new worktree for new outcomes; recut (checkout -B from origin/ + cherry-pick only intended commits) for mixed intent; rebuild + regenerate generated files + rerun tests for base drift. Exit gate before push: one job, one believable PR title, every changed file part of the same reviewer story, based on fresh remote default. When uncertain, split instead of stack.