一键导入
test-fix-loop-n
Discover Go test failures, partition by package/count, spawn N parallel test-fix-loop agents, verify results. Args: <parent-branch> [max-agents]
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Discover Go test failures, partition by package/count, spawn N parallel test-fix-loop agents, verify results. Args: <parent-branch> [max-agents]
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Self-looping adversarial-review-to-merge pipeline. Codex runs an adversarial review (a given area/topic, else the whole repo), findings are neutrally verified, each survivor becomes its own PR, and a per-PR review gauntlet (two fresh, context-isolated SATISFIED verdicts on the same PR content, reviewed one at a time over the whole diff) plus event-driven CI monitoring gate an auto-merge. Multiple isolated runs (each keyed by a run-id, with a lease so only one agent drives each) can run concurrently in one repo. Drives its own loop via ScheduleWakeup — invoke once, no /loop wrapper. Args: [--run id] [area or topic]
Evaluate and address GitHub Copilot PR review items for a GitHub pull request. Use when user provides a GitHub PR link and wants Copilot review comments checked, verified, fixed, committed, and summarized. Fetch review items with `gh`, verify each claim against source/tests before changing code, ask user before making subjective or constraint-driven changes, then work items one by one.
Continuously find and fix failing Go tests in a worktree, syncing with a parent branch between iterations. Use when user wants to fix all (or many) test failures in a branch via an automated loop. Args: <parent-branch> [test-args...]
Execute instructions in an isolated worktree, commit, fast-forward merge to parent, cleanup. Args: <parent-branch> <instructions...>
Delegate a task to Codex CLI via `codex exec`. Use for lightweight tasks (exploration, simple searches, file reads) that don't require heavy reasoning. Only available from Claude Code sessions.
Multi-agent design collaboration — Claude Code (reviewer) and Codex (designer) iterate on a design doc via file-based chat. Gathers requirements from user, then runs a review loop until design is satisfactory. Args: <topic>
| name | test-fix-loop-N |
| description | Discover Go test failures, partition by package/count, spawn N parallel test-fix-loop agents, verify results. Args: <parent-branch> [max-agents] |
Discover all Go test failures, partition across N parallel agents, each
running /test-fix-loop. Agents merge back to shared parent branch via
existing sync protocol.
$1 — parent branch (required). e.g. feat-xslt3.$2 — max agents (optional, default 4).If no parent branch given, ask user.
$PARENT exists: git rev-parse --verify $PARENT.fix-orch-<short-id>-<date> — globally unique.$PROJECT/.worktrees/<branch>.git worktree add $PROJECT/.worktrees/<branch> -b <branch> $PARENT
cd to orchestrator worktree. Create .tmp/ if missing.go test ./... -timeout=15m -v > .tmp/go-test-discovery.txt 2>&1
-v required — ensures every test name appears in output..tmp/go-test-discovery.txt. Extract every failure:
--- FAIL: TestName → capture test nameFAIL\tpkg/path → capture packagepanic: / compile error → capture package, mark __compile_error__(package, test_name) tuples..tmp/failure-manifest.txt.(pkg_path, [test_names], count).min(8, ceil(total_failures / max_agents)) as the target.max_agents partitions per wave.max_agents, do NOT merge them past the
8-test cap — dispatch the largest max_agents partitions now and defer the
rest to the next wave (retry wave re-discovers remaining failures automatically).Per partition compute:
| Field | Value |
|---|---|
| Package list | One or more ./pkg/path entries |
-run regex | ^(TestA|TestB|TestC)$ — anchored, metacharacters escaped |
Omit -run | When partition owns ALL failures in a package |
Store partition plan in .tmp/partition-plan.txt.
^...$ — Go -run does substring match.+, ., (, etc.) with \.Issue ALL Agent tool calls in single block (parallel execution).
IMPORTANT: Subagents do NOT have access to the Skill tool — they cannot run
/test-fix-loop. Instead, tell them to Read the skill file and follow it directly.
They DO have Read, Edit, Write, Bash, Grep, Glob, and other core tools.
Subagents also run in agent isolation worktrees branched from main — NOT from
$PARENT. The prompt MUST instruct the agent to create its own worktree from
$PARENT and work there exclusively.
Each agent receives prompt (template — substitute actual values):
You are a test-fix agent. Read and follow the procedure in this file EXACTLY:
~/.claude/skills/test-fix-loop/SKILL.md
Arguments for the procedure:
- Parent branch ($PARENT): <parent-branch>
- Extra test args: -run '^(TestA|TestB|TestC)$' ./pkg1 ./pkg2
- Project root ($PROJECT): <absolute path to repo root>
CRITICAL SETUP: Your current working directory is NOT on the correct branch.
You MUST create a new worktree from $PARENT before doing anything else:
cd $PROJECT
git worktree add $PROJECT/.worktrees/<unique-branch> -b <unique-branch> $PARENT
Then cd to that worktree. ALL work happens there.
You are responsible for fixing ALL of these assigned failing tests:
1. ./pkg1 — TestA
2. ./pkg1 — TestB
3. ./pkg2 — TestC
CONTEXT CONSERVATION — READ THIS CAREFULLY:
Your context window is finite. If you waste it on analysis, you will run out
before making fixes. Follow this workflow strictly:
1. Run your assigned tests ONCE to find failures.
2. Pick the FIRST failing test. Debug it, fix it, verify it.
3. Run `golangci-lint run ./...` — fix any lint errors.
4. COMMIT and MERGE immediately — do not batch fixes.
5. Sync, re-run tests, pick the next failure. Repeat.
DO NOT analyze all tests upfront. DO NOT read entire files — use Grep to find
specific functions. DO NOT spend context exploring blockers — document and move on.
Every iteration MUST produce a commit or a documented blocker. Pure analysis
with no commit is wasted context.
COMPLETION RULES:
- MUST attempt every assigned test. Do NOT stop after fixing one or a few.
- After each fix+merge cycle, re-check which assigned tests still fail.
Continue until all fixed or documented as non-actionable blockers.
- Test now passes (another agent fixed root cause) → counts as resolved, move on.
- "Complex" / "requires large change" is NOT a reason to stop. That IS the work.
- DONE only when: (a) all assigned tests pass, OR (b) every remaining failure
documented as non-actionable blocker with specific reason.
REPORT FORMAT when done:
For each assigned test: test name, status (fixed/already-passing/blocked),
root cause, fix description or blocker reason.
agent abandoned — needs retry..tmp/agent-reports.txt.$PARENT HEAD:
git fetch . $PARENT
git reset --hard $PARENT
go test ./... -timeout=15m > .tmp/go-test-final.txt 2>&1
This step is AUTOMATIC. Do NOT stop to ask the user. Proceed immediately after final verification if the trigger condition is met.
Trigger: failures remain AND (wave made progress OR any agent abandoned tests).
Between waves: check for uncommitted work in agent worktrees. If an agent left uncommitted changes, verify them (run the agent's assigned tests with and without the changes). If they pass more tests → commit and merge before the next wave. This recovers work from agents that ran out of context before committing.
cd $PROJECT
git worktree remove .worktrees/<orch-branch> --force
## Orchestrator Report
Failures discovered: N
Waves: W
Agents spawned: M (wave 1) [+ K (wave 2) ...]
Tests fixed: X
Tests blocked: Y
Tests abandoned: Z
### Per-Agent Summary
| Agent | Wave | Worktree | Assigned | Fixed | Blocked | Abandoned |
|-------|------|----------|----------|-------|---------|-----------|
### Remaining Failures (if any)
| Package | Test | Status | Reason |
|---------|------|--------|--------|
max_agents.-run regex with ^...$.Same criteria as test-fix-loop:
| Actionable | Non-Actionable |
|---|---|
| Implementation bug | External infra outage |
| Wrong error code / serialization | Corrupted checkout |
| Missing feature needed by test | Toolchain install failure |
| Flaky test from repo code | Permission / network issue |
| Parser / fixture issue fixable in repo |