plugin/skills/bugfix/SKILL.md
Use this skill when investigating, diagnosing, and fixing a reported bug — including when the user reports an error message or broken behavior without saying "bugfix" — to run an end-to-end bugfix workflow with a mandatory DEVELOP → REVIEW → QA pipeline: the Lead orchestrates triage intake, environment analysis (`/env-analyze` for local, `/analyze-prod` for production), evidence collection, and bug report, then spawns developer/reviewer/QA via the Anthropic `Agent` tool to apply, review, and verify the fix.
npx skillsauth add avav25/ai-assets 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.
End-to-end bugfix workflow. The Lead handles intake / env analysis / evidence / bug report in the main thread, then drives a mandatory DEVELOP → REVIEW → QA pipeline by spawning named subagents via the Agent tool for the implementation, review, and verification of the fix.
You are the Lead. Read @team-protocols end-to-end before issuing the first spawn — it covers the spawn pattern, role-by-role mapping, conflict prevention, dual-path detection, and the G7 spawn payload + return contract schemas.
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 — the user loses per-role inspection and the pipeline gates collapse. Every fix-apply / review / verify step in this skill is an explicit, executableAgent({...})call.
Gather from the user (Lead, main thread):
For P1/P2 — skip detailed intake and proceed immediately to Step 2.
Based on the environment, delegate to the appropriate diagnostic sub-workflow (these are skills, not subagent spawns — they run inline):
| Environment | Sub-workflow |
|---|---|
| Local Docker / Docker Compose | /env-analyze (or /analyze-local) |
| Cloud production (GKE/AKS/EKS, managed DB) | /analyze-prod |
| Code-only (no infra) | Skip to Step 3 |
The sub-workflow applies the diagnostic role (Agent(sre-engineer) / Agent(devops-engineer)), collects environment snapshot, and presents diagnosis. If it resolves the issue at the infra layer — skip to Step 9 (Summary). If the root cause is in application code — continue to Step 3 with the collected evidence.
Claude Code's Read tool rejects files whose content exceeds 25 000 tokens (e.g. a 37K-token design.md or an 84K-token Monitor stream log). A failed Read costs the round-trip AND can stall the workflow. Before the first Read on any large evidence file (logs, stack traces, dumps, design docs > ~1000 lines):
wc -l <path> # line count
wc -c <path> # byte count — divide by ~4 for token estimate
If wc -l ≥ 1000 OR estimated tokens ≥ 20 000:
grep -n "<symbol or error>" <path> to locate the relevant span.Read(<path>, offset=<line>, limit=<window>) for that span only.tail -n 500 / head -n 500 via Bash rather than full Read.This rule applies to every teammate spawn's pre_read list and to the Lead's own evidence-collection reads.
Determine the affected service's tech stack to choose the right Developer subagent_type for the pipeline:
CLAUDE.md / AGENTS.md — tech stack declarationpackage.json, pom.xml, requirements.txt, go.mod)| Stack signal | Developer subagent_type |
|---|---|
| Next.js, React, TypeScript, .tsx files | ai-skills:frontend-engineer |
| Spring Boot, Java, .java files | ai-skills:java-engineer |
| FastAPI, Python, .py files | ai-skills:python-engineer |
| Terraform, Dockerfile, Helm, CI/CD | ai-skills:devops-engineer |
| ML model, training pipeline, inference | ai-skills:ml-engineer |
| Multiple stacks | One Developer per affected stack (sequential per subagent-isolation.md) |
| Unknown / general | ai-skills:software-engineer |
Announce the selected Developer role(s) to the user.
Gather a structured evidence collection (Lead, main thread). Combine Step 2 environment data with code-level investigation:
git log -n 20 --oneline)Identify the minimal reproduction case — this becomes the regression-test oracle in Step 7.
Compile findings into a structured bug report (Summary, Severity, Environment, Expected/Actual, Steps to reproduce, Evidence, Root cause analysis, Affected components). Present to the user. Wait for confirmation that the diagnosis is correct before committing the fix to the pipeline.
Per @team-protocols/path-selection-rules.md: Path B (Agent Teams) is MANDATORY default — visual team panel, Shift+↓ context-switching, dedicated transcript per role. Path A (sequential subagents) is fallback-only.
Detection is implicit — go to Path B Step 1 directly, no Bash env-var check. Valid Path A triggers are documented in @team-protocols/path-selection-rules.md (env-var unset, lead-in-subagent, whole-team alpha.32, alpha.33-fast-fail). Display-mode, platform, "small bug", "sequential pipeline", "single-stack", "Windows host", or "no tmux" — NEVER valid Path A triggers. No silent fallback for non-technical reasons — rationalised downgrades violate alpha.27.
The FIRST sentence when announcing the path MUST be one of:
Every fix MUST pass all three stages. Gate semantics are identical regardless of execution path; only the spawn mechanism differs.
Agent call returns a valid G7 contract.verdict: approved.qa_verdict: pass.Optional RALF on the reproduction test (kill-on oracle-pass): wrap the DEV spawn in /ralph per ralph-budget.md for intermittent / environment-dependent / hard-to-converge bugs (race conditions, memory leaks, off-by-ones). Defaults: 6 iter / 300K tokens / 60 min. Skip RALF for trivial bugs where the regression test passes on the first DEV iteration.
The full Path B step sequence (team-create → task list → drive/monitor +
liveness watchdog → final cleanup) and the Path A subagents fallback (verbatim
Agent({...}) templates, reviewer disallowedTools, isolation: worktree,
loop-on-changes_requested/fail) live in pipeline-execution.md. Read
pipeline-execution.md and apply the steps verbatim before driving the
pipeline — those mechanics are mandatory. Path B is the MANDATORY default;
Path A is used only when Path B Step 1 returns a technical error.
After the pipeline returns the final fix:
/run-tests) one more time — all tests pass/analyze-prod checks; monitor error rates and SLIsDo NOT declare the bug fixed until every item passes.
Present the completed bugfix:
DEV-1 → REVIEW changes_requested → DEV-2 → REVIEW approved → QA pass)/env-analyze (local Docker diagnostic), /analyze-prod (production diagnostic), /ralph (optional RALF wrap on the DEV spawn for hard-to-converge bugs)/team-bugfix (same DEV/REVIEW/QA pipeline applied to a batch of issues from a code-review or audit document — use it when the input is an audit doc rather than a single bug report)/run-tests (final test gate), /pre-commit (commit gate), /create-pr (submit fix)@team-protocols (execution model, spawn primitives, agent coordination, G7 contracts)plugin/schemas/spawn-payload.schema.json, plugin/schemas/return-contract.schema.jsoncode-review (Reviewer applies), test-strategy (QA applies), worktree-isolation (multi-Developer isolation)subagent-isolation (G7 + bounded recursion + sequential code-mod gate), ralph-budget (RALF caps), untrusted-content-wrapping (G1 wrap on /env-analyze + /analyze-prod outputs)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.