@arthai/agents 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +123 -0
- package/VERSION +1 -0
- package/agents/ai-consultant.md +999 -0
- package/agents/architect.md +174 -0
- package/agents/code-reviewer.md +115 -0
- package/agents/competitive-analyst.md +688 -0
- package/agents/content-strategist.md +607 -0
- package/agents/design-studio-create.md +304 -0
- package/agents/design-studio-critique.md +258 -0
- package/agents/design-studio-think.md +79 -0
- package/agents/domain-hunter.md +519 -0
- package/agents/explore-light.md +52 -0
- package/agents/frontend.md +261 -0
- package/agents/gtm-expert.md +811 -0
- package/agents/meeting-prep.md +318 -0
- package/agents/ops.md +149 -0
- package/agents/product-manager.md +563 -0
- package/agents/python-backend.md +286 -0
- package/agents/qa-baseline-updater.md +45 -0
- package/agents/qa-challenger.md +97 -0
- package/agents/qa-domain.md +145 -0
- package/agents/qa-e2e.md +184 -0
- package/agents/qa-test-promoter.md +97 -0
- package/agents/qa.md +226 -0
- package/agents/setup.md +134 -0
- package/agents/sre.md +165 -0
- package/agents/stakeholder-reporter.md +94 -0
- package/agents/user-researcher.md +602 -0
- package/bin/cli.js +322 -0
- package/bundles/canvas.json +16 -0
- package/bundles/compass.json +16 -0
- package/bundles/counsel.json +31 -0
- package/bundles/cruise.json +11 -0
- package/bundles/forge.json +26 -0
- package/bundles/prime.json +10 -0
- package/bundles/prism.json +23 -0
- package/bundles/scalpel.json +17 -0
- package/bundles/sentinel.json +19 -0
- package/bundles/shield.json +14 -0
- package/bundles/spark.json +19 -0
- package/compiler.sh +305 -0
- package/dist/plugins/canvas/.claude-plugin/plugin.json +6 -0
- package/dist/plugins/canvas/agents/design-studio-create.md +304 -0
- package/dist/plugins/canvas/agents/design-studio-critique.md +258 -0
- package/dist/plugins/canvas/agents/design-studio-think.md +79 -0
- package/dist/plugins/canvas/agents/frontend.md +261 -0
- package/dist/plugins/canvas/skills/planning/SKILL.md +436 -0
- package/dist/plugins/compass/.claude-plugin/plugin.json +6 -0
- package/dist/plugins/compass/agents/content-strategist.md +607 -0
- package/dist/plugins/compass/agents/gtm-expert.md +811 -0
- package/dist/plugins/compass/agents/product-manager.md +563 -0
- package/dist/plugins/compass/agents/user-researcher.md +602 -0
- package/dist/plugins/compass/skills/planning/SKILL.md +436 -0
- package/dist/plugins/counsel/.claude-plugin/plugin.json +6 -0
- package/dist/plugins/counsel/agents/ai-consultant.md +999 -0
- package/dist/plugins/counsel/agents/competitive-analyst.md +688 -0
- package/dist/plugins/counsel/agents/meeting-prep.md +318 -0
- package/dist/plugins/counsel/agents/stakeholder-reporter.md +94 -0
- package/dist/plugins/counsel/hooks/check-deliverable.sh +65 -0
- package/dist/plugins/counsel/hooks/ensure-client-dir.sh +59 -0
- package/dist/plugins/counsel/hooks/hooks.json +28 -0
- package/dist/plugins/counsel/skills/client-discovery/SKILL.md +266 -0
- package/dist/plugins/counsel/skills/consulting/SKILL.md +282 -0
- package/dist/plugins/counsel/skills/deliverable-builder/SKILL.md +928 -0
- package/dist/plugins/counsel/skills/engagement-tracker/SKILL.md +380 -0
- package/dist/plugins/counsel/skills/market-research/SKILL.md +300 -0
- package/dist/plugins/counsel/skills/opportunity-map/SKILL.md +307 -0
- package/dist/plugins/counsel/skills/pitch-generator/SKILL.md +378 -0
- package/dist/plugins/counsel/skills/roi-calculator/SKILL.md +469 -0
- package/dist/plugins/counsel/skills/share/SKILL.md +211 -0
- package/dist/plugins/counsel/skills/solution-architect/SKILL.md +566 -0
- package/dist/plugins/counsel/skills/templates/SKILL.md +194 -0
- package/dist/plugins/counsel/skills/welcome/SKILL.md +136 -0
- package/dist/plugins/counsel/skills/wizard/SKILL.md +411 -0
- package/dist/plugins/cruise/.claude-plugin/plugin.json +6 -0
- package/dist/plugins/cruise/skills/autopilot/SKILL.md +425 -0
- package/dist/plugins/forge/.claude-plugin/plugin.json +6 -0
- package/dist/plugins/forge/agents/architect.md +174 -0
- package/dist/plugins/forge/agents/code-reviewer.md +115 -0
- package/dist/plugins/forge/agents/frontend.md +261 -0
- package/dist/plugins/forge/agents/product-manager.md +563 -0
- package/dist/plugins/forge/agents/python-backend.md +286 -0
- package/dist/plugins/forge/agents/qa.md +226 -0
- package/dist/plugins/forge/hooks/hooks.json +28 -0
- package/dist/plugins/forge/hooks/post-test-summary.sh +115 -0
- package/dist/plugins/forge/hooks/triage-router.sh +740 -0
- package/dist/plugins/forge/skills/implement/SKILL.md +532 -0
- package/dist/plugins/forge/skills/planning/SKILL.md +436 -0
- package/dist/plugins/forge/skills/pr/SKILL.md +275 -0
- package/dist/plugins/forge/skills/precheck/SKILL.md +159 -0
- package/dist/plugins/forge/skills/qa/SKILL.md +127 -0
- package/dist/plugins/forge/skills/review-pr/SKILL.md +367 -0
- package/dist/plugins/prime/.claude-plugin/plugin.json +6 -0
- package/dist/plugins/prime/agents/ai-consultant.md +999 -0
- package/dist/plugins/prime/agents/architect.md +174 -0
- package/dist/plugins/prime/agents/code-reviewer.md +115 -0
- package/dist/plugins/prime/agents/competitive-analyst.md +688 -0
- package/dist/plugins/prime/agents/content-strategist.md +607 -0
- package/dist/plugins/prime/agents/design-studio-create.md +304 -0
- package/dist/plugins/prime/agents/design-studio-critique.md +258 -0
- package/dist/plugins/prime/agents/design-studio-think.md +79 -0
- package/dist/plugins/prime/agents/explore-light.md +52 -0
- package/dist/plugins/prime/agents/frontend.md +261 -0
- package/dist/plugins/prime/agents/gtm-expert.md +811 -0
- package/dist/plugins/prime/agents/meeting-prep.md +318 -0
- package/dist/plugins/prime/agents/ops.md +149 -0
- package/dist/plugins/prime/agents/product-manager.md +563 -0
- package/dist/plugins/prime/agents/python-backend.md +286 -0
- package/dist/plugins/prime/agents/qa-baseline-updater.md +45 -0
- package/dist/plugins/prime/agents/qa-challenger.md +97 -0
- package/dist/plugins/prime/agents/qa-domain.md +145 -0
- package/dist/plugins/prime/agents/qa-e2e.md +184 -0
- package/dist/plugins/prime/agents/qa-test-promoter.md +97 -0
- package/dist/plugins/prime/agents/qa.md +226 -0
- package/dist/plugins/prime/agents/setup.md +134 -0
- package/dist/plugins/prime/agents/sre.md +165 -0
- package/dist/plugins/prime/agents/stakeholder-reporter.md +94 -0
- package/dist/plugins/prime/agents/user-researcher.md +602 -0
- package/dist/plugins/prime/hooks/check-deliverable.sh +65 -0
- package/dist/plugins/prime/hooks/ensure-client-dir.sh +59 -0
- package/dist/plugins/prime/hooks/hooks.json +184 -0
- package/dist/plugins/prime/hooks/post-deploy-health.sh +83 -0
- package/dist/plugins/prime/hooks/post-diff-test-compare.sh +125 -0
- package/dist/plugins/prime/hooks/post-edit-lint.sh +92 -0
- package/dist/plugins/prime/hooks/post-git-state.sh +54 -0
- package/dist/plugins/prime/hooks/post-merge-cleanup.sh +101 -0
- package/dist/plugins/prime/hooks/post-test-summary.sh +115 -0
- package/dist/plugins/prime/hooks/pre-bash-guard.sh +142 -0
- package/dist/plugins/prime/hooks/pre-edit-guard.sh +121 -0
- package/dist/plugins/prime/hooks/pre-task-context.sh +113 -0
- package/dist/plugins/prime/hooks/session-bootstrap.sh +379 -0
- package/dist/plugins/prime/hooks/session-end.sh +107 -0
- package/dist/plugins/prime/hooks/session-summary.sh +97 -0
- package/dist/plugins/prime/hooks/sync-agents.sh +269 -0
- package/dist/plugins/prime/hooks/triage-router.sh +740 -0
- package/dist/plugins/prime/skills/arth/SKILL.md +165 -0
- package/dist/plugins/prime/skills/autopilot/SKILL.md +425 -0
- package/dist/plugins/prime/skills/calibrate/SKILL.md +1807 -0
- package/dist/plugins/prime/skills/ci-fix/SKILL.md +293 -0
- package/dist/plugins/prime/skills/client-discovery/SKILL.md +266 -0
- package/dist/plugins/prime/skills/consulting/SKILL.md +282 -0
- package/dist/plugins/prime/skills/custom-domain/SKILL.md +261 -0
- package/dist/plugins/prime/skills/deliverable-builder/SKILL.md +928 -0
- package/dist/plugins/prime/skills/discord-ops/SKILL.md +125 -0
- package/dist/plugins/prime/skills/engagement-tracker/SKILL.md +380 -0
- package/dist/plugins/prime/skills/explore.md +43 -0
- package/dist/plugins/prime/skills/fix/SKILL.md +1058 -0
- package/dist/plugins/prime/skills/implement/SKILL.md +532 -0
- package/dist/plugins/prime/skills/incident/SKILL.md +910 -0
- package/dist/plugins/prime/skills/issue/SKILL.md +134 -0
- package/dist/plugins/prime/skills/market-research/SKILL.md +300 -0
- package/dist/plugins/prime/skills/onboard/SKILL.md +344 -0
- package/dist/plugins/prime/skills/opportunity-map/SKILL.md +307 -0
- package/dist/plugins/prime/skills/pitch-generator/SKILL.md +378 -0
- package/dist/plugins/prime/skills/planning/SKILL.md +436 -0
- package/dist/plugins/prime/skills/pr/SKILL.md +275 -0
- package/dist/plugins/prime/skills/precheck/SKILL.md +159 -0
- package/dist/plugins/prime/skills/qa/SKILL.md +127 -0
- package/dist/plugins/prime/skills/qa-incident/SKILL.md +54 -0
- package/dist/plugins/prime/skills/qa-learn/SKILL.md +47 -0
- package/dist/plugins/prime/skills/restart/SKILL.md +70 -0
- package/dist/plugins/prime/skills/review-pr/SKILL.md +367 -0
- package/dist/plugins/prime/skills/roi-calculator/SKILL.md +469 -0
- package/dist/plugins/prime/skills/scan/SKILL.md +232 -0
- package/dist/plugins/prime/skills/setup/SKILL.md +691 -0
- package/dist/plugins/prime/skills/share/SKILL.md +211 -0
- package/dist/plugins/prime/skills/solution-architect/SKILL.md +566 -0
- package/dist/plugins/prime/skills/sre/SKILL.md +362 -0
- package/dist/plugins/prime/skills/sync/SKILL.md +188 -0
- package/dist/plugins/prime/skills/templates/SKILL.md +194 -0
- package/dist/plugins/prime/skills/welcome/SKILL.md +136 -0
- package/dist/plugins/prime/skills/wizard/SKILL.md +411 -0
- package/dist/plugins/prism/.claude-plugin/plugin.json +6 -0
- package/dist/plugins/prism/agents/qa-baseline-updater.md +45 -0
- package/dist/plugins/prism/agents/qa-challenger.md +97 -0
- package/dist/plugins/prism/agents/qa-domain.md +145 -0
- package/dist/plugins/prism/agents/qa-e2e.md +184 -0
- package/dist/plugins/prism/agents/qa-test-promoter.md +97 -0
- package/dist/plugins/prism/agents/qa.md +226 -0
- package/dist/plugins/prism/hooks/hooks.json +26 -0
- package/dist/plugins/prism/hooks/post-diff-test-compare.sh +125 -0
- package/dist/plugins/prism/hooks/post-test-summary.sh +115 -0
- package/dist/plugins/prism/skills/qa/SKILL.md +127 -0
- package/dist/plugins/prism/skills/qa-incident/SKILL.md +54 -0
- package/dist/plugins/prism/skills/qa-learn/SKILL.md +47 -0
- package/dist/plugins/scalpel/.claude-plugin/plugin.json +6 -0
- package/dist/plugins/scalpel/agents/code-reviewer.md +115 -0
- package/dist/plugins/scalpel/hooks/hooks.json +26 -0
- package/dist/plugins/scalpel/hooks/pre-edit-guard.sh +121 -0
- package/dist/plugins/scalpel/skills/ci-fix/SKILL.md +293 -0
- package/dist/plugins/scalpel/skills/fix/SKILL.md +1058 -0
- package/dist/plugins/scalpel/skills/issue/SKILL.md +134 -0
- package/dist/plugins/sentinel/.claude-plugin/plugin.json +6 -0
- package/dist/plugins/sentinel/agents/ops.md +149 -0
- package/dist/plugins/sentinel/agents/sre.md +165 -0
- package/dist/plugins/sentinel/hooks/hooks.json +26 -0
- package/dist/plugins/sentinel/hooks/post-deploy-health.sh +83 -0
- package/dist/plugins/sentinel/hooks/post-git-state.sh +54 -0
- package/dist/plugins/sentinel/skills/incident/SKILL.md +910 -0
- package/dist/plugins/sentinel/skills/restart/SKILL.md +70 -0
- package/dist/plugins/sentinel/skills/sre/SKILL.md +362 -0
- package/dist/plugins/shield/.claude-plugin/plugin.json +6 -0
- package/dist/plugins/shield/hooks/hooks.json +60 -0
- package/dist/plugins/shield/hooks/pre-bash-guard.sh +142 -0
- package/dist/plugins/shield/hooks/pre-edit-guard.sh +121 -0
- package/dist/plugins/shield/hooks/session-bootstrap.sh +379 -0
- package/dist/plugins/shield/hooks/triage-router.sh +740 -0
- package/dist/plugins/spark/.claude-plugin/plugin.json +6 -0
- package/dist/plugins/spark/agents/explore-light.md +52 -0
- package/dist/plugins/spark/agents/setup.md +134 -0
- package/dist/plugins/spark/hooks/hooks.json +16 -0
- package/dist/plugins/spark/hooks/session-bootstrap.sh +379 -0
- package/dist/plugins/spark/skills/calibrate/SKILL.md +1807 -0
- package/dist/plugins/spark/skills/onboard/SKILL.md +344 -0
- package/dist/plugins/spark/skills/scan/SKILL.md +232 -0
- package/dist/plugins/spark/skills/setup/SKILL.md +691 -0
- package/hook-defs.json +104 -0
- package/hooks/check-deliverable.sh +65 -0
- package/hooks/ensure-client-dir.sh +59 -0
- package/hooks/hooks.json +16 -0
- package/hooks/post-deploy-health.sh +83 -0
- package/hooks/post-diff-test-compare.sh +125 -0
- package/hooks/post-edit-lint.sh +92 -0
- package/hooks/post-git-state.sh +54 -0
- package/hooks/post-merge-cleanup.sh +101 -0
- package/hooks/post-test-summary.sh +115 -0
- package/hooks/pre-bash-guard.sh +142 -0
- package/hooks/pre-edit-guard.sh +121 -0
- package/hooks/pre-task-context.sh +113 -0
- package/hooks/session-bootstrap.sh +379 -0
- package/hooks/session-end.sh +107 -0
- package/hooks/session-start.sh +46 -0
- package/hooks/session-summary.sh +97 -0
- package/hooks/sync-agents.sh +269 -0
- package/hooks/triage-router.sh +740 -0
- package/install.sh +3185 -0
- package/package.json +40 -0
- package/portable.manifest +112 -0
- package/skills/arth/SKILL.md +165 -0
- package/skills/autopilot/SKILL.md +425 -0
- package/skills/calibrate/SKILL.md +1807 -0
- package/skills/ci-fix/SKILL.md +293 -0
- package/skills/client-discovery/SKILL.md +266 -0
- package/skills/consulting/SKILL.md +282 -0
- package/skills/continue/SKILL.md +174 -0
- package/skills/custom-domain/SKILL.md +261 -0
- package/skills/deliverable-builder/SKILL.md +928 -0
- package/skills/discord-ops/SKILL.md +125 -0
- package/skills/engagement-tracker/SKILL.md +380 -0
- package/skills/explore.md +43 -0
- package/skills/fix/SKILL.md +1058 -0
- package/skills/implement/SKILL.md +532 -0
- package/skills/incident/SKILL.md +910 -0
- package/skills/issue/SKILL.md +134 -0
- package/skills/market-research/SKILL.md +300 -0
- package/skills/onboard/SKILL.md +344 -0
- package/skills/opportunity-map/SKILL.md +307 -0
- package/skills/pitch-generator/SKILL.md +378 -0
- package/skills/planning/SKILL.md +436 -0
- package/skills/pr/SKILL.md +275 -0
- package/skills/precheck/SKILL.md +159 -0
- package/skills/qa/SKILL.md +127 -0
- package/skills/qa-incident/SKILL.md +54 -0
- package/skills/qa-learn/SKILL.md +47 -0
- package/skills/railway/central-station/SKILL.md +226 -0
- package/skills/railway/central-station/references/environment-config.md +183 -0
- package/skills/railway/central-station/references/monorepo.md +216 -0
- package/skills/railway/central-station/references/railpack.md +257 -0
- package/skills/railway/central-station/references/variables.md +170 -0
- package/skills/railway/database/SKILL.md +284 -0
- package/skills/railway/database/references/environment-config.md +183 -0
- package/skills/railway/database/references/monorepo.md +216 -0
- package/skills/railway/database/references/railpack.md +257 -0
- package/skills/railway/database/references/variables.md +170 -0
- package/skills/railway/database/scripts/railway-api.sh +41 -0
- package/skills/railway/deploy/SKILL.md +128 -0
- package/skills/railway/deploy/references/environment-config.md +183 -0
- package/skills/railway/deploy/references/monorepo.md +216 -0
- package/skills/railway/deploy/references/railpack.md +257 -0
- package/skills/railway/deploy/references/variables.md +170 -0
- package/skills/railway/deployment/SKILL.md +222 -0
- package/skills/railway/deployment/references/environment-config.md +183 -0
- package/skills/railway/deployment/references/monorepo.md +216 -0
- package/skills/railway/deployment/references/railpack.md +257 -0
- package/skills/railway/deployment/references/variables.md +170 -0
- package/skills/railway/domain/SKILL.md +137 -0
- package/skills/railway/domain/references/environment-config.md +183 -0
- package/skills/railway/domain/references/monorepo.md +216 -0
- package/skills/railway/domain/references/railpack.md +257 -0
- package/skills/railway/domain/references/variables.md +170 -0
- package/skills/railway/environment/SKILL.md +266 -0
- package/skills/railway/environment/references/environment-config.md +183 -0
- package/skills/railway/environment/references/monorepo.md +216 -0
- package/skills/railway/environment/references/railpack.md +257 -0
- package/skills/railway/environment/references/variables.md +170 -0
- package/skills/railway/metrics/SKILL.md +211 -0
- package/skills/railway/metrics/references/environment-config.md +183 -0
- package/skills/railway/metrics/references/monorepo.md +216 -0
- package/skills/railway/metrics/references/railpack.md +257 -0
- package/skills/railway/metrics/references/variables.md +170 -0
- package/skills/railway/metrics/scripts/railway-api.sh +41 -0
- package/skills/railway/new/SKILL.md +489 -0
- package/skills/railway/new/references/environment-config.md +183 -0
- package/skills/railway/new/references/monorepo.md +216 -0
- package/skills/railway/new/references/railpack.md +257 -0
- package/skills/railway/new/references/variables.md +170 -0
- package/skills/railway/projects/SKILL.md +142 -0
- package/skills/railway/projects/references/environment-config.md +183 -0
- package/skills/railway/projects/references/monorepo.md +216 -0
- package/skills/railway/projects/references/railpack.md +257 -0
- package/skills/railway/projects/references/variables.md +170 -0
- package/skills/railway/projects/scripts/railway-api.sh +41 -0
- package/skills/railway/railway-docs/SKILL.md +47 -0
- package/skills/railway/railway-docs/references/environment-config.md +183 -0
- package/skills/railway/railway-docs/references/monorepo.md +216 -0
- package/skills/railway/railway-docs/references/railpack.md +257 -0
- package/skills/railway/railway-docs/references/variables.md +170 -0
- package/skills/railway/service/SKILL.md +249 -0
- package/skills/railway/service/references/environment-config.md +183 -0
- package/skills/railway/service/references/monorepo.md +216 -0
- package/skills/railway/service/references/railpack.md +257 -0
- package/skills/railway/service/references/variables.md +170 -0
- package/skills/railway/service/scripts/railway-api.sh +41 -0
- package/skills/railway/status/SKILL.md +91 -0
- package/skills/railway/status/references/environment-config.md +183 -0
- package/skills/railway/status/references/monorepo.md +216 -0
- package/skills/railway/status/references/railpack.md +257 -0
- package/skills/railway/status/references/variables.md +170 -0
- package/skills/railway/templates/SKILL.md +275 -0
- package/skills/railway/templates/references/environment-config.md +183 -0
- package/skills/railway/templates/references/monorepo.md +216 -0
- package/skills/railway/templates/references/railpack.md +257 -0
- package/skills/railway/templates/references/variables.md +170 -0
- package/skills/railway/templates/scripts/railway-api.sh +41 -0
- package/skills/restart/SKILL.md +70 -0
- package/skills/review-pr/SKILL.md +367 -0
- package/skills/roi-calculator/SKILL.md +469 -0
- package/skills/scan/SKILL.md +232 -0
- package/skills/setup/SKILL.md +691 -0
- package/skills/share/SKILL.md +211 -0
- package/skills/solution-architect/SKILL.md +566 -0
- package/skills/sre/SKILL.md +362 -0
- package/skills/superpowers/brainstorming/SKILL.md +96 -0
- package/skills/superpowers/dispatching-parallel-agents/SKILL.md +180 -0
- package/skills/superpowers/executing-plans/SKILL.md +84 -0
- package/skills/superpowers/finishing-a-development-branch/SKILL.md +200 -0
- package/skills/superpowers/receiving-code-review/SKILL.md +213 -0
- package/skills/superpowers/requesting-code-review/SKILL.md +105 -0
- package/skills/superpowers/requesting-code-review/code-reviewer.md +146 -0
- package/skills/superpowers/subagent-driven-development/SKILL.md +242 -0
- package/skills/superpowers/subagent-driven-development/code-quality-reviewer-prompt.md +20 -0
- package/skills/superpowers/subagent-driven-development/implementer-prompt.md +78 -0
- package/skills/superpowers/subagent-driven-development/spec-reviewer-prompt.md +61 -0
- package/skills/superpowers/systematic-debugging/CREATION-LOG.md +119 -0
- package/skills/superpowers/systematic-debugging/SKILL.md +296 -0
- package/skills/superpowers/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/skills/superpowers/systematic-debugging/condition-based-waiting.md +115 -0
- package/skills/superpowers/systematic-debugging/defense-in-depth.md +122 -0
- package/skills/superpowers/systematic-debugging/find-polluter.sh +63 -0
- package/skills/superpowers/systematic-debugging/root-cause-tracing.md +169 -0
- package/skills/superpowers/systematic-debugging/test-academic.md +14 -0
- package/skills/superpowers/systematic-debugging/test-pressure-1.md +58 -0
- package/skills/superpowers/systematic-debugging/test-pressure-2.md +68 -0
- package/skills/superpowers/systematic-debugging/test-pressure-3.md +69 -0
- package/skills/superpowers/test-driven-development/SKILL.md +371 -0
- package/skills/superpowers/test-driven-development/testing-anti-patterns.md +299 -0
- package/skills/superpowers/using-git-worktrees/SKILL.md +218 -0
- package/skills/superpowers/using-superpowers/SKILL.md +95 -0
- package/skills/superpowers/verification-before-completion/SKILL.md +139 -0
- package/skills/superpowers/writing-plans/SKILL.md +116 -0
- package/skills/superpowers/writing-skills/SKILL.md +655 -0
- package/skills/superpowers/writing-skills/anthropic-best-practices.md +1150 -0
- package/skills/superpowers/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
- package/skills/superpowers/writing-skills/graphviz-conventions.dot +172 -0
- package/skills/superpowers/writing-skills/persuasion-principles.md +187 -0
- package/skills/superpowers/writing-skills/render-graphs.js +168 -0
- package/skills/superpowers/writing-skills/testing-skills-with-subagents.md +384 -0
- package/skills/sync/SKILL.md +188 -0
- package/skills/templates/SKILL.md +194 -0
- package/skills/welcome/SKILL.md +136 -0
- package/skills/wizard/SKILL.md +411 -0
- package/templates/CLAUDE.md.managed-block +123 -0
- package/templates/CLAUDE.md.template +111 -0
- package/templates/consulting/engagement-tracker-template.md +181 -0
- package/templates/consulting/executive-summary-template.md +83 -0
- package/templates/consulting/maturity-assessment-template.md +182 -0
- package/templates/consulting/proposal-template.md +209 -0
- package/templates/consulting/roi-model-template.md +139 -0
- package/templates/consulting/solution-architecture-template.md +313 -0
- package/templates/settings.json +130 -0
|
@@ -0,0 +1,1058 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fix
|
|
3
|
+
description: "Formal bug fix pipeline — root cause analysis, scope lock, behavior contract, differential testing, regression proof. Usage: /fix <description|#issue> <--severity critical|high|medium> <--hotfix>"
|
|
4
|
+
user-invocable: true
|
|
5
|
+
arguments: "<description|#issue> <--severity critical|high|medium> <--hotfix>"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# /fix — Formal Bug Fix Pipeline
|
|
9
|
+
|
|
10
|
+
A rigorous bug fix workflow grounded in formal methods. Every step is verifiable.
|
|
11
|
+
Every guardrail is enforceable. No guessing.
|
|
12
|
+
|
|
13
|
+
**The correctness pipeline:**
|
|
14
|
+
|
|
15
|
+
| Step | Formal Method | What It Proves |
|
|
16
|
+
|------|--------------|----------------|
|
|
17
|
+
| 1. Root Cause Swarm | Competing Hypotheses + Adversarial Debate | Multiple strategies converge on the actual cause |
|
|
18
|
+
| 2. Scope Lock | Graph Reachability | Fix only touches what it needs to |
|
|
19
|
+
| 3. Behavior Contract | Hoare Logic | We know what should and shouldn't change |
|
|
20
|
+
| 4. Implement Fix | Scoped Agent | Changes stay within the Fix Zone |
|
|
21
|
+
| 4b. Review Swarm | Parallel Adversarial Review | Independent reviewer + QA attacker agree the fix is correct |
|
|
22
|
+
| 5. Differential Test | Bisimulation + Mutation | Fix changes ONLY bug behavior, nothing else |
|
|
23
|
+
|
|
24
|
+
## Argument Parsing
|
|
25
|
+
|
|
26
|
+
| Input | Action |
|
|
27
|
+
|-------|--------|
|
|
28
|
+
| `/fix POST /auth/refresh returns 500` | Free-text bug description |
|
|
29
|
+
| `/fix #123` | Load bug from GitHub issue |
|
|
30
|
+
| `/fix #123 --severity critical` | With explicit severity |
|
|
31
|
+
| `/fix #123 --hotfix` | Critical: expedited path (skip non-essential steps) |
|
|
32
|
+
| `/fix --severity high token refresh fails silently` | Severity + description |
|
|
33
|
+
|
|
34
|
+
If no severity provided, assess automatically in Step 1.
|
|
35
|
+
|
|
36
|
+
## Execution Steps
|
|
37
|
+
|
|
38
|
+
### Step 0: Load Bug Context
|
|
39
|
+
|
|
40
|
+
**If `#N` provided** — load the GitHub issue:
|
|
41
|
+
```bash
|
|
42
|
+
gh issue view N --json title,body,labels,assignees,comments
|
|
43
|
+
```
|
|
44
|
+
Extract: description, reproduction steps, affected area, any labels (bug, critical, etc.)
|
|
45
|
+
|
|
46
|
+
**If free-text** — use as the bug description directly.
|
|
47
|
+
|
|
48
|
+
**Read project context:**
|
|
49
|
+
1. Read `CLAUDE.md` for tech stack, test commands, architecture
|
|
50
|
+
2. Read `.claude/project-profile.md` if it exists (architecture, conventions)
|
|
51
|
+
3. Read `.claude/knowledge/shared/domain.md` if it exists (business rules)
|
|
52
|
+
4. Read `.claude/qa-knowledge/incidents/` for similar past incidents
|
|
53
|
+
5. Read `.claude/qa-knowledge/bug-patterns.md` for known patterns
|
|
54
|
+
|
|
55
|
+
**Check for similar past bugs:**
|
|
56
|
+
```bash
|
|
57
|
+
# Search incidents by affected area
|
|
58
|
+
grep -rl "{affected_keywords}" .claude/qa-knowledge/incidents/ 2>/dev/null
|
|
59
|
+
# Search bug patterns
|
|
60
|
+
grep -i "{affected_keywords}" .claude/qa-knowledge/bug-patterns.md 2>/dev/null
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
If similar past bugs found, show them:
|
|
64
|
+
```
|
|
65
|
+
⚠ Similar past incidents found:
|
|
66
|
+
• 2026-03-15-token-expiry.md (severity: high, status: covered)
|
|
67
|
+
Root cause: token expiry check used wrong timezone
|
|
68
|
+
• 2026-02-28-auth-500.md (severity: critical, status: covered)
|
|
69
|
+
Root cause: missing null check on session object
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
### Step 1: Root Cause Analysis (Program Slicing)
|
|
75
|
+
|
|
76
|
+
**Goal**: Find the actual cause, not a symptom. This is NOT optional — no fix without understanding.
|
|
77
|
+
|
|
78
|
+
**1.1: Reproduce the bug**
|
|
79
|
+
|
|
80
|
+
From the description/issue, determine how to reproduce:
|
|
81
|
+
```bash
|
|
82
|
+
# If it's an API bug — try to hit the endpoint
|
|
83
|
+
curl -s -X POST http://localhost:8000/auth/refresh -H "Content-Type: application/json" \
|
|
84
|
+
-d '{"refresh_token": "test"}' | head -20
|
|
85
|
+
|
|
86
|
+
# If it's a test failure — run the specific test
|
|
87
|
+
pytest tests/test_auth.py::test_refresh -v
|
|
88
|
+
|
|
89
|
+
# If it's a UI bug — check the relevant component
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
If reproduction fails, ask the user for reproduction steps.
|
|
93
|
+
|
|
94
|
+
**1.2: Locate the symptom**
|
|
95
|
+
|
|
96
|
+
Find where the error occurs:
|
|
97
|
+
```bash
|
|
98
|
+
# Search for the error message, status code, or exception
|
|
99
|
+
grep -rn "500\|Internal Server Error\|{error_message}" --include="*.py" --include="*.ts"
|
|
100
|
+
|
|
101
|
+
# Find the route/handler for the affected endpoint
|
|
102
|
+
grep -rn "{endpoint_pattern}" --include="*.py" --include="*.ts"
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**1.2b: Use explore-light for fast codebase search (cost: 1x Haiku)**
|
|
106
|
+
|
|
107
|
+
Before manually grepping, spawn explore-light to quickly locate relevant code:
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
subagent_type: "explore-light"
|
|
111
|
+
prompt: "Find all code related to {symptom description}. I need:
|
|
112
|
+
1. The route/handler for {endpoint or feature}
|
|
113
|
+
2. All functions that call or are called by the handler
|
|
114
|
+
3. Related test files
|
|
115
|
+
4. Any error handling or validation in this code path
|
|
116
|
+
Return file paths and line numbers."
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
This is 60x cheaper than doing the search yourself (Haiku vs Opus). Use the results
|
|
120
|
+
to focus your manual reading in Step 1.3 — don't read every file, read only what
|
|
121
|
+
explore-light identified.
|
|
122
|
+
|
|
123
|
+
**1.3: Investigation Swarm — depth selection**
|
|
124
|
+
|
|
125
|
+
Before spawning investigators, auto-detect the appropriate investigation depth:
|
|
126
|
+
|
|
127
|
+
| Signal | Level | Rationale |
|
|
128
|
+
|--------|-------|-----------|
|
|
129
|
+
| `--hotfix` flag | Skip (single backward trace) | Production fire |
|
|
130
|
+
| Traceback points to single line | Lite (1 round, 2 agents) | Obvious bug |
|
|
131
|
+
| Multiple possible causes / unclear reproduction | Full (3 rounds, 3 agents) | Need competing hypotheses |
|
|
132
|
+
| User says "this is simple" | Lite or skip | Trust user |
|
|
133
|
+
| Touches auth/payments/data | Full (always) | High-risk area |
|
|
134
|
+
|
|
135
|
+
If auto-detection is uncertain, ask:
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
Bug complexity estimate: {simple | moderate | complex}
|
|
139
|
+
|
|
140
|
+
Investigation mode:
|
|
141
|
+
[1] Quick — single analyst, fastest (simple bugs)
|
|
142
|
+
[2] Verified — analyst + challenger (moderate bugs)
|
|
143
|
+
[3] Swarm — 3 competing investigators with debate (complex/unclear bugs)
|
|
144
|
+
[auto] Let me decide based on evidence
|
|
145
|
+
|
|
146
|
+
Your pick? [auto]
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Team: `fix-investigate-{slug}`**
|
|
150
|
+
|
|
151
|
+
Spawn these 3 agents in parallel:
|
|
152
|
+
|
|
153
|
+
| Agent | subagent_type | model | Strategy |
|
|
154
|
+
|-------|---------------|-------|----------|
|
|
155
|
+
| backward-tracer | code-reviewer | sonnet | Traces backward from symptom through call chain |
|
|
156
|
+
| forward-tracer | code-reviewer | sonnet | Checks git log for recent changes in affected area, traces forward |
|
|
157
|
+
| pattern-matcher | explore-light | haiku | Searches knowledge base (incidents/, bug-patterns.md) for similar patterns |
|
|
158
|
+
|
|
159
|
+
Each agent receives: bug description, symptom location (file:line), reproduction steps, and access to CLAUDE.md / project-profile.md. They do NOT share conclusions with each other until Round 2.
|
|
160
|
+
|
|
161
|
+
**Early termination conditions (check before proceeding to Round 2):**
|
|
162
|
+
- All 3 agents point to the same file:line after Round 1 → CONVERGE immediately, skip to verdict
|
|
163
|
+
- A smoking gun exists (exception traceback with explicit file:line) → early converge, ask others to confirm
|
|
164
|
+
|
|
165
|
+
**Round 1 — HYPOTHESIZE**
|
|
166
|
+
|
|
167
|
+
Each agent submits independently to the orchestrator:
|
|
168
|
+
```
|
|
169
|
+
**Hypothesis**: {description of root cause}
|
|
170
|
+
**Location**: {file}:{line}
|
|
171
|
+
**Evidence**: {list of file:line citations supporting this hypothesis}
|
|
172
|
+
**Confidence**: high / medium / low
|
|
173
|
+
**Reasoning**: {how you traced from symptom to this cause}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Round 2 — CROSS-CHALLENGE** (only if no early termination)
|
|
177
|
+
|
|
178
|
+
Orchestrator broadcasts all 3 hypotheses to all 3 agents. Each agent attempts to disprove the other two:
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
## Challenge to {agent}'s hypothesis
|
|
182
|
+
**Counter-evidence**: [file:line] — {why it contradicts}
|
|
183
|
+
**Verdict**: DISPROVED | WEAKENED | CONSISTENT
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
**Round 3 — FINAL POSITION** (only if no convergence after Round 2)
|
|
187
|
+
|
|
188
|
+
Each agent submits a final hypothesis, incorporating any valid challenges received.
|
|
189
|
+
|
|
190
|
+
**Convergence scoring rubric:**
|
|
191
|
+
|
|
192
|
+
| Signal | Score |
|
|
193
|
+
|--------|-------|
|
|
194
|
+
| Evidence citation: verified file:line | +2 per citation |
|
|
195
|
+
| Evidence citation: refuted by challenge | -1 per refuted |
|
|
196
|
+
| Corroborated by another agent | +3 |
|
|
197
|
+
| Contradicted with counter-evidence | -2 |
|
|
198
|
+
| Pattern match from KB (incidents/, bug-patterns.md) | +2 |
|
|
199
|
+
| Survived cross-challenge intact | +3 |
|
|
200
|
+
| Hypothesis disproved by challenge | -3 |
|
|
201
|
+
|
|
202
|
+
**Convergence conditions:**
|
|
203
|
+
|
|
204
|
+
| Outcome | When | Action |
|
|
205
|
+
|---------|------|--------|
|
|
206
|
+
| CONVERGE immediately | All 3 agree on same file:line (Round 1) | Proceed to Step 1.4 |
|
|
207
|
+
| CONVERGE | 2 agree, 3rd disproved (Round 2) | Adopt majority hypothesis |
|
|
208
|
+
| MERGE | 2 agree, 3rd compatible (Round 2) | Merge hypotheses — combined view is more complete |
|
|
209
|
+
| CONVERGE | Highest score leads by 3+ points (Round 3) | Adopt leading hypothesis |
|
|
210
|
+
| ESCALATE | Scores within 2 points (Round 3) | Present all 3 to user — do not guess |
|
|
211
|
+
|
|
212
|
+
**Escalation prompt (if no convergence):**
|
|
213
|
+
```
|
|
214
|
+
⚠ Investigation swarm could not converge — 3 competing hypotheses remain after debate:
|
|
215
|
+
|
|
216
|
+
backward-tracer (score: {N}):
|
|
217
|
+
Root cause: {hypothesis}
|
|
218
|
+
Location: {file}:{line}
|
|
219
|
+
Key evidence: {citations}
|
|
220
|
+
|
|
221
|
+
forward-tracer (score: {N}):
|
|
222
|
+
Root cause: {hypothesis}
|
|
223
|
+
Location: {file}:{line}
|
|
224
|
+
Key evidence: {citations}
|
|
225
|
+
|
|
226
|
+
pattern-matcher (score: {N}):
|
|
227
|
+
Root cause: {hypothesis}
|
|
228
|
+
Location: {file}:{line}
|
|
229
|
+
Key evidence: {citations}
|
|
230
|
+
|
|
231
|
+
Which should we pursue?
|
|
232
|
+
[1] backward-tracer's diagnosis
|
|
233
|
+
[2] forward-tracer's diagnosis
|
|
234
|
+
[3] pattern-matcher's diagnosis
|
|
235
|
+
[4] Investigate all — there may be multiple bugs
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**1.4: Identify root cause**
|
|
239
|
+
|
|
240
|
+
The root cause is the earliest point in the dependency chain where behavior diverges
|
|
241
|
+
from the specification. It's where "this code assumes X but X is not always true."
|
|
242
|
+
|
|
243
|
+
Document:
|
|
244
|
+
```markdown
|
|
245
|
+
**Root Cause**: {precise description}
|
|
246
|
+
**Location**: {file}:{line}
|
|
247
|
+
**Why it breaks**: {what assumption is violated}
|
|
248
|
+
**When it breaks**: {specific conditions that trigger the bug}
|
|
249
|
+
**When it works**: {conditions under which the bug doesn't manifest}
|
|
250
|
+
**Swarm verdict**: {CONVERGE | MERGE | user-resolved} — {which agents agreed}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
**1.5: Assess severity** (if not provided)
|
|
254
|
+
|
|
255
|
+
| Signal | Severity |
|
|
256
|
+
|--------|----------|
|
|
257
|
+
| Production users affected NOW | **critical** |
|
|
258
|
+
| Data corruption or security | **critical** |
|
|
259
|
+
| Feature broken but workaround exists | **high** |
|
|
260
|
+
| Edge case, rare trigger | **medium** |
|
|
261
|
+
| Cosmetic, no functional impact | **low** |
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
### Step 2: Scope Lock (Graph Reachability)
|
|
266
|
+
|
|
267
|
+
**Goal**: Determine exactly which files the fix may touch and which are OFF LIMITS.
|
|
268
|
+
|
|
269
|
+
**2.1: Build dependency graph from root cause**
|
|
270
|
+
|
|
271
|
+
Starting from the root cause location, trace outward:
|
|
272
|
+
|
|
273
|
+
```
|
|
274
|
+
Hop 0 (ROOT CAUSE): The file/function with the bug
|
|
275
|
+
→ Read the file, identify the broken function
|
|
276
|
+
|
|
277
|
+
Hop 1 (DIRECT DEPENDENCIES): Files the root cause imports from or is called by
|
|
278
|
+
→ grep for imports in the root cause file
|
|
279
|
+
→ grep for who imports/calls the root cause function
|
|
280
|
+
|
|
281
|
+
Hop 2 (INDIRECT): Files that depend on hop-1 files
|
|
282
|
+
→ Same grep pattern, one level out
|
|
283
|
+
|
|
284
|
+
Hop 3+: Everything else
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
**Execute with actual code analysis:**
|
|
288
|
+
```bash
|
|
289
|
+
# Hop 0: root cause file
|
|
290
|
+
ROOT_FILE="backend/app/services/auth.py"
|
|
291
|
+
|
|
292
|
+
# Hop 1: what does root cause import?
|
|
293
|
+
grep -E "^from|^import" "$ROOT_FILE" | grep -v "^from typing\|^import os\|^import json"
|
|
294
|
+
|
|
295
|
+
# Hop 1: who imports root cause?
|
|
296
|
+
grep -rl "from.*auth import\|import.*auth" backend/ --include="*.py"
|
|
297
|
+
|
|
298
|
+
# Hop 2: extend one more level from hop 1 results
|
|
299
|
+
# (repeat the above for each hop 1 file)
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
**2.2: Classify zones**
|
|
303
|
+
|
|
304
|
+
Write the scope lock document — this is the guardrail for the entire fix:
|
|
305
|
+
|
|
306
|
+
```markdown
|
|
307
|
+
## Scope Lock — {bug description}
|
|
308
|
+
|
|
309
|
+
### Fix Zone (ALLOWED — may modify)
|
|
310
|
+
{Files at hop 0-1 that need changes to fix the bug}
|
|
311
|
+
- {file}:{lines} — {why this needs to change}
|
|
312
|
+
- {file}:{lines} — {why this needs to change}
|
|
313
|
+
- {test_file} — regression test goes here
|
|
314
|
+
|
|
315
|
+
### Watch Zone (CAUTION — may be affected)
|
|
316
|
+
{Files at hop 2 that might be affected by the fix}
|
|
317
|
+
- {file} — {how it relates, what to watch for}
|
|
318
|
+
|
|
319
|
+
### Frozen Zone (BLOCKED — must NOT modify)
|
|
320
|
+
{Everything else — especially:}
|
|
321
|
+
- All files outside the dependency chain
|
|
322
|
+
- Migration files (unless root cause is in schema)
|
|
323
|
+
- Config files (unless root cause is in config)
|
|
324
|
+
- Unrelated services/modules
|
|
325
|
+
- Frontend (if backend bug) or vice versa
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
**2.3: Set up enforcement**
|
|
329
|
+
|
|
330
|
+
Save the scope lock to a file that the implementation step reads:
|
|
331
|
+
```bash
|
|
332
|
+
# Write scope lock for the implementation agents
|
|
333
|
+
cat > .claude/.fix-scope-lock.json << 'EOF'
|
|
334
|
+
{
|
|
335
|
+
"bug": "{description}",
|
|
336
|
+
"severity": "{severity}",
|
|
337
|
+
"root_cause": "{file}:{line}",
|
|
338
|
+
"fix_zone": ["{file1}", "{file2}", "{test_file}"],
|
|
339
|
+
"watch_zone": ["{file3}", "{file4}"],
|
|
340
|
+
"frozen_zone_patterns": ["migrations/*", "frontend/*", "*.lock"],
|
|
341
|
+
"created_at": "{timestamp}"
|
|
342
|
+
}
|
|
343
|
+
EOF
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
The implementation agent reads this and is BLOCKED from editing files outside fix_zone.
|
|
347
|
+
The pre-edit-guard hook can enforce this if `.claude/.fix-scope-lock.json` exists.
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
### Step 3: Behavior Contract (Hoare Logic)
|
|
352
|
+
|
|
353
|
+
**Goal**: Define exactly what the fix should change and what must stay the same.
|
|
354
|
+
|
|
355
|
+
**3.1: Extract existing contracts**
|
|
356
|
+
|
|
357
|
+
For each function in the Fix Zone, extract its behavioral contract:
|
|
358
|
+
|
|
359
|
+
**From type signatures:**
|
|
360
|
+
```python
|
|
361
|
+
# Reading: def refresh_token(token: str) -> TokenPair
|
|
362
|
+
# Contract: str → TokenPair (not str → Exception)
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
**From existing passing tests:**
|
|
366
|
+
```bash
|
|
367
|
+
# Run tests that touch Fix Zone files BEFORE the fix
|
|
368
|
+
# Each passing test = a behavioral contract that must be preserved
|
|
369
|
+
pytest tests/test_auth.py -v --tb=no 2>&1
|
|
370
|
+
# Output:
|
|
371
|
+
# test_login_valid_creds PASSED → contract: valid creds → token
|
|
372
|
+
# test_login_invalid_creds PASSED → contract: invalid creds → 401
|
|
373
|
+
# test_refresh_valid_token FAILED → THIS IS THE BUG
|
|
374
|
+
# test_refresh_expired_token PASSED → contract: expired → 401
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
**From API schemas/validators:**
|
|
378
|
+
```bash
|
|
379
|
+
# Check route definitions for response models
|
|
380
|
+
grep -A10 "@router.post.*refresh" backend/app/api/auth.py
|
|
381
|
+
# Check Pydantic models, Zod schemas, etc.
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
**From database constraints:**
|
|
385
|
+
```bash
|
|
386
|
+
# Check model definitions for invariants
|
|
387
|
+
grep -A20 "class.*Token\|class.*Session" backend/app/models/*.py
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
**3.2: Build the behavior contract table**
|
|
391
|
+
|
|
392
|
+
```markdown
|
|
393
|
+
## Behavior Contract — {bug description}
|
|
394
|
+
|
|
395
|
+
### Behaviors That MUST CHANGE (fix verification)
|
|
396
|
+
| Input | Current (broken) | Expected (after fix) | Test |
|
|
397
|
+
|-------|-----------------|---------------------|------|
|
|
398
|
+
| refresh("valid_token") | 500 Internal Server Error | 200 + new TokenPair | WRITE NEW |
|
|
399
|
+
| refresh("tampered_token") | 500 Internal Server Error | 401 Unauthorized | WRITE NEW |
|
|
400
|
+
|
|
401
|
+
### Behaviors That MUST NOT CHANGE (regression protection)
|
|
402
|
+
| Input | Current (correct) | After Fix (same) | Test |
|
|
403
|
+
|-------|------------------|------------------|------|
|
|
404
|
+
| login("user", "pass") | 200 + TokenPair | 200 + TokenPair | EXISTING: test_login_valid |
|
|
405
|
+
| login("user", "wrong") | 401 | 401 | EXISTING: test_login_invalid |
|
|
406
|
+
| refresh("expired_token") | 401 | 401 | EXISTING: test_refresh_expired |
|
|
407
|
+
| GET /me with valid token | 200 + User | 200 + User | EXISTING: test_get_me |
|
|
408
|
+
|
|
409
|
+
### Invariants (always true, before and after)
|
|
410
|
+
- Tokens table: every token has a user_id (FK constraint)
|
|
411
|
+
- Sessions table: expired sessions are never returned by get_active_session()
|
|
412
|
+
- Auth: no endpoint returns 200 without valid authentication
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
**3.3: Capture baseline test results**
|
|
416
|
+
|
|
417
|
+
```bash
|
|
418
|
+
# Run ALL tests and save results — this is the "before" snapshot
|
|
419
|
+
# for differential testing in Step 5
|
|
420
|
+
#
|
|
421
|
+
# Use the project's ACTUAL test commands from CLAUDE.md Test Commands table
|
|
422
|
+
# or project-profile.md testing conventions. Examples for common stacks:
|
|
423
|
+
#
|
|
424
|
+
# Python: pytest --tb=line -q
|
|
425
|
+
# Node: npm test -- --watchAll=false
|
|
426
|
+
# Go: go test ./... -count=1
|
|
427
|
+
# Rust: cargo test
|
|
428
|
+
# Ruby: bundle exec rspec --format progress
|
|
429
|
+
# Java: ./gradlew test
|
|
430
|
+
# Swift: swift test
|
|
431
|
+
# Flutter: flutter test
|
|
432
|
+
#
|
|
433
|
+
cd {project_root}
|
|
434
|
+
|
|
435
|
+
# Backend (use detected test command)
|
|
436
|
+
{backend_test_command} 2>&1 | tee /tmp/fix-baseline-backend.txt
|
|
437
|
+
|
|
438
|
+
# Frontend (if applicable, use detected test command)
|
|
439
|
+
{frontend_test_command} 2>&1 | tee /tmp/fix-baseline-frontend.txt
|
|
440
|
+
|
|
441
|
+
# Save pass/fail counts
|
|
442
|
+
echo "Baseline captured at $(date)" > .claude/.fix-baseline-summary.txt
|
|
443
|
+
grep -cE "passed|PASSED|ok|OK" /tmp/fix-baseline-backend.txt >> .claude/.fix-baseline-summary.txt || true
|
|
444
|
+
grep -cE "failed|FAILED|FAIL|ERROR" /tmp/fix-baseline-backend.txt >> .claude/.fix-baseline-summary.txt || true
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
Save to `.claude/.fix-behavior-contract.md` for the implementation and QA steps.
|
|
448
|
+
|
|
449
|
+
---
|
|
450
|
+
|
|
451
|
+
### Step 4: Implement the Fix
|
|
452
|
+
|
|
453
|
+
**Goal**: Apply the minimal fix within the scope lock, write regression tests.
|
|
454
|
+
|
|
455
|
+
**4.1: Determine implementation approach**
|
|
456
|
+
|
|
457
|
+
Based on severity:
|
|
458
|
+
|
|
459
|
+
| Severity | Approach |
|
|
460
|
+
|----------|----------|
|
|
461
|
+
| critical / --hotfix | Fix directly (no /planning, no team). Minimal change. |
|
|
462
|
+
| high | Fix directly with code-reviewer validation. |
|
|
463
|
+
| medium | Consider if `/planning` is needed for architectural changes. |
|
|
464
|
+
| low | Standard flow — may batch with other work. |
|
|
465
|
+
|
|
466
|
+
**4.2: Spawn implementation agent**
|
|
467
|
+
|
|
468
|
+
Select the right agent based on which layer the bug is in:
|
|
469
|
+
|
|
470
|
+
| Bug is in... | Spawn | subagent_type | Why |
|
|
471
|
+
|-------------|-------|--------------|-----|
|
|
472
|
+
| Backend (any language) | backend agent | `python-backend` | Adaptive — detects Python/Node/Go/Rust/Ruby/Java/Elixir at runtime |
|
|
473
|
+
| Frontend (any framework) | frontend agent | `frontend` | Adaptive — detects React/Vue/Svelte/Angular/etc. at runtime |
|
|
474
|
+
| Both layers | backend + frontend | Both agents | Scope lock keeps each in their zone |
|
|
475
|
+
| iOS/Android/Flutter/ML | custom agent (if /calibrate generated one) | Check `.claude/agents/` for project-specific agents | /calibrate creates these for non-web platforms |
|
|
476
|
+
| Unknown | general-purpose | `general-purpose` | Fallback — reads project-profile.md for context |
|
|
477
|
+
|
|
478
|
+
If `.claude/project-profile.md` exists, read it to determine the platform and pick the right agent.
|
|
479
|
+
If `/calibrate` generated custom agents (e.g., `ios-developer.md`), use those for platform-specific bugs.
|
|
480
|
+
|
|
481
|
+
**Agent prompt includes:**
|
|
482
|
+
```
|
|
483
|
+
1. Root cause analysis from Step 1
|
|
484
|
+
2. Scope lock from Step 2 (Fix Zone ONLY)
|
|
485
|
+
3. Behavior contract from Step 3
|
|
486
|
+
4. Project profile context (from .claude/project-profile.md if exists)
|
|
487
|
+
5. Knowledge base conventions (from .claude/knowledge/shared/conventions.md if exists)
|
|
488
|
+
6. Past incidents in affected files (from .claude/qa-knowledge/incidents/)
|
|
489
|
+
|
|
490
|
+
INSTRUCTIONS:
|
|
491
|
+
- You may ONLY modify files listed in the Fix Zone: {fix_zone_files}
|
|
492
|
+
- If you need to modify a file NOT in the Fix Zone, STOP and explain why
|
|
493
|
+
- The root cause is: {root_cause_description} at {file}:{line}
|
|
494
|
+
- Your fix must satisfy the Behavior Contract:
|
|
495
|
+
- All "MUST CHANGE" rows must work after your fix
|
|
496
|
+
- All "MUST NOT CHANGE" rows must still work after your fix
|
|
497
|
+
- Write regression tests that:
|
|
498
|
+
a) Test the "MUST CHANGE" behaviors (prove the bug is fixed)
|
|
499
|
+
b) Would FAIL if the fix were reverted (prove the test catches this bug)
|
|
500
|
+
- Keep changes minimal — this is a bug fix, not a refactor
|
|
501
|
+
- Follow the project's coding conventions from project-profile.md / knowledge base
|
|
502
|
+
- Use the project's test framework (detected from profile or CLAUDE.md, not assumed)
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
**4.3: Scope guard validation**
|
|
506
|
+
|
|
507
|
+
After the agent finishes, verify scope compliance:
|
|
508
|
+
|
|
509
|
+
```bash
|
|
510
|
+
# What files were actually modified?
|
|
511
|
+
CHANGED=$(git diff --name-only)
|
|
512
|
+
|
|
513
|
+
# Check each against scope lock
|
|
514
|
+
for file in $CHANGED; do
|
|
515
|
+
if echo "{fix_zone_files}" | grep -q "$file"; then
|
|
516
|
+
echo "✓ $file (in Fix Zone)"
|
|
517
|
+
elif echo "{watch_zone_files}" | grep -q "$file"; then
|
|
518
|
+
echo "⚠ $file (in Watch Zone — needs justification)"
|
|
519
|
+
else
|
|
520
|
+
echo "✗ $file (in FROZEN ZONE — VIOLATION)"
|
|
521
|
+
fi
|
|
522
|
+
done
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
If ANY Frozen Zone file was modified → **BLOCK** and require explanation.
|
|
526
|
+
If Watch Zone files were modified → **WARN** and require justification.
|
|
527
|
+
|
|
528
|
+
**4.4: Regression test validation (Mutation Testing)**
|
|
529
|
+
|
|
530
|
+
Verify the regression test actually catches the bug:
|
|
531
|
+
|
|
532
|
+
```bash
|
|
533
|
+
# 1. Save the fix
|
|
534
|
+
git diff > /tmp/fix.patch
|
|
535
|
+
|
|
536
|
+
# 2. Revert the fix temporarily
|
|
537
|
+
git checkout -- .
|
|
538
|
+
|
|
539
|
+
# 3. Run ONLY the new regression test — it MUST FAIL
|
|
540
|
+
pytest tests/test_auth_refresh_regression.py -v 2>&1
|
|
541
|
+
# Expected: FAIL (bug exists, test catches it)
|
|
542
|
+
|
|
543
|
+
# 4. Re-apply the fix
|
|
544
|
+
git apply /tmp/fix.patch
|
|
545
|
+
|
|
546
|
+
# 5. Run the regression test again — it MUST PASS
|
|
547
|
+
pytest tests/test_auth_refresh_regression.py -v 2>&1
|
|
548
|
+
# Expected: PASS (bug fixed, test confirms it)
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
**If the test passes both with and without the fix → the test is USELESS.** It doesn't
|
|
552
|
+
actually verify the bug. Reject it and write a better test.
|
|
553
|
+
|
|
554
|
+
**If the test fails both with and without the fix → the fix is BROKEN.** The fix doesn't
|
|
555
|
+
actually resolve the bug. Go back to Step 1.
|
|
556
|
+
|
|
557
|
+
Only valid result: **FAIL without fix, PASS with fix.**
|
|
558
|
+
|
|
559
|
+
---
|
|
560
|
+
|
|
561
|
+
### Step 4b: Review Swarm (Parallel Adversarial Review)
|
|
562
|
+
|
|
563
|
+
**Goal**: Two independent agents review the fix simultaneously from different angles — one
|
|
564
|
+
checks correctness, one attacks it. Their cross-examination produces a more reliable verdict
|
|
565
|
+
than a single reviewer could.
|
|
566
|
+
|
|
567
|
+
**Team: `fix-review-{slug}`**
|
|
568
|
+
|
|
569
|
+
Spawn these 2 agents in parallel:
|
|
570
|
+
|
|
571
|
+
| Agent | subagent_type | model | Role |
|
|
572
|
+
|-------|---------------|-------|------|
|
|
573
|
+
| fix-reviewer | code-reviewer | sonnet | 7-point correctness checklist |
|
|
574
|
+
| qa-attacker | qa-challenger | sonnet | Generate 3-5 attack scenarios against this specific fix |
|
|
575
|
+
|
|
576
|
+
**4b.1: Spawn fix-reviewer**
|
|
577
|
+
|
|
578
|
+
```
|
|
579
|
+
subagent_type: "code-reviewer"
|
|
580
|
+
model: "sonnet"
|
|
581
|
+
prompt: |
|
|
582
|
+
## Fix Review — Correctness Checklist
|
|
583
|
+
|
|
584
|
+
A bug fix has been implemented. Review it for correctness and completeness.
|
|
585
|
+
|
|
586
|
+
**Bug description**: {bug_description}
|
|
587
|
+
**Root cause**: {root_cause} at {file}:{line}
|
|
588
|
+
**Swarm verdict**: {convergence result from Step 1.3}
|
|
589
|
+
|
|
590
|
+
**Scope lock**:
|
|
591
|
+
- Fix Zone: {fix_zone_files}
|
|
592
|
+
- Watch Zone: {watch_zone_files}
|
|
593
|
+
|
|
594
|
+
**Behavior contract**:
|
|
595
|
+
{behavior_contract_table_from_step_3}
|
|
596
|
+
|
|
597
|
+
**The diff**:
|
|
598
|
+
Run `git diff` to see exactly what changed.
|
|
599
|
+
|
|
600
|
+
**Review checklist — answer each with ✓ or ✗ and explanation**:
|
|
601
|
+
|
|
602
|
+
1. **Root cause addressed?** Does this fix actually address the identified root cause,
|
|
603
|
+
or does it patch the symptom? Read the root cause, then read the diff — does the
|
|
604
|
+
change fix WHY the bug happened, not just WHERE it manifested?
|
|
605
|
+
|
|
606
|
+
2. **Complete fix?** Are there other code paths that have the same bug pattern?
|
|
607
|
+
Search for similar patterns in the codebase — the bug may exist in multiple places.
|
|
608
|
+
```bash
|
|
609
|
+
grep -rn "{pattern_from_root_cause}" --include="*.{ext}" | grep -v "{fixed_file}"
|
|
610
|
+
```
|
|
611
|
+
|
|
612
|
+
3. **Scope respected?** Are all changed files within the Fix Zone? Any Watch Zone
|
|
613
|
+
files touched without justification? Any Frozen Zone violations?
|
|
614
|
+
|
|
615
|
+
4. **Behavior contract honored?** For each "MUST NOT CHANGE" row — does the diff
|
|
616
|
+
risk changing that behavior? Trace each changed line's callers to check.
|
|
617
|
+
|
|
618
|
+
5. **Edge cases?** Does the fix handle:
|
|
619
|
+
- Null/undefined/empty inputs at the fix point?
|
|
620
|
+
- Concurrent access (if applicable)?
|
|
621
|
+
- Error paths (what if the fix itself throws)?
|
|
622
|
+
|
|
623
|
+
6. **Regression test quality?** Read the new test(s):
|
|
624
|
+
- Does the test actually exercise the bug scenario?
|
|
625
|
+
- Would the test fail if the fix were reverted? (Don't run it — reason about it)
|
|
626
|
+
- Does the test name clearly describe the bug it catches?
|
|
627
|
+
|
|
628
|
+
7. **Subtle issues?** Any of these:
|
|
629
|
+
- Type coercion or implicit conversion near the fix?
|
|
630
|
+
- Changed error messages that other code might match on?
|
|
631
|
+
- Modified function signatures that callers depend on?
|
|
632
|
+
- Performance implications (e.g., added a DB query in a hot path)?
|
|
633
|
+
|
|
634
|
+
**Output format**:
|
|
635
|
+
```
|
|
636
|
+
## Fix Review Result
|
|
637
|
+
|
|
638
|
+
| Check | Result | Notes |
|
|
639
|
+
|-------|--------|-------|
|
|
640
|
+
| Root cause addressed | ✓/✗ | {explanation} |
|
|
641
|
+
| Complete fix | ✓/✗ | {similar patterns found?} |
|
|
642
|
+
| Scope respected | ✓/✗ | {any violations?} |
|
|
643
|
+
| Behavior contract | ✓/✗ | {any risks?} |
|
|
644
|
+
| Edge cases | ✓/✗ | {any missing?} |
|
|
645
|
+
| Test quality | ✓/✗ | {assessment} |
|
|
646
|
+
| Subtle issues | ✓/✗ | {any found?} |
|
|
647
|
+
|
|
648
|
+
**Verdict**: APPROVE / REQUEST CHANGES / BLOCK
|
|
649
|
+
**Summary**: {1-2 sentence overall assessment}
|
|
650
|
+
{If REQUEST CHANGES or BLOCK: specific changes needed}
|
|
651
|
+
```
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
**4b.2: Spawn qa-attacker (in parallel with fix-reviewer)**
|
|
655
|
+
|
|
656
|
+
```
|
|
657
|
+
subagent_type: "qa-challenger"
|
|
658
|
+
model: "sonnet"
|
|
659
|
+
prompt: |
|
|
660
|
+
## Fix Attack — Adversarial QA
|
|
661
|
+
|
|
662
|
+
A bug fix has been implemented. Your job is to find ways it could fail or cause regressions.
|
|
663
|
+
Do NOT try to be fair — try to break it.
|
|
664
|
+
|
|
665
|
+
**Bug description**: {bug_description}
|
|
666
|
+
**Root cause**: {root_cause} at {file}:{line}
|
|
667
|
+
**The diff**: Run `git diff` to see exactly what changed.
|
|
668
|
+
|
|
669
|
+
Generate 3-5 attack scenarios targeting this specific fix. For each:
|
|
670
|
+
```
|
|
671
|
+
**Attack {N}**: {scenario name}
|
|
672
|
+
**Input / trigger**: {what causes this}
|
|
673
|
+
**Expected (correct)**: {what should happen}
|
|
674
|
+
**Attack outcome**: {what could go wrong with this fix}
|
|
675
|
+
**Severity**: HIGH / MEDIUM / LOW
|
|
676
|
+
**Exploits**: {which aspect of the fix creates this risk}
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
Focus attacks on:
|
|
680
|
+
- Inputs the fix doesn't handle (null, empty, boundary values)
|
|
681
|
+
- Concurrent or race conditions introduced
|
|
682
|
+
- Callers of the changed function with different usage patterns
|
|
683
|
+
- Side effects on Watch Zone files
|
|
684
|
+
- The regression test's blind spots (inputs not covered)
|
|
685
|
+
- Conditions where the fix itself could throw
|
|
686
|
+
```
|
|
687
|
+
|
|
688
|
+
**4b.3: Cross-examination (1 round after both complete)**
|
|
689
|
+
|
|
690
|
+
Orchestrator performs cross-examination:
|
|
691
|
+
|
|
692
|
+
1. Share fix-reviewer's verdict with qa-attacker:
|
|
693
|
+
"The fix-reviewer gave verdict {APPROVE/REQUEST CHANGES/BLOCK}. Do your attacks change their assessment? Which of your HIGH attacks did they miss?"
|
|
694
|
+
|
|
695
|
+
2. Share qa-attacker's attacks with fix-reviewer:
|
|
696
|
+
"The qa-attacker found these scenarios: {attacks}. Are any of these covered by your findings? Do any change your verdict?"
|
|
697
|
+
|
|
698
|
+
**4b.4: Verdict merge**
|
|
699
|
+
|
|
700
|
+
| fix-reviewer | qa-attacker | Merged Verdict |
|
|
701
|
+
|-------------|-------------|----------------|
|
|
702
|
+
| APPROVE | 0 HIGH attacks | APPROVE |
|
|
703
|
+
| APPROVE | 1+ HIGH attacks | REQUEST CHANGES |
|
|
704
|
+
| REQUEST CHANGES | any | REQUEST CHANGES (union of feedback) |
|
|
705
|
+
| BLOCK | any | BLOCK |
|
|
706
|
+
| APPROVE (after cross-exam) | attacks downgraded | APPROVE |
|
|
707
|
+
|
|
708
|
+
**4b.5: Handle merged verdict**
|
|
709
|
+
|
|
710
|
+
| Verdict | Action |
|
|
711
|
+
|---------|--------|
|
|
712
|
+
| **APPROVE** | Proceed to Step 5 (Differential Testing). |
|
|
713
|
+
| **REQUEST CHANGES** | Send combined feedback (checklist findings + unaddressed attacks) to the implementing agent. Re-run Step 4b after changes. Max 2 rounds — if not resolved, escalate to user. |
|
|
714
|
+
| **BLOCK** | **STOP.** Present the blocker to the user. Common blockers: fix addresses symptom not root cause, same bug pattern exists elsewhere unfixed, scope violation. |
|
|
715
|
+
|
|
716
|
+
**4b.6: Check for incomplete fixes (same pattern elsewhere)**
|
|
717
|
+
|
|
718
|
+
If fix-reviewer found similar patterns (check #2), decide:
|
|
719
|
+
|
|
720
|
+
```
|
|
721
|
+
Reviewer found the same bug pattern in 2 other files:
|
|
722
|
+
- backend/app/services/session.py:45 — same missing null check
|
|
723
|
+
- backend/app/services/token.py:78 — same missing null check
|
|
724
|
+
|
|
725
|
+
Options:
|
|
726
|
+
[1] Fix all instances now (expand Fix Zone)
|
|
727
|
+
[2] Fix only the reported bug, create issues for the others
|
|
728
|
+
[3] Ask user
|
|
729
|
+
```
|
|
730
|
+
|
|
731
|
+
Default to option 2 for `medium` severity. Default to option 1 for `critical`/`high`.
|
|
732
|
+
Always inform the user of the other instances regardless.
|
|
733
|
+
|
|
734
|
+
**Cost**: Two Sonnet agent calls + 1 cross-examination round (~2-4 min). The attacker
|
|
735
|
+
surfaces attack vectors the reviewer's structured checklist would miss.
|
|
736
|
+
|
|
737
|
+
**Skip conditions**: NOT skippable even in `--hotfix` mode. A bad fix shipped fast is worse
|
|
738
|
+
than a good fix shipped 2 minutes later. The fix-reviewer always runs; qa-attacker is dropped only in hotfix mode.
|
|
739
|
+
|
|
740
|
+
---
|
|
741
|
+
|
|
742
|
+
### Step 5: Differential Testing (Bisimulation Proof)
|
|
743
|
+
|
|
744
|
+
**Goal**: Prove the fix changes ONLY bug behavior, nothing else.
|
|
745
|
+
|
|
746
|
+
**5.1: Run full test suite after fix**
|
|
747
|
+
|
|
748
|
+
```bash
|
|
749
|
+
# Use the SAME test commands as the baseline capture (Step 3.3)
|
|
750
|
+
# Backend (detected test command)
|
|
751
|
+
{backend_test_command} 2>&1 | tee /tmp/fix-after-backend.txt
|
|
752
|
+
|
|
753
|
+
# Frontend (if applicable, detected test command)
|
|
754
|
+
{frontend_test_command} 2>&1 | tee /tmp/fix-after-frontend.txt
|
|
755
|
+
```
|
|
756
|
+
|
|
757
|
+
**5.2: Diff against baseline**
|
|
758
|
+
|
|
759
|
+
```bash
|
|
760
|
+
# Compare before vs after
|
|
761
|
+
diff /tmp/fix-baseline-backend.txt /tmp/fix-after-backend.txt
|
|
762
|
+
```
|
|
763
|
+
|
|
764
|
+
**Expected results:**
|
|
765
|
+
|
|
766
|
+
| Change | Meaning | Action |
|
|
767
|
+
|--------|---------|--------|
|
|
768
|
+
| FAIL → PASS (bug tests) | Bug is fixed | ✓ Expected |
|
|
769
|
+
| New tests PASS | Regression tests work | ✓ Expected |
|
|
770
|
+
| No change (all other tests) | No side effects | ✓ Expected |
|
|
771
|
+
| PASS → FAIL (unrelated test) | **FIX HAS SIDE EFFECTS** | ✗ Investigate — fix broke something else |
|
|
772
|
+
| PASS → FAIL (related test) | Fix may be incomplete or wrong | ✗ Investigate — may need broader fix |
|
|
773
|
+
|
|
774
|
+
**If any PASS → FAIL**: The fix is NOT safe. Either:
|
|
775
|
+
- The fix introduced a new bug (scope violation)
|
|
776
|
+
- The fix changed behavior that something else depends on (contract violation)
|
|
777
|
+
- An existing test was fragile/flaky (investigate)
|
|
778
|
+
|
|
779
|
+
**Do NOT proceed to PR until all PASS→FAIL cases are resolved.**
|
|
780
|
+
|
|
781
|
+
**5.3: Behavior contract verification**
|
|
782
|
+
|
|
783
|
+
Check each row of the behavior contract table:
|
|
784
|
+
|
|
785
|
+
```
|
|
786
|
+
✓ MUST CHANGE: refresh("valid_token") → 200 + TokenPair (was 500)
|
|
787
|
+
✓ MUST CHANGE: refresh("tampered_token") → 401 (was 500)
|
|
788
|
+
✓ MUST NOT CHANGE: login("user", "pass") → 200 + TokenPair (unchanged)
|
|
789
|
+
✓ MUST NOT CHANGE: login("user", "wrong") → 401 (unchanged)
|
|
790
|
+
✓ MUST NOT CHANGE: refresh("expired_token") → 401 (unchanged)
|
|
791
|
+
✓ MUST NOT CHANGE: GET /me → 200 + User (unchanged)
|
|
792
|
+
✓ INVARIANT: All tokens have user_id (FK intact)
|
|
793
|
+
```
|
|
794
|
+
|
|
795
|
+
---
|
|
796
|
+
|
|
797
|
+
### Step 6: Post-Fix Workflow
|
|
798
|
+
|
|
799
|
+
After all verification steps pass, this is the coordinated handoff to PR. No redundant
|
|
800
|
+
QA runs — Step 5 already ran the full test suite for differential testing.
|
|
801
|
+
|
|
802
|
+
#### 6.1: Ask user what QA level to run
|
|
803
|
+
|
|
804
|
+
Step 5 ran the full test suite for differential comparison, but that's not the same
|
|
805
|
+
as a proper QA pass. Ask the user:
|
|
806
|
+
|
|
807
|
+
```
|
|
808
|
+
Fix verified. What level of QA should I run before PR?
|
|
809
|
+
|
|
810
|
+
[1] commit — targeted checks on changed files only (~1-3 min)
|
|
811
|
+
[2] full — comprehensive checks across full codebase (~10-20 min)
|
|
812
|
+
[3] skip — differential test was enough, go straight to PR
|
|
813
|
+
|
|
814
|
+
Default: commit (recommended — catches issues differential testing misses like lint, types, domain rules)
|
|
815
|
+
```
|
|
816
|
+
|
|
817
|
+
Store choice as `QA_LEVEL`.
|
|
818
|
+
|
|
819
|
+
#### 6.2: Run /qa at chosen level
|
|
820
|
+
|
|
821
|
+
If user chose `skip`, skip to Step 6.3.
|
|
822
|
+
|
|
823
|
+
Otherwise, invoke `/qa {QA_LEVEL}` via the Skill tool:
|
|
824
|
+
|
|
825
|
+
1. Run `/qa {QA_LEVEL}`
|
|
826
|
+
2. **If QA fails** — show failures. Ask: "Fix these? [yes / skip / abort]"
|
|
827
|
+
- `yes` → fix issues, re-run QA
|
|
828
|
+
- `skip` → proceed (user takes responsibility)
|
|
829
|
+
- `abort` → stop
|
|
830
|
+
3. **If QA passes** — continue
|
|
831
|
+
|
|
832
|
+
Record QA results as `QA_RESULT` for the PR body.
|
|
833
|
+
|
|
834
|
+
#### 6.3: Restart local servers and ask user to test
|
|
835
|
+
|
|
836
|
+
**Check if local services exist** — read CLAUDE.md `## Local Dev Services` table.
|
|
837
|
+
|
|
838
|
+
If the table exists and has entries:
|
|
839
|
+
- Restart services using the Start Command from each row
|
|
840
|
+
- Or invoke `/restart` if the project has that skill configured
|
|
841
|
+
|
|
842
|
+
After restart (or if no local services), ask the user:
|
|
843
|
+
|
|
844
|
+
```
|
|
845
|
+
Local servers restarted. Please test the fix manually — verify the bug is gone
|
|
846
|
+
and nothing else broke.
|
|
847
|
+
|
|
848
|
+
When you're done:
|
|
849
|
+
[ready] — looks good, proceed to PR
|
|
850
|
+
[issues] — found problems (describe them)
|
|
851
|
+
```
|
|
852
|
+
|
|
853
|
+
**If `issues`**: Address problems, re-run `/qa commit` only, ask again.
|
|
854
|
+
**If `ready`**: Proceed to Step 6.4.
|
|
855
|
+
|
|
856
|
+
#### 6.4: Create PR via /pr --skip-qa
|
|
857
|
+
|
|
858
|
+
Invoke `/pr --skip-qa` with bug-specific PR content. The `--skip-qa` flag tells /pr
|
|
859
|
+
to skip its own `/qa commit` since QA already ran in Step 6.2.
|
|
860
|
+
|
|
861
|
+
/pr will only:
|
|
862
|
+
1. Run a **quick sanity check** (lint + type check only — no full QA)
|
|
863
|
+
2. Stage and commit
|
|
864
|
+
3. Find or create GitHub issue
|
|
865
|
+
4. Push to feature branch
|
|
866
|
+
5. Open PR with the bug fix template below
|
|
867
|
+
6. Return PR URL
|
|
868
|
+
|
|
869
|
+
**PR template for bug fixes (passed to /pr):**
|
|
870
|
+
```markdown
|
|
871
|
+
## Bug Fix: {title}
|
|
872
|
+
|
|
873
|
+
**Severity**: {critical|high|medium|low}
|
|
874
|
+
**Root Cause**: {precise description from Step 1}
|
|
875
|
+
**Location**: {file}:{line}
|
|
876
|
+
|
|
877
|
+
### What was broken
|
|
878
|
+
{Description of the bug behavior}
|
|
879
|
+
|
|
880
|
+
### Why it was broken
|
|
881
|
+
{Root cause explanation — what assumption was violated}
|
|
882
|
+
|
|
883
|
+
### What this fix does
|
|
884
|
+
{Description of the changes — minimal, precise}
|
|
885
|
+
|
|
886
|
+
### Scope
|
|
887
|
+
- Fix Zone: {files modified}
|
|
888
|
+
- Watch Zone: {files checked but not modified}
|
|
889
|
+
- Frozen Zone: {verified untouched}
|
|
890
|
+
|
|
891
|
+
### Behavior Contract
|
|
892
|
+
| Behavior | Before | After |
|
|
893
|
+
|----------|--------|-------|
|
|
894
|
+
| {bug behavior} | {broken} | {fixed} |
|
|
895
|
+
| {preserved behavior} | {same} | {same} |
|
|
896
|
+
|
|
897
|
+
### Test Evidence
|
|
898
|
+
- Root cause: investigation swarm converged (Step 1.3) — {convergence type}
|
|
899
|
+
- Fix review: approved by review swarm (Step 4b) — fix-reviewer + qa-attacker
|
|
900
|
+
- Regression test: `{test_file}::{test_name}`
|
|
901
|
+
- ✓ Fails without fix (catches the bug)
|
|
902
|
+
- ✓ Passes with fix (confirms the fix)
|
|
903
|
+
- Differential test: {N} tests unchanged, {M} tests fixed, 0 regressions
|
|
904
|
+
- QA: {QA_LEVEL} mode — {QA_RESULT summary}
|
|
905
|
+
- User testing: confirmed manually
|
|
906
|
+
|
|
907
|
+
### Rollback Plan
|
|
908
|
+
{How to revert if this fix causes problems — typically: revert this commit}
|
|
909
|
+
|
|
910
|
+
Closes #{issue_number}
|
|
911
|
+
```
|
|
912
|
+
|
|
913
|
+
#### 6.5: Ask what's next
|
|
914
|
+
|
|
915
|
+
```
|
|
916
|
+
PR #{number} created: {url}
|
|
917
|
+
|
|
918
|
+
What's next?
|
|
919
|
+
[1] Fix another bug — /fix #N or /fix <description>
|
|
920
|
+
[2] Start a feature — /planning <feature>
|
|
921
|
+
[3] See project status — /onboard
|
|
922
|
+
[4] Done for now
|
|
923
|
+
```
|
|
924
|
+
|
|
925
|
+
If autopilot is active, skip this and continue the loop.
|
|
926
|
+
|
|
927
|
+
---
|
|
928
|
+
|
|
929
|
+
### Step 7: Knowledge Base Update
|
|
930
|
+
|
|
931
|
+
After the PR is created, update the knowledge base:
|
|
932
|
+
|
|
933
|
+
**Create incident record:**
|
|
934
|
+
```markdown
|
|
935
|
+
# .claude/qa-knowledge/incidents/{date}-{slug}.md
|
|
936
|
+
---
|
|
937
|
+
status: covered
|
|
938
|
+
severity: {severity}
|
|
939
|
+
affected_files: [{file1}, {file2}]
|
|
940
|
+
root_cause: {description}
|
|
941
|
+
fix_pr: #{pr_number}
|
|
942
|
+
regression_test: {test_file}::{test_name}
|
|
943
|
+
created: {date}
|
|
944
|
+
---
|
|
945
|
+
|
|
946
|
+
## What happened
|
|
947
|
+
{Bug description}
|
|
948
|
+
|
|
949
|
+
## Root cause
|
|
950
|
+
{From Step 1}
|
|
951
|
+
|
|
952
|
+
## How QA missed it
|
|
953
|
+
{Why existing tests didn't catch this}
|
|
954
|
+
|
|
955
|
+
## Prevention
|
|
956
|
+
{What kind of test would have prevented this}
|
|
957
|
+
```
|
|
958
|
+
|
|
959
|
+
**Update bug patterns:**
|
|
960
|
+
```bash
|
|
961
|
+
# Append to .claude/qa-knowledge/bug-patterns.md
|
|
962
|
+
echo "### {date} — {title}" >> .claude/qa-knowledge/bug-patterns.md
|
|
963
|
+
echo "- Area: {affected_area}" >> .claude/qa-knowledge/bug-patterns.md
|
|
964
|
+
echo "- Pattern: {root_cause_pattern}" >> .claude/qa-knowledge/bug-patterns.md
|
|
965
|
+
echo "- Prevention: {test_type}" >> .claude/qa-knowledge/bug-patterns.md
|
|
966
|
+
```
|
|
967
|
+
|
|
968
|
+
**Update knowledge base** (if `.claude/knowledge/` exists):
|
|
969
|
+
- Append to `shared/conventions.md` if the bug revealed a coding convention violation
|
|
970
|
+
- Append to `shared/domain.md` if the bug revealed a business rule not in code
|
|
971
|
+
- Append to `agents/{agent-name}.md` if the implementing agent learned something
|
|
972
|
+
|
|
973
|
+
---
|
|
974
|
+
|
|
975
|
+
## Hotfix Mode (--hotfix)
|
|
976
|
+
|
|
977
|
+
For critical production bugs, the pipeline is compressed:
|
|
978
|
+
|
|
979
|
+
| Step | Standard | Hotfix |
|
|
980
|
+
|------|----------|--------|
|
|
981
|
+
| 1. Root Cause | Investigation Swarm (3 agents, debate) | Single backward-tracer (Sonnet, 5 min max) |
|
|
982
|
+
| 2. Scope Lock | Full dependency graph | Direct file only — hop 0-1 |
|
|
983
|
+
| 3. Behavior Contract | Full table | Bug behavior + 3 critical paths only |
|
|
984
|
+
| 4. Implement | Spawn agent team | Fix directly — single agent |
|
|
985
|
+
| 4b. Fix Review | Review Swarm (2 agents, cross-examine) | Single fix-reviewer (no cross-examine) |
|
|
986
|
+
| 5. Differential Test | Full suite | Critical path tests only |
|
|
987
|
+
| 6. PR | Full template | Abbreviated — merge fast |
|
|
988
|
+
| 7. Knowledge Base | Full update | Post-merge (don't block the fix) |
|
|
989
|
+
|
|
990
|
+
Hotfix STILL requires:
|
|
991
|
+
- Root cause identified (not guessed)
|
|
992
|
+
- Fix review passed (Step 4b — never skipped, even in hotfix)
|
|
993
|
+
- Regression test written
|
|
994
|
+
- Regression test passes mutation check (fails without fix, passes with)
|
|
995
|
+
- No PASS→FAIL in critical paths
|
|
996
|
+
- Post-merge: deferred investigation swarm runs automatically. If the swarm disagrees with the hotfix root cause, a follow-up GitHub issue is created.
|
|
997
|
+
|
|
998
|
+
---
|
|
999
|
+
|
|
1000
|
+
## Severity Routing
|
|
1001
|
+
|
|
1002
|
+
| Severity | QA Mode | Review | Merge |
|
|
1003
|
+
|----------|---------|--------|-------|
|
|
1004
|
+
| critical | Full QA + critical paths + E2E | Bug-specific + SRE review | Expedited |
|
|
1005
|
+
| high | Full QA | Bug-specific review | Standard |
|
|
1006
|
+
| medium | Commit mode QA | Standard review | Standard |
|
|
1007
|
+
| low | Commit mode QA | Standard review | Batched |
|
|
1008
|
+
|
|
1009
|
+
---
|
|
1010
|
+
|
|
1011
|
+
## Cost Analysis
|
|
1012
|
+
|
|
1013
|
+
| Mode | Agents | Estimated Cost | When |
|
|
1014
|
+
|------|--------|---------------|------|
|
|
1015
|
+
| Hotfix (investigation) | 1 Sonnet backward-tracer | ~$0.005 | `--hotfix` flag |
|
|
1016
|
+
| Quick (Lite) | 1 Sonnet analyst | ~$0.007 | Simple / obvious bug |
|
|
1017
|
+
| Verified (Lite swarm) | 1 Sonnet analyst + 1 Sonnet verifier | ~$0.014 | Moderate bugs |
|
|
1018
|
+
| Full Swarm (investigation) | 2 Sonnet + 1 Haiku + debate rounds | ~$0.045 | Complex / unclear bugs |
|
|
1019
|
+
| Review Swarm (hotfix) | 1 Sonnet fix-reviewer | ~$0.006 | `--hotfix` fix review |
|
|
1020
|
+
| Review Swarm (standard) | 2 Sonnet + cross-exam | ~$0.018 | Standard fix review |
|
|
1021
|
+
| **Full pipeline (standard)** | **All of the above** | **~$0.08 average** | **Default** |
|
|
1022
|
+
| **Full pipeline (hotfix)** | **Compressed** | **~$0.021** | **`--hotfix`** |
|
|
1023
|
+
|
|
1024
|
+
Delta from previous single-agent pattern: ~3.8x more per full pipeline run.
|
|
1025
|
+
One prevented misdiagnosis (wrong root cause → wrong fix → debugging cycle → re-fix) saves
|
|
1026
|
+
the entire investigation and implementation time — the swarm pays for itself on the first catch.
|
|
1027
|
+
|
|
1028
|
+
---
|
|
1029
|
+
|
|
1030
|
+
## Rules
|
|
1031
|
+
|
|
1032
|
+
- **Never fix without understanding.** The root cause MUST be identified before any code change.
|
|
1033
|
+
"I'm not sure why this fixes it but it works" is NOT acceptable.
|
|
1034
|
+
- **Root cause must be swarm-verified.** Step 1.3 uses competing investigators to converge
|
|
1035
|
+
on the diagnosis. If investigators cannot converge, the user decides — don't guess.
|
|
1036
|
+
- **Investigation swarm runs 3 rounds maximum.** If no convergence after Round 3, escalate
|
|
1037
|
+
to user with all competing hypotheses. Never proceed on an unresolved hypothesis.
|
|
1038
|
+
- **Every hypothesis must cite file:line evidence.** Claims without code citations score zero.
|
|
1039
|
+
Agents that submit hypotheses without evidence are disregarded in scoring.
|
|
1040
|
+
- **Every fix gets a review swarm.** Step 4b is NEVER skipped, even in hotfix mode.
|
|
1041
|
+
A bad fix shipped fast is worse than a good fix shipped 2 minutes later.
|
|
1042
|
+
- **Review swarm verdict requires agreement or explicit merge.** The verdict merge table
|
|
1043
|
+
in Step 4b.4 governs — do not improvise verdict logic.
|
|
1044
|
+
- **Hotfix always queues deferred investigation swarm for post-merge verification.** If the
|
|
1045
|
+
swarm disagrees with the hotfix root cause, create a follow-up GitHub issue.
|
|
1046
|
+
- **Scope lock is mandatory.** Every fix has a Fix Zone and a Frozen Zone. No exceptions.
|
|
1047
|
+
- **Behavior contract is mandatory.** You must know what changes and what doesn't BEFORE fixing.
|
|
1048
|
+
- **Regression test must pass mutation check.** If the test passes without the fix, it's useless.
|
|
1049
|
+
- **Differential test must show zero unexpected changes.** Any PASS→FAIL blocks the PR.
|
|
1050
|
+
- **Minimal changes only.** A bug fix is not a refactor. Touch the least code possible.
|
|
1051
|
+
- **Knowledge base update is not optional.** Every bug teaches something. Capture it.
|
|
1052
|
+
- **Similar past bugs must be checked.** The knowledge base exists for a reason.
|
|
1053
|
+
- **Hotfix still requires proof.** Speed doesn't mean skipping correctness — it means
|
|
1054
|
+
compressing the pipeline, not removing steps.
|
|
1055
|
+
- **Language-agnostic.** All examples use Python/pytest for illustration. Adapt commands
|
|
1056
|
+
to the project's actual stack: `npm test`/`jest`/`vitest` for Node, `go test ./...` for Go,
|
|
1057
|
+
`cargo test` for Rust, `dotnet test` for C#, `swift test` for Swift. Read CLAUDE.md
|
|
1058
|
+
Test Commands table for the project's actual commands.
|