From autonomous-sdlc
Fully autonomous issue fixer — thin orchestrator that delegates investigation, build, quality gates, merge, and summary to sub-agents.
How this skill is triggered — by the user, by Claude, or both
Slash command
/autonomous-sdlc:fix-issueThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
> **cmux environment check** — this skill emits cmux sidebar updates via `cmux-bridge.sh`. Before emitting any call whose subcommand is `status`, `progress`, `log`, or `clear`, check whether the `$CMUX_SOCKET_PATH` environment variable is set. If it is **empty** (running outside cmux — e.g. Claude Desktop App), **skip every such call in this skill**: they only drive the cmux sidebar UI and prod...
cmux environment check — this skill emits cmux sidebar updates via
cmux-bridge.sh. Before emitting any call whose subcommand isstatus,progress,log, orclear, check whether the$CMUX_SOCKET_PATHenvironment variable is set. If it is empty (running outside cmux — e.g. Claude Desktop App), skip every such call in this skill: they only drive the cmux sidebar UI and produce no effect elsewhere. Always runcmux-bridge.sh notifyandcmux-bridge.sh telegramcalls regardless of environment — they deliver to Telegram even when cmux is absent.
You are a thin dispatcher orchestrator. You delegate ALL heavy work to sub-agents and keep only argument parsing, control flow, and structured result parsing in your own context.
Parse $ARGUMENTS for:
123), issue URL (e.g., https://github.com/owner/repo/issues/123), next (highest priority open bug), or all/opened issues (all open issues sequentially)--skip-coverage — bypass coverage gate (build agent creates PR directly)--e2e-gate=warn|off — E2E test gate behavior (default: off)--skip-e2e — shorthand for --e2e-gate=off--limit=N — when using next, process up to N open bugs sequentially--coverage-threshold=N — override the default 90% coverage threshold--skip-preflight — skip the pre-flight health check--sequential — disable parallel mode and process issues one at a time (batch mode only). By default, batch mode (all, next --limit=N) uses parallel worktree isolation — issues with overlapping files are serialized; independent issues run concurrently (max 5 agents per stage). Use --sequential to force the old one-at-a-time behavior.Removed flags (fully autonomous mode — no user interaction):
--confirm is removed — always proceed autonomously after investigation--auto is removed — autonomous behavior is now the defaultExtract the issue number from the argument:
next: run gh issue list --label bug --state open --limit 1 --json number,title -q '.[0]' to get the highest priority open bugall or opened issues: run gh issue list --state open --json number,title,labels --limit 50 to get all open issues, then process using parallel worktree mode (bugs first, then enhancements by priority). Use --sequential to force one-at-a-time processing.Run these validation checks directly:
# 1. GitHub CLI auth
gh auth status
# 2. Clean git state
git status --porcelain
# 3. On main branch
git branch --show-current
# 4. Pull latest
git pull
STOP if working tree is dirty or not on main branch.
--skip-preflight)Before dispatching any agents, verify the project's test suite is green on main:
package.json → scripts.test → run npm testpyproject.toml → detect pytest → run uv run pytestMakefile → check for test target → run make testbats test files → run bats test/PRE_FLIGHT_FAILURE: Test suite is failing on main — fix before running fix-issue.
[test output excerpt]
Determine AGENT_TYPE for the build agent:
package.json with bun or typescript → backend-typescript-architectpyproject.toml or requirements.txt → python-backend-engineergeneral-purposebash -c '~/.claude/hooks/cmux-bridge.sh status fix-issue "Validating issue" --icon hammer --color "#007AFF"'
bash -c '~/.claude/hooks/cmux-bridge.sh progress 0.09 --label "Phase 1: Validate"'
bash -c '~/.claude/hooks/cmux-bridge.sh notify "Fix Issue Started" "#[ISSUE_NUMBER] — [ISSUE_TITLE]"'
bash -c '~/.claude/hooks/cmux-bridge.sh telegram "🔧 Fix Issue Started" "#[ISSUE_NUMBER] — [ISSUE_TITLE]"'
Record FIX_START_TIME for duration tracking.
bash -c '~/.claude/hooks/cmux-bridge.sh status fix-issue "Fetching issue" --icon hammer --color "#007AFF"'
bash -c '~/.claude/hooks/cmux-bridge.sh progress 0.18 --label "Phase 2: Fetch issue"'
gh issue view $ISSUE_NUMBER --json number,title,body,state,assignees,labels
Stop conditions — STOP and report if:
closedgh user)wontfix or won't fixExtract: ISSUE_NUMBER, ISSUE_TITLE, ISSUE_BODY, ISSUE_LABELS.
bash -c '~/.claude/hooks/cmux-bridge.sh status fix-issue "Investigating" --icon hammer --color "#007AFF"'
bash -c '~/.claude/hooks/cmux-bridge.sh progress 0.27 --label "Phase 3: Investigate"'
Launch a general-purpose agent (model: sonnet) with the prompt from ${CLAUDE_SKILL_DIR}/investigation-agent-prompt.md, substituting:
{{ISSUE_NUMBER}} → current issue number{{ISSUE_TITLE}} → current issue title{{ISSUE_BODY}} → issue body text{{ISSUE_LABELS}} → comma-separated labelsThe agent investigates the codebase, finds the root cause, and produces a fix plan.
Extract from the agent result:
ROOT_CAUSE, COMPLEXITY, FIX_APPROACH, FILES_TO_MODIFY, RISK, INVESTIGATION_STATUSIf INVESTIGATION_STATUS: BLOCKED — log the reason, skip this issue, and continue to the next issue (if batch mode) or STOP (if single issue).
bash -c '~/.claude/hooks/cmux-bridge.sh status fix-issue "Building fix" --icon hammer --color "#FF9500"'
bash -c '~/.claude/hooks/cmux-bridge.sh progress 0.36 --label "Phase 4: Build"'
Launch an agent with subagent_type set to AGENT_TYPE (detected in Phase 1) and model: opus, with the prompt from ${CLAUDE_SKILL_DIR}/build-agent-prompt.md, substituting:
{{ISSUE_NUMBER}} → current issue number{{ISSUE_TITLE}} → current issue title{{ISSUE_BODY}} → issue body text{{ROOT_CAUSE}} → from investigation agent{{FIX_APPROACH}} → from investigation agent{{FILES_TO_MODIFY}} → from investigation agent{{COMPLEXITY}} → from investigation agent{{SKIP_COVERAGE}} → true if --skip-coverage set, false otherwiseIf --skip-coverage: Extract PR_NUMBER and PR_URL from the agent result. Skip Phase 5.
If coverage enabled (default): Extract BRANCH_NAME and BUILD_STATUS from the agent result. Proceed to Phase 5.
--skip-coveragebash -c '~/.claude/hooks/cmux-bridge.sh status fix-issue "Coverage check" --icon hammer --color "#FF9500"'
bash -c '~/.claude/hooks/cmux-bridge.sh progress 0.45 --label "Phase 5: Coverage"'
Launch a qa-expert agent (model: sonnet) with the prompt from ${CLAUDE_SKILL_DIR}/coverage-gate-prompt.md, substituting:
{{ISSUE_NUMBER}} → current issue number{{ISSUE_TITLE}} → current issue title{{BRANCH_NAME}} → branch name from build agent result{{COVERAGE_THRESHOLD}} → value from --coverage-threshold flag (default: 90){{SECURITY_SCAN}} → on (default)The agent runs coverage analysis, adds tests, pushes the branch, and creates the PR.
Extract PR_NUMBER, PR_URL, COVERAGE_PCT, TESTS_ADDED, COVERAGE_STATUS, and SECURITY_STATUS from the agent result.
If COVERAGE_STATUS: WARN — log a warning but continue.
If the coverage agent fails entirely — proceed to Phase 8 (bugfix loop).
bash -c '~/.claude/hooks/cmux-bridge.sh status fix-issue "Code review" --icon hammer --color "#FF9500"'
bash -c '~/.claude/hooks/cmux-bridge.sh progress 0.64 --label "Phase 6: Review"'
Launch a senior-code-reviewer agent (model: opus) with the prompt from ${CLAUDE_SKILL_DIR}/review-gate-prompt.md, substituting:
{{ISSUE_NUMBER}} → current issue number{{ISSUE_TITLE}} → current issue title{{PR_NUMBER}} → PR number from Phase 4 (if --skip-coverage) or Phase 5 (default)The agent reviews the PR, fixes issues if found, and approves when satisfied.
Extract APPROVAL_STATUS, REVIEW_SUMMARY, and FIXES_APPLIED from the agent result.
If APPROVAL_STATUS: CHANGES_NEEDED persists after the review agent's fixes, proceed to Phase 8 (bugfix loop).
--e2e-gate=block|warnbash -c '~/.claude/hooks/cmux-bridge.sh status fix-issue "E2E testing" --icon hammer --color "#FF9500"'
bash -c '~/.claude/hooks/cmux-bridge.sh progress 0.73 --label "Phase 7: E2E"'
Launch a qa-expert agent (model: sonnet) with the prompt from ${CLAUDE_SKILL_DIR}/e2e-gate-prompt.md, substituting:
{{ISSUE_NUMBER}} → current issue number{{ISSUE_TITLE}} → current issue title{{PR_NUMBER}} → PR number{{BRANCH_NAME}} → branch nameHandle result per --e2e-gate mode:
warn + FAIL: log warning, continue to next phaseIf FAIL with --e2e-gate=warn, log the failure and proceed (do not block).
bash -c '~/.claude/hooks/cmux-bridge.sh status fix-issue "Bugfix loop" --icon hammer --color "#FF3B30"'
bash -c '~/.claude/hooks/cmux-bridge.sh log warning "Gate failure — entering bugfix loop" --source fix-issue'
Launch a general-purpose agent (model: opus) with the prompt from ${CLAUDE_SKILL_DIR}/bugfix-agent-prompt.md, substituting:
{{ISSUE_NUMBER}} → current issue number{{ISSUE_TITLE}} → current issue title{{BRANCH_NAME}} → the fix branch{{FAILED_STEP}} → which phase failed (build | coverage | review | e2e){{FAILURE_OUTPUT}} → the error/failure text from the failed agentExtract FAILURE_CATEGORY, ISSUE_NUMBER (sub-issue), FIX_STATUS, TESTS_PASSING from the agent result.
FIX_STATUS: FIXED and TESTS_PASSING: true:
FIX_STATUS: UNFIXED:
bash -c '~/.claude/hooks/cmux-bridge.sh status fix-issue "Merging" --icon hammer --color "#34C759"'
bash -c '~/.claude/hooks/cmux-bridge.sh progress 0.82 --label "Phase 9: Merge"'
Once all gates pass, launch a general-purpose agent (model: haiku) with the prompt from ${CLAUDE_SKILL_DIR}/merge-agent-prompt.md, substituting:
{{ISSUE_NUMBER}} → current issue number{{ISSUE_TITLE}} → current issue title{{PR_NUMBER}} → PR numberThe agent merges the PR, comments on and closes the issue, returns to main.
Extract MERGE_STATUS from the agent result.
If MERGE_STATUS: CONFLICT or MERGE_STATUS: FAILED — log error and STOP.
bash -c '~/.claude/hooks/cmux-bridge.sh status fix-issue "Summarizing" --icon hammer --color "#34C759"'
bash -c '~/.claude/hooks/cmux-bridge.sh progress 0.91 --label "Phase 10: Summary"'
Launch a general-purpose agent (model: haiku) with the prompt from ${CLAUDE_SKILL_DIR}/summary-prompt.md, substituting:
{{ISSUE_NUMBER}} → current issue number{{ISSUE_TITLE}} → current issue title{{PR_NUMBER}} → PR number{{PR_URL}} → PR URL{{BRANCH_NAME}} → branch name{{ROOT_CAUSE}} → from investigation{{FIX_APPROACH}} → from investigation{{COMPLEXITY}} → from investigation{{COVERAGE_PCT}} → from coverage gate (or N/A){{COVERAGE_STATUS}} → from coverage gate (or skipped){{TESTS_ADDED}} → from coverage gate (or 0){{SECURITY_STATUS}} → from coverage gate (or skipped){{APPROVAL_STATUS}} → from review gate{{REVIEW_SUMMARY}} → from review gate{{FIXES_APPLIED}} → from review gate{{E2E_RESULT}} → from E2E gate (or skipped){{E2E_SUMMARY}} → from E2E gate (or N/A){{BUGFIX_ITERATIONS}} → count of bugfix loop runs{{FIX_START_TIME}} → recorded start timeThe agent produces a formatted markdown summary.
In batch mode (when multiple issues were fixed), update documentation once after all issues are processed:
bash -c '~/.claude/hooks/cmux-bridge.sh status fix-issue "Updating docs" --icon pencil --color "#5856D6"'
bash -c '~/.claude/hooks/cmux-bridge.sh progress 0.95 --label "Phase 10b: Docs"'
If at least one issue was fixed successfully, launch a general-purpose agent (model: sonnet) with the prompt from ${CLAUDE_SKILL_DIR}/doc-update-prompt.md, substituting:
{{SCOPE}} → batch scope description (e.g., "all open issues" or "next 5 bugs"){{COMPLETED_ISSUES}} → comma-separated list of fixed issue numbers and titles{{COMPLETED_PRS}} → comma-separated list of merged PR numbersThe agent reviews all fixes and updates README + story docs in a single pass. Non-blocking — if it fails, the batch still reports success.
On success:
bash -c '~/.claude/hooks/cmux-bridge.sh log success "Documentation updated for [N] fixed issues" --source fix-issue'
On failure:
bash -c '~/.claude/hooks/cmux-bridge.sh log warning "Documentation update failed — manual review needed" --source fix-issue'
Skip this phase entirely for single-issue fixes (the PostToolUse hook handles those).
Print the formatted summary returned by the summary agent.
bash -c '~/.claude/hooks/cmux-bridge.sh progress 1.0 --label "Complete"'
bash -c '~/.claude/hooks/cmux-bridge.sh status fix-issue "Complete" --icon sparkle --color "#34C759"'
bash -c '~/.claude/hooks/cmux-bridge.sh log success "Fix complete: #[ISSUE_NUMBER] — [ISSUE_TITLE]" --source fix-issue'
bash -c '~/.claude/hooks/cmux-bridge.sh notify "[EMOJI] Fix Issue Complete" "#[ISSUE_NUMBER] — [ISSUE_TITLE]\nPR: #[PR_NUMBER]\nDuration: [DURATION]"'
bash -c '~/.claude/hooks/cmux-bridge.sh telegram "[EMOJI] Fix Issue Complete" "#[ISSUE_NUMBER] — [ISSUE_TITLE]\nPR: #[PR_NUMBER]\nDuration: [DURATION]"'
✅ if all gates passed cleanly, ⚠️ if any gate had warningsnext --limit=N or all, WITH --sequential)If the original target was next --limit=N or all/opened issues and --sequential is set:
git checkout main && git pull to ensure clean statenext --limit=N or all)In batch mode (default, unless --sequential is set), issues are processed using batch-per-stage parallelism with git worktree isolation and a file-overlap guard.
Fetch all issues (DIRECT): Run gh issue list to get the full batch, then fetch metadata for each issue (Phase 2 logic) sequentially — this is fast and low-cost.
Investigate all issues in parallel: Launch up to 5 investigation agents concurrently (no worktree needed — read-only):
Agent(subagent_type="general-purpose", model="sonnet", prompt="""
[investigation-agent-prompt.md with substitutions for issue A]
""")
// + same for issues B, C, D, E — all in a single message
Collect ROOT_CAUSE, FILES_TO_MODIFY, INVESTIGATION_STATUS from each. Remove any BLOCKED issues from the batch.
Compare FILES_TO_MODIFY across all investigated issues to detect potential merge conflicts:
Issue #42: src/auth/login.ts, src/auth/session.ts
Issue #57: src/api/routes.ts, src/utils/logger.ts
Issue #63: src/auth/login.ts, src/auth/middleware.ts ← overlaps with #42!
Issue #71: tests/e2e/checkout.spec.ts
Grouping algorithm:
From the example above:
src/auth/login.ts)Groups A, B, and C run their stages concurrently. Within Group A, #42 completes fully before #63 starts.
bash -c '~/.claude/hooks/cmux-bridge.sh log info "Parallel batch: [N] issues in [G] groups ([S] serialized due to file overlap)" --source fix-issue'
For all issues that can run concurrently (one per group), launch build agents with isolation: "worktree":
Agent(
subagent_type=[AGENT_TYPE],
model="opus",
isolation="worktree",
prompt="""
[build-agent-prompt.md with substitutions]
IMPORTANT: Push the branch before returning:
git push -u origin fix/issue-{{ISSUE_NUMBER}}-[slug]
Return BRANCH_NAME and BUILD_STATUS.
"""
)
Key rule: In parallel mode, build agents ALWAYS push the branch (even when coverage gate is enabled), so coverage agents in separate worktrees can access it.
Skip if --skip-coverage. For each successfully built issue, launch coverage agents concurrently with isolation: "worktree":
Agent(
subagent_type="qa-expert",
model="sonnet",
isolation="worktree",
prompt="""
[coverage-gate-prompt.md with substitutions]
NOTE: Branch {{BRANCH_NAME}} has been pushed. Start by:
git fetch origin
git checkout {{BRANCH_NAME}}
"""
)
Launch review agents concurrently (they use gh CLI, no worktree needed):
Agent(subagent_type="senior-code-reviewer", model="opus", prompt="""
[review-gate-prompt.md with substitutions for each issue]
""")
Launch E2E agents concurrently with isolation: "worktree" (each needs to checkout the PR branch to run Playwright).
For each approved issue one at a time:
Launch the merge agent with ${CLAUDE_SKILL_DIR}/merge-agent-prompt.md. The merge agent includes a rebase-before-merge step to handle baseline drift from earlier merges.
After each merge:
If any serial groups have remaining issues after the first round:
The orchestrator tracks progress centrally — agents do NOT update any shared progress files. Progress notifications update per-stage:
bash -c '~/.claude/hooks/cmux-bridge.sh progress [FRACTION] --label "Stage [S]: [stage-name] ([N] issues)"'
NEVER read project source files directly — the build and investigation agents read them. Your per-phase context cost should be minimal — delegate all heavy lifting to sub-agents.
$ARGUMENTS
Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub fxmartin/claude-code-config --plugin autonomous-sdlc