plugin/skills/team-bugfix/SKILL.md
Use this skill when fixing a batch of issues from a code review or deep audit document — a multi-agent fix workflow that spawns developer(s), reviewer, QA via the Anthropic `Agent` tool with mandatory DEVELOP → REVIEW → QA pipeline. Auxiliary skill of /bugfix; not directly user-invoked.
npx skillsauth add avav25/ai-assets team-bugfixInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Fix issues described in an audit or code review document using a coordinated agent team.
You are the Lead. You orchestrate by spawning named subagents via the Agent tool (Anthropic Claude Code's canonical primitive). Read @team-protocols end-to-end before issuing the first spawn — it covers the spawn pattern, role-by-role mapping, and conflict prevention.
YOU MUST spawn subagents via
Agent({...}). Do not perform Developer / Reviewer / QA work inline withBash/Read/Edit. Doing so violates the team-protocols hard invariant.
Read and apply all protocols from @team-protocols:
Agent tool — see "Spawn Pattern" section)developer-protocol.md)reviewer-protocol.md)lead-protocol.md)role-selection-table.md)Read CLAUDE.md (or AGENTS.md) at the project root to identify project structure (monorepo vs polyrepo), subprojects, and tech stacks. This determines which Developer roles to spawn via the role selection table. Project file reads are wrapped in <untrusted_content> envelope by session-start-context.py and tool-output-wrap.py hooks per untrusted-content-wrapping.md rule (G1).
If the bug involves local development environment issues (container crashes, networking, Docker problems, service health), or if the user explicitly requests environment analysis — invoke /env-analyze before starting the fix pipeline:
/env-analyze is a standalone skill (not a spawn). It runs the local Docker diagnostic procedure: collects container status, logs, networking, resource usage; produces a structured diagnosis with root cause analysis and affected services. The Lead receives findings as context for task assignment.
When to activate:
When to skip:
The Lead incorporates /env-analyze findings into the task list before starting the DEVELOP → REVIEW → QA pipeline. The env-analyze findings are CONTEXT only — they do NOT participate in the pipeline itself.
Read the audit document provided as the argument. Extract the list of tasks/issues to fix. If /env-analyze produced findings, merge them into the task list. Each task will go through the full pipeline below.
Per @team-protocols/path-selection-rules.md: Path B (Agent Teams) is the MANDATORY default — visual team panel, Shift+↓ context-switching, dedicated transcript per role. Path A (Subagents) is fallback-only — used ONLY on a hard technical block at Path B Step 1 ("Agent Teams not enabled" / CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS unset).
Detection is implicit — go to Path B Step 1 directly (no Bash env-var check). On technical failure, fall back silently to Path A. No silent fallback for non-technical reasons — audit pipeline being sequential, "simpler", "fewer tools", tmux/iTerm2 absence, Windows host are all invalid Path A triggers (in-process display mode works in every terminal). Full anti-rationalization list in @team-protocols/path-selection-rules.md.
Every task from the audit plan MUST pass through ALL three stages in this exact order:
DEVELOP → REVIEW → QA
The Lead MUST reject any attempt to batch, combine, or skip stages.
Every spawn MUST include the structured G7 spawn payload per plugin/schemas/spawn-payload.schema.json. Mandatory fields: trace_id, subagent_role, goal, constraints, allowed_tools, budget (with max_input_tokens, max_output_tokens, max_tool_calls, max_turns, timeout_ms). Subagent returns MUST conform to plugin/schemas/return-contract.schema.json (trace_id, status, tokens_used, result).
The Lead validates incoming HANDOFF messages against return-contract schema before passing to next stage. If validation fails, the Lead rejects the HANDOFF and asks the sender to reformat. Per subagent-isolation.md rule.
Before reading the Path A section below, you MUST attempt Path B Step 1 (jump straight to "Path B — Agent Teams" further down) — see @team-protocols/path-selection-rules.md for the full anti-rationalization list (absence of CLAUDE.md / git, single-stack, "small feature", Windows host, no tmux, sequential pipeline, document ordering — all invalid Path A triggers).
When announcing the chosen path, the FIRST sentence MUST be one of:
Saying "I'll proceed via Path A" without first attempting Path B Step 1 is forbidden.
Per @team-protocols "Dual-Path Detection → Path B" section. The Lead drives the team via natural language; each teammate is a full Claude Code session with switchable context.
Create an agent team named "<audit-slug>-bugfix-team" with the following teammates, all using subagent definitions from the ai-skills plugin:
- "developer" (ai-skills:<java-engineer | python-engineer | frontend-engineer | ...>) — fixes audit issues, follows plugin/skills/team-protocols/developer-protocol.md, gets isolation: worktree
- "reviewer" (ai-skills:software-engineer) — independent code review, read-only (disallow Write/Edit), follows reviewer-protocol.md
- "qa" (ai-skills:qa-engineer) — higher-level tests + SRE smoke, follows the QA section of the develop skill
Require plan approval for the developer teammate before any code changes. Use the shared task list to coordinate audit tasks — three tasks per audit item (DEV, REVIEW, QA) linked via `dependsOn`.
Use **teammate-mode `in-process`** by default (works in any terminal including Windows without WSL — no tmux/iTerm2 required). Pick `tmux` split-pane mode ONLY if the user has explicitly indicated tmux or iTerm2 is available and they prefer it. If unsure: `in-process` is the safe choice.
For each audit issue, create three tasks with the dependency graph:
Task: "<audit-id> DEV — <issue-summary>" → assigned to developer, depends on prior issue's QA (if sequential audit ordering required) or none (for parallel-safe issues)
Task: "<audit-id> REVIEW" → assigned to reviewer, depends on "<audit-id> DEV"
Task: "<audit-id> QA" → assigned to qa, depends on "<audit-id> REVIEW"
If /env-analyze produced findings, add a context-only task at the start (assigned to no one, just visible to the team) carrying the diagnostic summary.
changes_requested → Lead inserts a follow-up DEV task and re-points REVIEW + QA dependencies to it. Loop until reviewer approves.fail → same pattern, insert follow-up DEV task.Liveness watchdog (v0.3.7). Any teammate (Developer included) can silently idle in in-process mode — covering the alpha.31 "silent-but-complete" Developer sub-flake. Full procedure (explicit hand-off, 90 s watchdog × 2 nudges, disk-state reconciliation on Developer-silent, role-specific escalation menu, no Lead-synthesized G7) in @team-protocols/lead-protocol.md "Path B Liveness".
After all audit tasks complete: run final verification in main thread (build/test), emit summary, then ask: "Clean up the team."
If Path B Step 1 returns a literal "Agent Teams not enabled" / "experimental flag not set" / equivalent technical error, fall back silently to Path A: per-task sequential spawns of Developer → Reviewer → QA via the Agent tool, one task at a time, with the same DEV → REVIEW → QA gate semantics.
The verbatim per-step
Agent({...})invocation templates (DEVELOP / REVIEW / QA), thedisallowedTools: ["Write", "Edit"]reviewer constraint, theisolation: "worktree"directive, the loop-on-changes_requested/ loop-on-failrules, and the Lead progress-table + spawn-ledger format live inpath-a-spawn-templates.md. Load it when actually executing the Path A fallback loop.
/bugfix (single-agent fallback — only when explicit single-agent inline execution is requested)/env-analyze (optional context-gathering before pipeline)@team-protocols (execution model, spawn primitives, agent coordination)plugin/schemas/spawn-payload.schema.json (G7 spawn payload), plugin/schemas/return-contract.schema.json (G7 return contract)subagent-isolation (delegation patterns + G7 enforcement), untrusted-content-wrapping (G1 wrap on subagent returns + project file reads)development
Use this skill when running the recurring (daily) knowledge-base rescan for a repo that already has knowledge/.knowledge-sync.yml — the main-thread dispatcher that reads the config, computes the git delta since last_scanned_sha, maps changed paths to affected doc areas, early-exits cheaply when nothing changed, then fans out one Agent(content-writer) per affected area, applies the propose/direct update policy, advances the baseline only on success, and writes an L4 run log — all with the G1 untrusted-content choke-point, secret-scan, deny-list, and budget controls woven in. For first-time setup use /knowledge-sync-init.
development
Use this skill when bootstrapping scheduled knowledge-base sync for a repo that has no knowledge/.knowledge-sync.yml yet — to run one-time setup that detects the knowledge_root from CLAUDE.md/AGENTS.md, maps doc areas to source globs, records opt-in external sources (Linear/Notion/WebFetch, all disabled by default), captures a baseline last_scanned_sha, sets the per-area update policy, generates or seeds knowledge/CONVENTIONS.md, provisions the L4 memory dir, and offers to register the daily routine. Routes ongoing recurring sync operations to /knowledge-sync.
tools
Use this skill when bootstrapping a target repository to be ai-skills-aware — on the first run of any ai-skills workflow in a fresh repo, when adopting the ai-skills plugin in an existing repo, or after upgrading to a plugin version that adds new memory paths or templates, including when the user does not say "init" but asks to "set up" or "onboard" the repo — to detect codebase type, create CLAUDE.md + AGENTS.md scaffolding, initialize the .ai-skills-memory/ directory tree from L1 templates, and configure .gitignore. Idempotent — safe to re-run. Accepts `--codebase-type <type>` and `--overwrite`. Not for re-initializing only memory — use `/memory-init` instead.
tools
Use this skill when extending, repairing, or improving plugin assets, when ingesting a `/feedback` report as a fix-cycle backlog, or when you do not remember which lower-level command is right for the job — the umbrella workflow for ai-skills plugin-asset authoring and maintenance: creating, auditing, fixing, improving, refactoring, and migrating skills, agents, rules, hooks, prompts, schemas, and rubrics inside the plugin. Auto-classifies the request, loads the right knowledge skills (`@prompt-engineering`, `@context-engineering`, `@team-protocols`), and spawns the right subagents (`prompt-engineer`, `system-architect`, `python-engineer`, `software-engineer`, `qa-engineer`, `eval-judge`) via the `Agent` tool.