git-bisect
Guides an automated or manual git bisect session to find the exact commit that introduced a regression, running a test command at each step or walking the user through manual good/bad decisions. Use when hunting for the commit that broke a test, a feature, a build, or introduced a performance regression.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-15
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- git-bisect
- description
- Guides an automated or manual git bisect session to find the exact commit that introduced a regression, running a test command at each step or walking the user through manual good/bad decisions. Use when hunting for the commit that broke a test, a feature, a build, or introduced a performance regression.
- allowed-tools
- Bash(git bisect start:*), Bash(git bisect good:*), Bash(git bisect bad:*), Bash(git bisect log:*), Bash(git bisect reset:*), Bash(git show:*), Bash(git branch:*), Bash(git status:*), Bash(npm:*), Bash(yarn:*), Bash(pnpm:*), Bash(pip:*), Bash(pytest:*), Bash(cargo:*), Bash(go:*)
- argument-hint
- [good-commit] [bad-commit] | --auto [test-command] | --reset | --continue
03 SKILL.md 正文
Git Bisect Helper
Guide a git bisect session to find the commit that introduced a regression. $ARGUMENTS selects the mode: a good/bad commit pair for manual guided bisect, --auto [test-command] for automatic bisect, --continue to resume, or --reset to abort and clean up.
On the git bisect grant: scoped to exactly the 5 subcommands this skill's modes document —
start/good/bad/log/reset — each its own explicit Bash(git bisect <subcommand>:*) entry rather
than a blanket Bash(git bisect:*). Corrected 2026-08-11: an earlier version of this note claimed the
blanket grant "couldn't be narrowed further," which was wrong — Bash(git bisect:*) also permits
git bisect run <command>, letting a bisect session execute an arbitrary command per commit, which this
skill never documents or uses.
On the test-command tool grants: Bash(npm:*), Bash(yarn:*), Bash(pnpm:*), Bash(pip:*),
Bash(pytest:*), Bash(cargo:*), and Bash(go:*) stay blanket per-tool, unlike the git bisect grant
above — deliberately, not by oversight. Automatic mode's whole point (step 2 below) is running the test
command the user supplies, verbatim, at each bisect step: npm test, npm run test:unit, cargo test --release, go test ./..., pytest -k pattern, pip install -e . && pytest, and any other legitimate
invocation shape of these tools are all in scope. Narrowing to a fixed subcommand list (e.g. only
Bash(npm test:*)) would silently break that documented feature for any test command that doesn't match
the fixed list, which defeats the reason this mode exists. The Test-command scope note just below already
documents the set of tools covered; this note documents why each one stays unscoped within itself.
Instructions
- Check current state: run
git status,git branch --show-current, andgit bisect log 2>/dev/null || echo "No active bisect session"to see if a session is already in progress. - Create a backup branch before starting a new session (
git branch bisect-backup-<timestamp>), so the original position is always recoverable. - Dispatch to the mode selected by
$ARGUMENTS:
Automatic bisect (--auto [test-command])
git bisect start, then mark the given good/bad commits (or ask the user for them if not supplied).- At each bisect step, run the given test command via
Bash. - Mark the commit
git bisect good(exit code 0) orgit bisect bad(non-zero). - Repeat until
git bisectreports the first bad commit, then report it with its message, author, date, and changed files.
Test-command scope: allowed-tools only covers npm/yarn/pnpm/pip/pytest/cargo/go. If the user's test command needs a different tool (e.g. bundle, mvn, gradle), tell them explicitly that this skill can't run it under its current tool scope, and either ask them to run that step manually and report good/bad themselves, or fall back to Manual Guided Bisect.
Manual guided bisect ([good-commit] [bad-commit])
git bisect start, thengit bisect good <good-commit>andgit bisect bad <bad-commit>.- At each step, show the current commit (
git show --name-only --pretty="%H %s (%an, %ar)" HEAD) and the changed files. - Ask the user via
AskUserQuestionwhether this commit is good or bad, then rungit bisect good/git bisect badaccordingly. - Repeat until bisect reports the first bad commit.
Continue (--continue)
Run git bisect log to show progress so far, then resume whichever mode (automatic/manual) the in-progress session appears to be using, based on what's already been marked.
Reset (--reset)
Run git bisect reset to end the session and return to the original branch. Report the backup branch created in step 2 (if any) so the user can delete it once they've confirmed everything is fine.
Reporting the result
Once the first bad commit is found, report: the commit hash, author, date, message, and changed files. Suggest recovery commands as text for the user to run themselves (this skill does not execute them): git revert <bad-commit> to undo it, or git cherry-pick to selectively keep the good parts of a mixed commit.
Safety
- Always create a backup branch (step 2) before starting — a bisect session moves
HEADrepeatedly viagit checkout, and the backup is the recovery path if anything goes wrong. - Never mark a commit good/bad without either a test result (automatic mode) or explicit user confirmation via
AskUserQuestion(manual mode) — don't guess. - If
git bisectreports the range doesn't reproduce the regression (the given "bad" commit tests good, or vice versa), stop and tell the user rather than continuing with a broken range.
Testing & Validation
Verify this skill activates on:
- "find the commit that broke the login test"
- "bisect this regression"
- "--auto npm test" / "run an automatic bisect with pytest"
- "which commit introduced this performance regression"
Verify it does NOT activate on:
- "rebase my branch onto main" →
git-rebase-sync - "add a note to this commit about the test results" →
git-notes - "start a new branch to investigate this bug" →
starting-work - "compare these two branches side by side" →
git-worktrees
Quality gates:
- [ ] Step 1 always checks for an in-progress bisect session (
git bisect log) before starting a new one - [ ] Step 2 always creates a backup branch before
git bisect startruns - [ ] Automatic mode never marks a commit good/bad without an actual test-command exit code — never guesses
- [ ] Automatic mode never silently runs a test command outside the
npm/yarn/pnpm/pip/pytest/cargo/goscope — always tells the user and offers manual mode or a self-run step instead - [ ] Manual mode never marks a commit good/bad without explicit
AskUserQuestionconfirmation - [ ]
--resetalways runsgit bisect resetand reports the backup branch — never deletes it automatically - [ ] A bisect range that doesn't reproduce the regression always stops and reports to the user rather than continuing with a broken range
- [ ] The
git bisectgrant stays as 5 explicit per-subcommand entries (start/good/bad/log/reset) — never collapsed back to a blanketBash(git bisect:*), which would also permitgit bisect run
04 同仓库更多 Skills
demo
Fixture skill used by scripts.marketplace_ci sync tests.
export-demo
Fixture skill used by scripts.marketplace_ci export tests.
work-to-development
Validate an accepted Linear Issue's readiness for implementation (criteria, dependencies, duplicate/existing artifacts) and request governed branch/worktree creation through git-kit:starting-work — recording work-started Git/GitHub evidence and a deliberate Linear Started transition only after Git identity is read back and verified. Use when asked to start work on a Linear issue, begin development for an accepted issue, or prepare an accepted issue for implementation. Never creates a branch directly — always delegates to git-kit.
work-linking
Create and maintain stable cross-system links and authority labels between Notion and Linear records, and detect/repair drift between them. Use when asked to link a Notion record to a Linear record, check for drift between Notion and Linear, or repair a broken/stale link. Repairs only the bounded non-authoritative copy or link — never chooses by newest timestamp, and never creates a reverse-write loop against either system's own authority.
status-and-learning
Produce a dated, explicitly non-live Linear-to-Notion progress summary, or capture an outcome/learning after work completes. Use when asked to summarize progress to Notion, report portfolio status, or capture what was learned from a completed piece of work — not to disposition open follow-up items (see open-item-management for that). Never runs automatically or continuously — every summary is a deliberate, approved snapshot, not a live sync.
repository-gates
Discover, delegate, record, and invalidate this repository's actual Git/GitHub lifecycle gates (pre-commit, pre-push, PR required checks, Codex delta review, review requirements, merge rights) and the repository-policy provider profile that maps governed operations to git-kit. Use when asked what gates apply to this repository, to discover repository policy before starting Wave 2 work, or to check whether prior gate evidence is still valid after new commits. Discovery and delegation only — never executes a gate's own internal logic, and never invents a gate the repository doesn't actually define (in particular, never assumes a "Review Changes" gate exists).