一键导入
fix
Diagnose and fix a bug in an isolated git worktree with reproduce-first, test-first methodology
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Diagnose and fix a bug in an isolated git worktree with reproduce-first, test-first methodology
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Start a new feature in an isolated git worktree with proportional verification
Diagnose and fix a bug in an isolated git worktree with reproduce-first, test-first methodology
Create a pull request with cleanup, fmt, and test gates
Safely restructure code in an isolated git worktree with test-preserved, incremental transformations
Start a new feature in an isolated git worktree with proportional verification
Diagnose and fix a bug in an isolated git worktree with reproduce-first, test-first methodology
| name | fix |
| description | Diagnose and fix a bug in an isolated git worktree with reproduce-first, test-first methodology |
| disable-model-invocation | true |
| effort | max |
<codex_skill_must>
mkdir -p and git worktree add -b fix/<name> ... main as separate exec_command calls.exec_command, request_user_input, spawn_agent, wait_agent, apply_patch.spawn_agent call must be followed by wait_agent.
</codex_skill_must>Diagnose and fix a bug.
Bug description: $ARGUMENTS
Follow these phases in order. Each phase has a gate — do not proceed until the gate is satisfied. Apply all project rules and conventions that are in your context.
If the bug involves browser UI, Playwright, dev-server ports, screenshots, or interactive Browser/Chrome inspection, apply ../_shared/ui-automation.md at evidence gathering, environment setup, reproduction, verification, delegation, and cleanup points.
Follow ../_shared/worktree-setup.md with branch prefix fix.
Gate: Working directory is the new worktree on the correct branch, based on latest main. If .env* files existed in the source repo, they are all present in the worktree.
Start two tracks in parallel:
Background — Environment setup: Launch a background agent (run_in_background: true) to set up the dev environment per ../_shared/env-setup.md.
Background — Environment setup: Launch a background exec_command to set up the dev environment per ../_shared/env-setup.md.
Foreground — Evidence gathering:
Before touching code, collect grounded evidence from observable sources. Do not guess from reading code alone.
git log --oneline --since="2 weeks ago" -- <affected files> — what changed recently in the area?Gate: At least one source of grounded evidence (log, trace, metric, or reproducible steps) is collected. Do not proceed on hypothesis alone.
Pre-gate: Check for .env-setup-done in the worktree root.
node_modules/ exists, pip list succeeds, go env GOPATH works) and data symlinks resolve correctly..env-setup-failed exists: surface the error and halt.Gate: A test exists that fails, reproducing the bug. The failure matches the observed evidence.
git log -S "<relevant term>" and git bisect if the bug is a regression.Gate: User agrees with the root cause analysis. Diagnosis cites observable evidence.
Effort note: When launched via the agent-dashboard's New Agent flow, this skill spawns with --effort high on the CLI, which Claude Code pins at the session level. The dynamic dispatcher in agent-state-fast.js bumps effort to max automatically while permission_mode='plan' (EnterPlanMode active) and drops back to high on exit — so planning runs at max effort without paying that cost during implementation. When invoked as a slash command inside an existing claude session, you can run /effort max before entering plan mode and /effort high (or lower) before implementation.
Effort note: When launched via the agent-dashboard's New Agent flow, this skill starts at implementation effort. Use Codex Plan Mode for high-reasoning diagnosis or planning when the fix needs it, then return to proportional implementation effort after approval.
Delegation gate: Invoke /codex:setup to check Codex CLI availability. If the output contains "ready": true, delegate only if the user explicitly requested Codex delegation OR the fix touches 10+ files / ~3,000+ lines of implementation. Below that threshold, the orchestration overhead costs more tokens than Claude implementing directly. If delegating, invoke /codex-delegate with the diagnosis (Phase 4) and failing test (Phase 3) as implementation context, then skip to the phase gate. Otherwise, proceed below.
Delegation gate: Use Codex spawn_agent only if the user explicitly requested subagents OR the fix touches 10+ files / ~3,000+ lines of implementation. Below that threshold, the orchestration overhead costs more tokens than implementing directly. If delegating, pass the diagnosis (Phase 4), failing test output (Phase 3), exact file paths, and a bounded write scope to a worker; then call wait_agent, review the result, and verify locally. Otherwise, proceed below.
make test/make test-fast only when the fix crosses packages, touches shared state/test/build infrastructure, or the risk cannot be bounded. Otherwise rely on the targeted reproducing command here; /agent-dashboard:pr owns the final branch-wide gate.For UI fixes, prefer headless Playwright with worktree-local resources. Use interactive Browser/Chrome inspection only when the shared policy says it is warranted.
Gate: The reproducing test passes. Full-suite verification ran only when required by risk. No unrelated changes.
make test/make test-fast if the refactor widens scope.Gate: The relevant proof passes. Code is clean.
fix: conventional commit message that describes what was fixed and why./agent-dashboard:pr. That skill owns conditional cleanup/formatting, final test gating when available, push, and gh pr create. Do not call gh pr create directly — a pr-skill-gate hook will block it.Gate: Clean commit with conventional message. No critical or high-severity review issues. PR opened via /agent-dashboard:pr.
Triggered when the user indicates the fix has been merged upstream.
.env-setup-done/.env-setup-failed sentinel files