From cb2b2e82d6b170ae14bebcbf4e3b4900114e40e0 Mon Sep 17 00:00:00 2001 From: Chris Coutinho Date: Sat, 2 May 2026 11:55:53 +0200 Subject: [PATCH] docs(pre-push-review): include uncommitted changes in diff scope Switch the diff range from $BASE..HEAD to $BASE so the review covers working-tree changes (committed + staged + unstaged), letting the skill run usefully on in-progress work without requiring a commit first. Co-Authored-By: Claude Opus 4.7 (1M context) --- .claude/skills/pre-push-review/SKILL.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.claude/skills/pre-push-review/SKILL.md b/.claude/skills/pre-push-review/SKILL.md index f2214bf7..26883d49 100644 --- a/.claude/skills/pre-push-review/SKILL.md +++ b/.claude/skills/pre-push-review/SKILL.md @@ -38,7 +38,7 @@ judgment. **Skip when:** - Tiny diffs (typo fix, README tweak, dependency bump only). - User has explicitly said "just push it" / "skip the review". -- Branch is `master` or has zero commits ahead of base. +- Branch is `master`, or has zero commits ahead of base **and** a clean working tree (`git status --short` empty). ## Workflow @@ -50,10 +50,16 @@ Determine the base branch and diff range. Default base is `master`. git fetch origin master --quiet BASE=$(git merge-base HEAD origin/master) git rev-list --count $BASE..HEAD # commits ahead -git diff --stat $BASE..HEAD # files touched +git diff --stat $BASE # files touched (incl. staged + unstaged) git log --format="%h %s" $BASE..HEAD # commit list +git status --short # surface uncommitted state ``` +**Diff scope:** the review uses `git diff $BASE` (base → working tree), which includes +committed + staged + unstaged changes. This means in-progress work is reviewed too — +flag any findings against half-written code as such, and don't penalize obvious WIP +(missing tests, TODO stubs) the user clearly hasn't finished yet. + If the user names a different base (e.g. `main`, a stacked branch), use that instead. **Identify the change shape** — these classifications drive scope-aware checks (Phase 3): @@ -95,8 +101,8 @@ broken build — fixing the failures may eliminate findings or change the diff. ### Phase 3 — Read the diff and run the project checklist (2–5min) ```bash -git diff $BASE..HEAD # full diff -git diff $BASE..HEAD -- '*.py' | head -2000 # python only, capped +git diff $BASE # full diff (incl. uncommitted) +git diff $BASE -- '*.py' | head -2000 # python only, capped ``` Read the **whole diff** before composing findings. Cross-file patterns (test symmetry,