/build:test-branchfrom build
Tests every commit in the current branch using git-test, delegates failures to a fix subagent, and loops until all commits pass. Useful for ensuring branch integrity before merging.
Ships in build. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Run the test-fix loop for the current branch against upstream until every commit passes. Fixing is delegated to a subagent so the main thread stays on the loop.
Resolve <plugin-root> first: in Claude Code use ${CLAUDE_PLUGIN_ROOT}; in Codex use the plugin root that contains this skills/test-branch/SKILL.md file.
BRANCH=$(git branch --show-current)
TESTS=${GIT_TESTS:-default}
WORKDIR=$(mkdir -p .llm && mktemp -d .llm/test-branch.XXXX)
Require a clean working tree and a named local branch before starting. If HEAD is detached, identify the intended branch before running tests. Capture BRANCH once and retain it across every retry; never replace it with the detached failing commit. Set UPSTREAM_REMOTE and UPSTREAM_BRANCH to the intended comparison ref and verify it exists.
Initialize ${WORKDIR}/report.md:
# Test Branch Report
Started: [timestamp]
Allow at most 10 iterations.
Each iteration runs these phases in order.
Redirect output to a file, since build logs can exceed 10K lines. Use a 30-minute timeout; if it expires, stop with "Stopped: timeout".
<plugin-root>/scripts/test-branch "$BRANCH" "$TESTS" > "${WORKDIR}/build.log" 2>&1; echo $?
The script writes the branch name to JUSTFILE_BRANCH (test-fix reads it) and runs git test run --retest --verbose --verbose over ${UPSTREAM_REMOTE:-upstream}/${UPSTREAM_BRANCH:-main}..<branch>. Exit 0 means all commits pass: go to Done.
--retest reruns cached failures but reuses cached successes; report cached results as cached, not as fresh executions. For a nonzero exit, inspect the log before treating HEAD as a failing commit. Continue the fix loop only when git-test identifies a bad commit in the saved branch range. Stop and report setup, permission, checkout, or other infrastructure errors as such.
Inspect git status --porcelain and the diff. If the only changes are formatter repairs from this test run, proceed to test-fix. Local changes alone do not prove the build failure is fixed; investigate remaining errors and preserve unrelated work.
The failing commit is HEAD, since git-test checks out each commit; get it with git log --oneline -1 and append the iteration to the report. If the same commit failed in the previous iteration, stop with "Stopped: same commit failed twice".
If errors remain beyond formatter repairs, launch a subagent with this prompt instead of fixing the errors yourself:
Use the build:fix skill to fix the build error toward the end of: ${WORKDIR}/build.log
Wait for it, review the diff, and stage intended new files individually. Then go straight to test-fix without committing. Export GIT_TESTS="$TESTS" so the script retests the same test configuration.
Use a 30-minute timeout; if it expires, stop with "Stopped: timeout".
<plugin-root>/scripts/test-fix > "${WORKDIR}/test-fix.log" 2>&1; echo $?
The script validates the saved branch and detached failing commit, stages tracked repairs, and runs pre-commit with separate filename arguments. It retries hooks once after formatter edits; persistent hook or configuration errors stop before committing. It amends only the detached failing commit, preserving its message and author even when the repair leaves an empty commit. It then replays the saved branch's descendants onto the repair without changing its base or other branches, and retests that explicit branch. Existing fixup commits in the descendants are preserved.
Exit 0 means all commits pass: go to Done. Exit 2 means the repair workflow failed before retesting; stop and report the phase, current HEAD, branch, and remaining changes. For other nonzero exits, inspect the retest log: loop only if it identifies another bad commit. Do not count hook, commit, or replay failures as repeated test failures. Preserve the saved branch marker and detached repair for recovery; never blindly rerun test-fix on that repair. Git versions that cannot replay merge commits will stop during replay; do not flatten those merges to force success. A timeout always stops the loop.
Append the result to the report and display the full report.
Append each iteration as it happens:
## Iteration 1
**Failing commit:** [short SHA] [subject]
**Error:** [1-2 line summary]
**Fix:** [what changed]
**Files:** [list]
## Result
**All commits pass after N iterations** or **Stopped: [reason]**
Completed: [timestamp]
git test forget-results; the cache lets git-test skip already-passing commits.<plugin-root>/scripts/test-fix rewrites the tested branch.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
6 skills in this plugin
/dev-serverStart or restart a project dev server on a specific or discovered port, wait until it is ready, and monitor it for automatic recovery. Use when the user asks to start, restart, keep alive, watch, or monitor a development server./fixRun git-test precommit checks and fix failures without committing, or fix the errors described in a provided build log. Use when asked to fix build, test, lint, typecheck, or precommit failures./precommitRunning precommit checks and build validation. ALWAYS use after ANY code changes./test-allRun git-test on every local branch that contains upstream, fix failures in a subagent that folds each fix into the breaking commit, and loop until all commits pass. Use when asked to run or fix test-all./test-setupConfigure git-test for the current repository so the test-branch and test-all skills work. Use when git test is missing or the user asks to set up branch testing.npx claudepluginhub motlin/claude-code-plugins --plugin buildOther plugins' skills for the same job