autonomous-coding-toolkit 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.
Files changed (324) hide show
  1. package/.claude-plugin/marketplace.json +22 -0
  2. package/.claude-plugin/plugin.json +13 -0
  3. package/LICENSE +21 -0
  4. package/Makefile +21 -0
  5. package/README.md +140 -0
  6. package/SECURITY.md +28 -0
  7. package/agents/bash-expert.md +113 -0
  8. package/agents/dependency-auditor.md +138 -0
  9. package/agents/integration-tester.md +120 -0
  10. package/agents/lesson-scanner.md +149 -0
  11. package/agents/python-expert.md +179 -0
  12. package/agents/service-monitor.md +141 -0
  13. package/agents/shell-expert.md +147 -0
  14. package/benchmarks/runner.sh +147 -0
  15. package/benchmarks/tasks/01-rest-endpoint/rubric.sh +29 -0
  16. package/benchmarks/tasks/01-rest-endpoint/task.md +17 -0
  17. package/benchmarks/tasks/02-refactor-module/task.md +8 -0
  18. package/benchmarks/tasks/03-fix-integration-bug/task.md +8 -0
  19. package/benchmarks/tasks/04-add-test-coverage/task.md +8 -0
  20. package/benchmarks/tasks/05-multi-file-feature/task.md +8 -0
  21. package/bin/act.js +238 -0
  22. package/commands/autocode.md +6 -0
  23. package/commands/cancel-ralph.md +18 -0
  24. package/commands/code-factory.md +53 -0
  25. package/commands/create-prd.md +55 -0
  26. package/commands/ralph-loop.md +18 -0
  27. package/commands/run-plan.md +117 -0
  28. package/commands/submit-lesson.md +122 -0
  29. package/docs/ARCHITECTURE.md +630 -0
  30. package/docs/CONTRIBUTING.md +125 -0
  31. package/docs/lessons/0001-bare-exception-swallowing.md +34 -0
  32. package/docs/lessons/0002-async-def-without-await.md +28 -0
  33. package/docs/lessons/0003-create-task-without-callback.md +28 -0
  34. package/docs/lessons/0004-hardcoded-test-counts.md +28 -0
  35. package/docs/lessons/0005-sqlite-without-closing.md +33 -0
  36. package/docs/lessons/0006-venv-pip-path.md +27 -0
  37. package/docs/lessons/0007-runner-state-self-rejection.md +35 -0
  38. package/docs/lessons/0008-quality-gate-blind-spot.md +33 -0
  39. package/docs/lessons/0009-parser-overcount-empty-batches.md +36 -0
  40. package/docs/lessons/0010-local-outside-function-bash.md +33 -0
  41. package/docs/lessons/0011-batch-tests-for-unimplemented-code.md +36 -0
  42. package/docs/lessons/0012-api-markdown-unescaped-chars.md +33 -0
  43. package/docs/lessons/0013-export-prefix-env-parsing.md +33 -0
  44. package/docs/lessons/0014-decorator-registry-import-side-effect.md +43 -0
  45. package/docs/lessons/0015-frontend-backend-schema-drift.md +43 -0
  46. package/docs/lessons/0016-event-driven-cold-start-seeding.md +44 -0
  47. package/docs/lessons/0017-copy-paste-logic-diverges.md +43 -0
  48. package/docs/lessons/0018-layer-passes-pipeline-broken.md +45 -0
  49. package/docs/lessons/0019-systemd-envfile-ignores-export.md +41 -0
  50. package/docs/lessons/0020-persist-state-incrementally.md +44 -0
  51. package/docs/lessons/0021-dual-axis-testing.md +48 -0
  52. package/docs/lessons/0022-jsx-factory-shadowing.md +43 -0
  53. package/docs/lessons/0023-static-analysis-spiral.md +51 -0
  54. package/docs/lessons/0024-shared-pipeline-implementation.md +55 -0
  55. package/docs/lessons/0025-defense-in-depth-all-entry-points.md +65 -0
  56. package/docs/lessons/0026-linter-no-rules-false-enforcement.md +54 -0
  57. package/docs/lessons/0027-jsx-silent-prop-drop.md +64 -0
  58. package/docs/lessons/0028-no-infrastructure-in-client-code.md +49 -0
  59. package/docs/lessons/0029-never-write-secrets-to-files.md +61 -0
  60. package/docs/lessons/0030-cache-merge-not-replace.md +62 -0
  61. package/docs/lessons/0031-verify-units-at-boundaries.md +66 -0
  62. package/docs/lessons/0032-module-lifecycle-subscribe-unsubscribe.md +89 -0
  63. package/docs/lessons/0033-async-iteration-mutable-snapshot.md +72 -0
  64. package/docs/lessons/0034-caller-missing-await-silent-discard.md +65 -0
  65. package/docs/lessons/0035-duplicate-registration-silent-overwrite.md +85 -0
  66. package/docs/lessons/0036-websocket-dirty-disconnect.md +33 -0
  67. package/docs/lessons/0037-parallel-agents-worktree-corruption.md +31 -0
  68. package/docs/lessons/0038-subscribe-no-stored-ref.md +36 -0
  69. package/docs/lessons/0039-fallback-or-default-hides-bugs.md +34 -0
  70. package/docs/lessons/0040-event-firehose-filter-first.md +36 -0
  71. package/docs/lessons/0041-ambiguous-base-dir-path-nesting.md +32 -0
  72. package/docs/lessons/0042-spec-compliance-insufficient.md +36 -0
  73. package/docs/lessons/0043-exact-count-extensible-collections.md +32 -0
  74. package/docs/lessons/0044-relative-file-deps-worktree.md +39 -0
  75. package/docs/lessons/0045-iterative-design-improvement.md +33 -0
  76. package/docs/lessons/0046-plan-assertion-math-bugs.md +38 -0
  77. package/docs/lessons/0047-pytest-single-threaded-default.md +37 -0
  78. package/docs/lessons/0048-integration-wiring-batch.md +40 -0
  79. package/docs/lessons/0049-ab-verification.md +41 -0
  80. package/docs/lessons/0050-editing-sourced-files-during-execution.md +33 -0
  81. package/docs/lessons/0051-infrastructure-fixes-cant-self-heal.md +30 -0
  82. package/docs/lessons/0052-uncommitted-changes-poison-quality-gates.md +31 -0
  83. package/docs/lessons/0053-jq-compact-flag-inconsistency.md +31 -0
  84. package/docs/lessons/0054-parser-matches-inside-code-blocks.md +30 -0
  85. package/docs/lessons/0055-agents-compensate-for-garbled-prompts.md +31 -0
  86. package/docs/lessons/0056-grep-count-exit-code-on-zero.md +42 -0
  87. package/docs/lessons/0057-new-artifacts-break-git-clean-gates.md +42 -0
  88. package/docs/lessons/0058-dead-config-keys-never-consumed.md +49 -0
  89. package/docs/lessons/0059-contract-test-shared-structures.md +53 -0
  90. package/docs/lessons/0060-set-e-silent-death-in-runners.md +53 -0
  91. package/docs/lessons/0061-context-injection-dirty-state.md +50 -0
  92. package/docs/lessons/0062-sibling-bug-neighborhood-scan.md +29 -0
  93. package/docs/lessons/0063-one-flag-two-lifetimes.md +31 -0
  94. package/docs/lessons/0064-test-passes-wrong-reason.md +31 -0
  95. package/docs/lessons/0065-pipefail-grep-count-double-output.md +39 -0
  96. package/docs/lessons/0066-local-keyword-outside-function.md +37 -0
  97. package/docs/lessons/0067-stdin-hang-non-interactive-shell.md +36 -0
  98. package/docs/lessons/0068-agent-builds-wrong-thing-correctly.md +31 -0
  99. package/docs/lessons/0069-plan-quality-dominates-execution.md +30 -0
  100. package/docs/lessons/0070-spec-echo-back-prevents-drift.md +31 -0
  101. package/docs/lessons/0071-positive-instructions-outperform-negative.md +30 -0
  102. package/docs/lessons/0072-lost-in-the-middle-context-placement.md +30 -0
  103. package/docs/lessons/0073-unscoped-lessons-cause-false-positives.md +30 -0
  104. package/docs/lessons/0074-stale-context-injection-wrong-batch.md +32 -0
  105. package/docs/lessons/0075-research-artifacts-must-persist.md +32 -0
  106. package/docs/lessons/0076-wrong-decomposition-contaminates-downstream.md +30 -0
  107. package/docs/lessons/0077-cherry-pick-merges-need-manual-resolution.md +30 -0
  108. package/docs/lessons/0078-static-review-without-live-test.md +30 -0
  109. package/docs/lessons/0079-integration-wiring-batch-required.md +32 -0
  110. package/docs/lessons/FRAMEWORK.md +161 -0
  111. package/docs/lessons/SUMMARY.md +201 -0
  112. package/docs/lessons/TEMPLATE.md +85 -0
  113. package/docs/plans/2026-02-21-code-factory-v2-design.md +204 -0
  114. package/docs/plans/2026-02-21-code-factory-v2-implementation-plan.md +2189 -0
  115. package/docs/plans/2026-02-21-code-factory-v2-phase4-design.md +537 -0
  116. package/docs/plans/2026-02-21-code-factory-v2-phase4-implementation-plan.md +2012 -0
  117. package/docs/plans/2026-02-21-hardening-pass-design.md +108 -0
  118. package/docs/plans/2026-02-21-hardening-pass-plan.md +1378 -0
  119. package/docs/plans/2026-02-21-mab-research-report.md +406 -0
  120. package/docs/plans/2026-02-21-marketplace-restructure-design.md +240 -0
  121. package/docs/plans/2026-02-21-marketplace-restructure-plan.md +832 -0
  122. package/docs/plans/2026-02-21-phase4-completion-plan.md +697 -0
  123. package/docs/plans/2026-02-21-validator-suite-design.md +148 -0
  124. package/docs/plans/2026-02-21-validator-suite-plan.md +540 -0
  125. package/docs/plans/2026-02-22-mab-research-round2.md +556 -0
  126. package/docs/plans/2026-02-22-mab-run-design.md +462 -0
  127. package/docs/plans/2026-02-22-mab-run-plan.md +2046 -0
  128. package/docs/plans/2026-02-22-operations-design-methodology-research.md +681 -0
  129. package/docs/plans/2026-02-22-research-agent-failure-taxonomy.md +532 -0
  130. package/docs/plans/2026-02-22-research-code-guideline-policies.md +886 -0
  131. package/docs/plans/2026-02-22-research-codebase-audit-refactoring.md +908 -0
  132. package/docs/plans/2026-02-22-research-coding-standards-documentation.md +541 -0
  133. package/docs/plans/2026-02-22-research-competitive-landscape.md +687 -0
  134. package/docs/plans/2026-02-22-research-comprehensive-testing.md +1076 -0
  135. package/docs/plans/2026-02-22-research-context-utilization.md +459 -0
  136. package/docs/plans/2026-02-22-research-cost-quality-tradeoff.md +548 -0
  137. package/docs/plans/2026-02-22-research-lesson-transferability.md +508 -0
  138. package/docs/plans/2026-02-22-research-multi-agent-coordination.md +312 -0
  139. package/docs/plans/2026-02-22-research-phase-integration.md +602 -0
  140. package/docs/plans/2026-02-22-research-plan-quality.md +428 -0
  141. package/docs/plans/2026-02-22-research-prompt-engineering.md +558 -0
  142. package/docs/plans/2026-02-22-research-unconventional-perspectives.md +528 -0
  143. package/docs/plans/2026-02-22-research-user-adoption.md +638 -0
  144. package/docs/plans/2026-02-22-research-verification-effectiveness.md +433 -0
  145. package/docs/plans/2026-02-23-agent-suite-design.md +299 -0
  146. package/docs/plans/2026-02-23-agent-suite-plan.md +578 -0
  147. package/docs/plans/2026-02-23-phase3-cost-infrastructure-design.md +148 -0
  148. package/docs/plans/2026-02-23-phase3-cost-infrastructure-plan.md +1062 -0
  149. package/docs/plans/2026-02-23-research-bash-expert-agent.md +543 -0
  150. package/docs/plans/2026-02-23-research-dependency-auditor-agent.md +564 -0
  151. package/docs/plans/2026-02-23-research-improving-existing-agents.md +503 -0
  152. package/docs/plans/2026-02-23-research-integration-tester-agent.md +454 -0
  153. package/docs/plans/2026-02-23-research-python-expert-agent.md +429 -0
  154. package/docs/plans/2026-02-23-research-service-monitor-agent.md +425 -0
  155. package/docs/plans/2026-02-23-research-shell-expert-agent.md +533 -0
  156. package/docs/plans/2026-02-23-roadmap-to-completion.md +530 -0
  157. package/docs/plans/2026-02-24-headless-module-split-design.md +98 -0
  158. package/docs/plans/2026-02-24-headless-module-split.md +443 -0
  159. package/docs/plans/2026-02-24-lesson-scope-metadata-design.md +228 -0
  160. package/docs/plans/2026-02-24-lesson-scope-metadata-plan.md +968 -0
  161. package/docs/plans/2026-02-24-npm-packaging-design.md +841 -0
  162. package/docs/plans/2026-02-24-npm-packaging-plan.md +1965 -0
  163. package/docs/plans/audit-findings.md +186 -0
  164. package/docs/telegram-notification-format.md +98 -0
  165. package/examples/example-plan.md +51 -0
  166. package/examples/example-prd.json +72 -0
  167. package/examples/example-roadmap.md +33 -0
  168. package/examples/quickstart-plan.md +63 -0
  169. package/hooks/hooks.json +26 -0
  170. package/hooks/setup-symlinks.sh +48 -0
  171. package/hooks/stop-hook.sh +135 -0
  172. package/package.json +47 -0
  173. package/policies/bash.md +71 -0
  174. package/policies/python.md +71 -0
  175. package/policies/testing.md +61 -0
  176. package/policies/universal.md +60 -0
  177. package/scripts/analyze-report.sh +97 -0
  178. package/scripts/architecture-map.sh +145 -0
  179. package/scripts/auto-compound.sh +273 -0
  180. package/scripts/batch-audit.sh +42 -0
  181. package/scripts/batch-test.sh +101 -0
  182. package/scripts/entropy-audit.sh +221 -0
  183. package/scripts/failure-digest.sh +51 -0
  184. package/scripts/generate-ast-rules.sh +96 -0
  185. package/scripts/init.sh +112 -0
  186. package/scripts/lesson-check.sh +428 -0
  187. package/scripts/lib/common.sh +61 -0
  188. package/scripts/lib/cost-tracking.sh +153 -0
  189. package/scripts/lib/ollama.sh +60 -0
  190. package/scripts/lib/progress-writer.sh +128 -0
  191. package/scripts/lib/run-plan-context.sh +215 -0
  192. package/scripts/lib/run-plan-echo-back.sh +231 -0
  193. package/scripts/lib/run-plan-headless.sh +396 -0
  194. package/scripts/lib/run-plan-notify.sh +57 -0
  195. package/scripts/lib/run-plan-parser.sh +81 -0
  196. package/scripts/lib/run-plan-prompt.sh +215 -0
  197. package/scripts/lib/run-plan-quality-gate.sh +132 -0
  198. package/scripts/lib/run-plan-routing.sh +315 -0
  199. package/scripts/lib/run-plan-sampling.sh +170 -0
  200. package/scripts/lib/run-plan-scoring.sh +146 -0
  201. package/scripts/lib/run-plan-state.sh +142 -0
  202. package/scripts/lib/run-plan-team.sh +199 -0
  203. package/scripts/lib/telegram.sh +54 -0
  204. package/scripts/lib/thompson-sampling.sh +176 -0
  205. package/scripts/license-check.sh +74 -0
  206. package/scripts/mab-run.sh +575 -0
  207. package/scripts/module-size-check.sh +146 -0
  208. package/scripts/patterns/async-no-await.yml +5 -0
  209. package/scripts/patterns/bare-except.yml +6 -0
  210. package/scripts/patterns/empty-catch.yml +6 -0
  211. package/scripts/patterns/hardcoded-localhost.yml +9 -0
  212. package/scripts/patterns/retry-loop-no-backoff.yml +12 -0
  213. package/scripts/pipeline-status.sh +197 -0
  214. package/scripts/policy-check.sh +226 -0
  215. package/scripts/prior-art-search.sh +133 -0
  216. package/scripts/promote-mab-lessons.sh +126 -0
  217. package/scripts/prompts/agent-a-superpowers.md +29 -0
  218. package/scripts/prompts/agent-b-ralph.md +29 -0
  219. package/scripts/prompts/judge-agent.md +61 -0
  220. package/scripts/prompts/planner-agent.md +44 -0
  221. package/scripts/pull-community-lessons.sh +90 -0
  222. package/scripts/quality-gate.sh +266 -0
  223. package/scripts/research-gate.sh +90 -0
  224. package/scripts/run-plan.sh +329 -0
  225. package/scripts/scope-infer.sh +159 -0
  226. package/scripts/setup-ralph-loop.sh +155 -0
  227. package/scripts/telemetry.sh +230 -0
  228. package/scripts/tests/run-all-tests.sh +52 -0
  229. package/scripts/tests/test-act-cli.sh +46 -0
  230. package/scripts/tests/test-agents-md.sh +87 -0
  231. package/scripts/tests/test-analyze-report.sh +114 -0
  232. package/scripts/tests/test-architecture-map.sh +89 -0
  233. package/scripts/tests/test-auto-compound.sh +169 -0
  234. package/scripts/tests/test-batch-test.sh +65 -0
  235. package/scripts/tests/test-benchmark-runner.sh +25 -0
  236. package/scripts/tests/test-common.sh +168 -0
  237. package/scripts/tests/test-cost-tracking.sh +158 -0
  238. package/scripts/tests/test-echo-back.sh +180 -0
  239. package/scripts/tests/test-entropy-audit.sh +146 -0
  240. package/scripts/tests/test-failure-digest.sh +66 -0
  241. package/scripts/tests/test-generate-ast-rules.sh +145 -0
  242. package/scripts/tests/test-helpers.sh +82 -0
  243. package/scripts/tests/test-init.sh +47 -0
  244. package/scripts/tests/test-lesson-check.sh +278 -0
  245. package/scripts/tests/test-lesson-local.sh +55 -0
  246. package/scripts/tests/test-license-check.sh +109 -0
  247. package/scripts/tests/test-mab-run.sh +182 -0
  248. package/scripts/tests/test-ollama-lib.sh +49 -0
  249. package/scripts/tests/test-ollama.sh +60 -0
  250. package/scripts/tests/test-pipeline-status.sh +198 -0
  251. package/scripts/tests/test-policy-check.sh +124 -0
  252. package/scripts/tests/test-prior-art-search.sh +96 -0
  253. package/scripts/tests/test-progress-writer.sh +140 -0
  254. package/scripts/tests/test-promote-mab-lessons.sh +110 -0
  255. package/scripts/tests/test-pull-community-lessons.sh +149 -0
  256. package/scripts/tests/test-quality-gate.sh +241 -0
  257. package/scripts/tests/test-research-gate.sh +132 -0
  258. package/scripts/tests/test-run-plan-cli.sh +86 -0
  259. package/scripts/tests/test-run-plan-context.sh +305 -0
  260. package/scripts/tests/test-run-plan-e2e.sh +153 -0
  261. package/scripts/tests/test-run-plan-headless.sh +424 -0
  262. package/scripts/tests/test-run-plan-notify.sh +124 -0
  263. package/scripts/tests/test-run-plan-parser.sh +217 -0
  264. package/scripts/tests/test-run-plan-prompt.sh +254 -0
  265. package/scripts/tests/test-run-plan-quality-gate.sh +222 -0
  266. package/scripts/tests/test-run-plan-routing.sh +178 -0
  267. package/scripts/tests/test-run-plan-scoring.sh +148 -0
  268. package/scripts/tests/test-run-plan-state.sh +261 -0
  269. package/scripts/tests/test-run-plan-team.sh +157 -0
  270. package/scripts/tests/test-scope-infer.sh +150 -0
  271. package/scripts/tests/test-setup-ralph-loop.sh +63 -0
  272. package/scripts/tests/test-telegram-env.sh +38 -0
  273. package/scripts/tests/test-telegram.sh +121 -0
  274. package/scripts/tests/test-telemetry.sh +46 -0
  275. package/scripts/tests/test-thompson-sampling.sh +139 -0
  276. package/scripts/tests/test-validate-all.sh +60 -0
  277. package/scripts/tests/test-validate-commands.sh +89 -0
  278. package/scripts/tests/test-validate-hooks.sh +98 -0
  279. package/scripts/tests/test-validate-lessons.sh +150 -0
  280. package/scripts/tests/test-validate-plan-quality.sh +235 -0
  281. package/scripts/tests/test-validate-plans.sh +187 -0
  282. package/scripts/tests/test-validate-plugin.sh +106 -0
  283. package/scripts/tests/test-validate-prd.sh +184 -0
  284. package/scripts/tests/test-validate-skills.sh +134 -0
  285. package/scripts/validate-all.sh +57 -0
  286. package/scripts/validate-commands.sh +67 -0
  287. package/scripts/validate-hooks.sh +89 -0
  288. package/scripts/validate-lessons.sh +98 -0
  289. package/scripts/validate-plan-quality.sh +369 -0
  290. package/scripts/validate-plans.sh +120 -0
  291. package/scripts/validate-plugin.sh +86 -0
  292. package/scripts/validate-policies.sh +42 -0
  293. package/scripts/validate-prd.sh +118 -0
  294. package/scripts/validate-skills.sh +96 -0
  295. package/skills/autocode/SKILL.md +285 -0
  296. package/skills/autocode/ab-verification.md +51 -0
  297. package/skills/autocode/code-quality-standards.md +37 -0
  298. package/skills/autocode/competitive-mode.md +364 -0
  299. package/skills/brainstorming/SKILL.md +97 -0
  300. package/skills/capture-lesson/SKILL.md +187 -0
  301. package/skills/check-lessons/SKILL.md +116 -0
  302. package/skills/dispatching-parallel-agents/SKILL.md +110 -0
  303. package/skills/executing-plans/SKILL.md +85 -0
  304. package/skills/finishing-a-development-branch/SKILL.md +201 -0
  305. package/skills/receiving-code-review/SKILL.md +72 -0
  306. package/skills/requesting-code-review/SKILL.md +59 -0
  307. package/skills/requesting-code-review/code-reviewer.md +82 -0
  308. package/skills/research/SKILL.md +145 -0
  309. package/skills/roadmap/SKILL.md +115 -0
  310. package/skills/subagent-driven-development/SKILL.md +98 -0
  311. package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +18 -0
  312. package/skills/subagent-driven-development/implementer-prompt.md +73 -0
  313. package/skills/subagent-driven-development/spec-reviewer-prompt.md +57 -0
  314. package/skills/systematic-debugging/SKILL.md +134 -0
  315. package/skills/systematic-debugging/condition-based-waiting.md +64 -0
  316. package/skills/systematic-debugging/defense-in-depth.md +32 -0
  317. package/skills/systematic-debugging/root-cause-tracing.md +55 -0
  318. package/skills/test-driven-development/SKILL.md +167 -0
  319. package/skills/using-git-worktrees/SKILL.md +219 -0
  320. package/skills/using-superpowers/SKILL.md +54 -0
  321. package/skills/verification-before-completion/SKILL.md +140 -0
  322. package/skills/verify/SKILL.md +82 -0
  323. package/skills/writing-plans/SKILL.md +128 -0
  324. package/skills/writing-skills/SKILL.md +93 -0
@@ -0,0 +1,118 @@
1
+ #!/usr/bin/env bash
2
+ # validate-prd.sh — Validate PRD JSON structure and references
3
+ # Exit 0 if clean, exit 1 if violations found. Use --warn to print but exit 0.
4
+ # Requires: jq
5
+ set -euo pipefail
6
+
7
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8
+ PRD_FILE="${PRD_FILE:-$SCRIPT_DIR/../tasks/prd.json}"
9
+ WARN_ONLY=false
10
+ violations=0
11
+
12
+ usage() {
13
+ echo "Usage: validate-prd.sh [--warn] [--help] [file]"
14
+ echo " Validates PRD JSON file structure"
15
+ echo " Without arguments, validates tasks/prd.json"
16
+ echo " --warn Print violations but exit 0"
17
+ exit 0
18
+ }
19
+
20
+ report_violation() {
21
+ local msg="$1"
22
+ echo "$(basename "$PRD_FILE"): ${msg}"
23
+ ((violations++)) || true
24
+ }
25
+
26
+ # Parse arguments
27
+ while [[ $# -gt 0 ]]; do
28
+ case "$1" in
29
+ --help|-h) usage ;;
30
+ --warn) WARN_ONLY=true; shift ;;
31
+ *) PRD_FILE="$1"; shift ;;
32
+ esac
33
+ done
34
+
35
+ # Check jq is available
36
+ if ! command -v jq &>/dev/null; then
37
+ echo "validate-prd: jq is required but not found" >&2
38
+ exit 1
39
+ fi
40
+
41
+ # Check file exists
42
+ if [[ ! -f "$PRD_FILE" ]]; then
43
+ echo "validate-prd: PRD file not found: $PRD_FILE" >&2
44
+ exit 1
45
+ fi
46
+
47
+ # Check 1: Valid JSON
48
+ if ! jq empty "$PRD_FILE" 2>/dev/null; then
49
+ report_violation "Invalid JSON (jq parse error)"
50
+ echo ""
51
+ echo "validate-prd: FAIL ($violations issues)"
52
+ [[ "$WARN_ONLY" == true ]] && exit 0
53
+ exit 1
54
+ fi
55
+
56
+ # Check 2: Must be a JSON array
57
+ is_array=$(jq 'type == "array"' "$PRD_FILE")
58
+ if [[ "$is_array" != "true" ]]; then
59
+ report_violation "Root must be a JSON array, got $(jq -r 'type' "$PRD_FILE")"
60
+ echo ""
61
+ echo "validate-prd: FAIL ($violations issues)"
62
+ [[ "$WARN_ONLY" == true ]] && exit 0
63
+ exit 1
64
+ fi
65
+
66
+ # Collect all valid IDs for reference checking
67
+ all_ids=$(jq -r '.[].id // empty' "$PRD_FILE" 2>/dev/null | sort -n)
68
+
69
+ # Check each element
70
+ count=$(jq 'length' "$PRD_FILE")
71
+ for ((i = 0; i < count; i++)); do
72
+ idx=$((i + 1))
73
+
74
+ # Check 3: id must be a number
75
+ id_type=$(jq -r ".[$i].id | type" "$PRD_FILE")
76
+ id_val=$(jq -r ".[$i].id // empty" "$PRD_FILE")
77
+ if [[ "$id_type" != "number" ]]; then
78
+ report_violation "Task $idx: missing or non-numeric 'id'"
79
+ fi
80
+
81
+ # Check 4: title must be a non-empty string
82
+ title=$(jq -r ".[$i].title // empty" "$PRD_FILE")
83
+ if [[ -z "$title" ]]; then
84
+ report_violation "Task $idx (id=$id_val): missing or empty 'title'"
85
+ fi
86
+
87
+ # Check 5: acceptance_criteria must be a non-empty array
88
+ ac_type=$(jq -r ".[$i].acceptance_criteria | type" "$PRD_FILE")
89
+ ac_len=$(jq ".[$i].acceptance_criteria | length" "$PRD_FILE" 2>/dev/null || echo 0)
90
+ if [[ "$ac_type" != "array" || "$ac_len" -eq 0 ]]; then
91
+ report_violation "Task $idx (id=$id_val): missing or empty 'acceptance_criteria'"
92
+ fi
93
+
94
+ # Check 6: blocked_by references must exist and not self-reference
95
+ if jq -e ".[$i].blocked_by" "$PRD_FILE" >/dev/null 2>&1; then
96
+ blocked_by=$(jq -r ".[$i].blocked_by[]?" "$PRD_FILE" 2>/dev/null || true)
97
+ for ref in $blocked_by; do
98
+ # Self-reference check
99
+ if [[ "$ref" == "$id_val" ]]; then
100
+ report_violation "Task $idx (id=$id_val): blocks itself"
101
+ fi
102
+ # Existence check
103
+ if ! echo "$all_ids" | grep -qx "$ref"; then
104
+ report_violation "Task $idx (id=$id_val): blocked_by references non-existent ID $ref"
105
+ fi
106
+ done
107
+ fi
108
+ done
109
+
110
+ if [[ $violations -gt 0 ]]; then
111
+ echo ""
112
+ echo "validate-prd: FAIL ($violations issues)"
113
+ [[ "$WARN_ONLY" == true ]] && exit 0
114
+ exit 1
115
+ else
116
+ echo "validate-prd: PASS"
117
+ exit 0
118
+ fi
@@ -0,0 +1,96 @@
1
+ #!/usr/bin/env bash
2
+ # validate-skills.sh — Validate skill directory structure and SKILL.md frontmatter
3
+ # Exit 0 if clean, exit 1 if violations found. Use --warn to print but exit 0.
4
+ set -euo pipefail
5
+
6
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7
+ SKILLS_DIR="${SKILLS_DIR:-$SCRIPT_DIR/../skills}"
8
+ WARN_ONLY=false
9
+ violations=0
10
+
11
+ usage() {
12
+ echo "Usage: validate-skills.sh [--warn] [--help]"
13
+ echo " Validates all skills/*/SKILL.md files"
14
+ echo " --warn Print violations but exit 0"
15
+ exit 0
16
+ }
17
+
18
+ report_violation() {
19
+ local file="$1" line="$2" msg="$3"
20
+ echo "${file}:${line}: ${msg}"
21
+ ((violations++)) || true
22
+ }
23
+
24
+ [[ "${1:-}" == "--help" || "${1:-}" == "-h" ]] && usage
25
+ [[ "${1:-}" == "--warn" ]] && WARN_ONLY=true
26
+
27
+ if [[ ! -d "$SKILLS_DIR" ]]; then
28
+ echo "validate-skills: skills directory not found: $SKILLS_DIR" >&2
29
+ exit 1
30
+ fi
31
+
32
+ for skill_dir in "$SKILLS_DIR"/*/; do
33
+ [[ -d "$skill_dir" ]] || continue
34
+ dir_name="$(basename "$skill_dir")"
35
+ skill_file="$skill_dir/SKILL.md"
36
+
37
+ if [[ ! -f "$skill_file" ]]; then
38
+ report_violation "$dir_name" 0 "Missing SKILL.md"
39
+ continue
40
+ fi
41
+
42
+ # Check 1: First line must be ---
43
+ first_line=$(head -1 "$skill_file")
44
+ if [[ "$first_line" != "---" ]]; then
45
+ report_violation "$dir_name/SKILL.md" 1 "First line must be '---', got '$first_line'"
46
+ continue
47
+ fi
48
+
49
+ # Extract frontmatter (between first two --- lines)
50
+ frontmatter=$(sed -n '2,/^---$/{ /^---$/d; p; }' "$skill_file")
51
+
52
+ # Check 2: Required fields
53
+ for field in name description; do
54
+ if ! echo "$frontmatter" | grep -q "^${field}:"; then
55
+ report_violation "$dir_name/SKILL.md" 0 "Missing required field: $field"
56
+ fi
57
+ done
58
+
59
+ # Check 3: name must match directory name
60
+ skill_name=$(echo "$frontmatter" | sed -n 's/^name:[[:space:]]*\(.*\)/\1/p' | tr -d ' "'"'"'')
61
+ if [[ -n "$skill_name" && "$skill_name" != "$dir_name" ]]; then
62
+ report_violation "$dir_name/SKILL.md" 0 "name '$skill_name' does not match directory '$dir_name'"
63
+ fi
64
+
65
+ # Check 4: Referenced .md files in body must exist
66
+ # Body starts after the second ---
67
+ body=$(sed -n '/^---$/,$ p' "$skill_file" | tail -n +2)
68
+ body=$(echo "$body" | sed -n '/^---$/,$ p' | tail -n +2)
69
+ if [[ -n "$body" ]]; then
70
+ # Strip fenced code blocks and inline backtick-delimited content
71
+ # (paths like `docs/plans/foo.md`) — only bare .md refs are companion files
72
+ cleaned=$(echo "$body" | sed '/^```/,/^```/d' | sed 's/`[^`]*`//g')
73
+ referenced=$(echo "$cleaned" | grep -oE '[a-zA-Z0-9_-]+\.md' | sort -u || true)
74
+ for ref in $referenced; do
75
+ [[ "$ref" == "SKILL.md" ]] && continue
76
+ # Skip all-caps filenames (FRAMEWORK.md, SUMMARY.md, README.md, etc.)
77
+ # — these are conventional doc files that live outside the skill directory
78
+ if [[ "$ref" =~ ^[A-Z][A-Z0-9_-]*\.md$ ]]; then
79
+ continue
80
+ fi
81
+ if [[ ! -f "$skill_dir/$ref" ]]; then
82
+ report_violation "$dir_name/SKILL.md" 0 "Referenced file not found: $ref"
83
+ fi
84
+ done
85
+ fi
86
+ done
87
+
88
+ if [[ $violations -gt 0 ]]; then
89
+ echo ""
90
+ echo "validate-skills: FAIL ($violations issues)"
91
+ [[ "$WARN_ONLY" == true ]] && exit 0
92
+ exit 1
93
+ else
94
+ echo "validate-skills: PASS"
95
+ exit 0
96
+ fi
@@ -0,0 +1,285 @@
1
+ ---
2
+ name: autocode
3
+ description: "Run the full autonomous coding pipeline — brainstorm → PRD → plan → execute → verify → finish — with Telegram notifications and quality gates at every stage."
4
+ version: 1.0.0
5
+ ---
6
+
7
+ # Autocode — Full Autonomous Coding Pipeline
8
+
9
+ ## Overview
10
+
11
+ Orchestrate the complete agent-driven development pipeline from idea to merged code. This skill chains all stages in order, enforces hard gates between them, and optionally sends Telegram notifications at stage transitions.
12
+
13
+ <HARD-GATE>
14
+ Do NOT skip any stage. Do NOT proceed to the next stage until the current stage's exit criteria are met. Every stage must produce its required artifact before the gate opens.
15
+ </HARD-GATE>
16
+
17
+ ## Checklist
18
+
19
+ You MUST create a task for each of these items and complete them in order:
20
+
21
+ 1. **Initialize pipeline** — detect project, set up Telegram, create progress.txt
22
+ 2. **Stage 0.5: Roadmap** (conditional) — invoke `autonomous-coding-toolkit:roadmap`, decompose multi-feature epic
23
+ 3. **Stage 1: Brainstorm** — invoke `autonomous-coding-toolkit:brainstorming`, produce approved design
24
+ 4. **Stage 1.5: Research** — invoke `autonomous-coding-toolkit:research`, investigate unknowns, produce research artifacts
25
+ 5. **Stage 2: PRD** — generate `tasks/prd.json` with machine-verifiable acceptance criteria
26
+ 6. **Stage 3: Plan** — invoke `autonomous-coding-toolkit:writing-plans`, produce batch plan
27
+ 7. **Stage 4: Execute** — run batches with quality gates, update PRD and progress.txt
28
+ 8. **Stage 5: Verify** — invoke `autonomous-coding-toolkit:verification-before-completion`, all PRD criteria pass
29
+ 9. **Stage 6: Finish** — invoke `autonomous-coding-toolkit:finishing-a-development-branch`, merge/PR/keep/discard
30
+
31
+ ## Arguments
32
+
33
+ The user provides a feature description, report path, or issue reference:
34
+ - Feature description: "Add user authentication with JWT"
35
+ - Report path: `reports/daily.md` — run `scripts/analyze-report.sh` first to extract top priority
36
+ - Issue: `#42` — fetch issue details via `gh issue view 42`
37
+
38
+ ## Pipeline
39
+
40
+ ### Stage 0: Initialize
41
+
42
+ 1. Detect the project: read `CLAUDE.md`, identify test command, linter, language
43
+ 2. Check for Telegram credentials:
44
+ ```bash
45
+ # Check if credentials exist (don't echo them)
46
+ grep -q 'TELEGRAM_BOT_TOKEN' ~/.env 2>/dev/null && echo "telegram: enabled" || echo "telegram: disabled"
47
+ ```
48
+ 3. If input is a report path, analyze it first:
49
+ ```bash
50
+ scripts/analyze-report.sh <report>
51
+ ```
52
+ Use the `#1 priority` from the analysis output as the feature description.
53
+ 4. Create or read `progress.txt` — append pipeline start entry
54
+ 5. Notify (if Telegram enabled):
55
+ ```
56
+ 🏭 Autocode started: <feature summary>
57
+ Project: <name>
58
+ ```
59
+
60
+ **Exit criteria:** Feature description is clear, project context loaded, progress.txt initialized.
61
+
62
+ ---
63
+
64
+ ### Stage 0.5: Roadmap (conditional)
65
+
66
+ If the input describes multiple features (3+ distinct features, "roadmap" keyword, or an epic), invoke `autonomous-coding-toolkit:roadmap` to decompose it.
67
+
68
+ This stage produces:
69
+ - `tasks/roadmap.md` with dependency-ordered feature list
70
+ - Phase groupings with effort estimates
71
+ - User approval of feature ordering
72
+
73
+ **Skip condition:** Single-feature inputs skip directly to Stage 1. When in doubt, check: does the input contain multiple independent deliverables?
74
+
75
+ After roadmap approval, the pipeline loops through features in order — each feature runs Stages 1-6 independently.
76
+
77
+ **Exit criteria:** `tasks/roadmap.md` exists and user approves feature ordering.
78
+
79
+ **Telegram:** `✅ Stage 0.5 complete: Roadmap approved — <N> features, <M> phases`
80
+
81
+ ---
82
+
83
+ ### Stage 1: Brainstorm
84
+
85
+ Invoke `autonomous-coding-toolkit:brainstorming` with the feature description.
86
+
87
+ This stage produces:
88
+ - Approved design doc at `docs/plans/YYYY-MM-DD-<topic>-design.md`
89
+ - User approval of the design
90
+
91
+ **Exit criteria:** Design doc exists and user has approved it.
92
+
93
+ **Telegram:** `✅ Stage 1 complete: Design approved — <title>`
94
+
95
+ ---
96
+
97
+ ### Stage 1.5: Research (conditional)
98
+
99
+ After design approval, check if the feature involves technical unknowns, unfamiliar libraries, or integration with existing code. If so, invoke `autonomous-coding-toolkit:research`.
100
+
101
+ This stage produces:
102
+ - Research report at `tasks/research-<slug>.md`
103
+ - Machine-readable findings at `tasks/research-<slug>.json`
104
+ - Resolution of all blocking issues (or user override)
105
+
106
+ **Skip condition:** If the brainstorming phase resolved all technical questions and no unknowns remain, this stage can be skipped. When in doubt, run it — 30 minutes of research prevents hours of rework.
107
+
108
+ **Gate:** Run `scripts/research-gate.sh tasks/research-<slug>.json` — blocks if unresolved blocking issues exist. Use `--force` to override.
109
+
110
+ **Exit criteria:** Research artifacts exist, research gate passes (or user overrides).
111
+
112
+ **Telegram:** `✅ Stage 1.5 complete: Research done — <N> questions, <M> warnings`
113
+
114
+ ---
115
+
116
+ ### Stage 2: PRD Generation
117
+
118
+ After design approval (and research if conducted), generate `tasks/prd.json` using the `/create-prd` format:
119
+ - 8-15 granular tasks with machine-verifiable acceptance criteria
120
+ - Every acceptance criterion is a shell command (exit 0 = pass)
121
+ - Separate investigation tasks from implementation tasks
122
+ - Order by dependency
123
+ - Save both `tasks/prd.json` and `tasks/prd-<feature>.md`
124
+
125
+ After generating, ask the user: **"How would you improve these acceptance criteria?"** — minimum 1 round of refinement.
126
+
127
+ **Exit criteria:** `tasks/prd.json` exists, all criteria are shell commands, user approves.
128
+
129
+ **Telegram:** `✅ Stage 2 complete: PRD generated — <N> tasks`
130
+
131
+ ---
132
+
133
+ ### Stage 3: Write Plan
134
+
135
+ Invoke `autonomous-coding-toolkit:writing-plans` to create the implementation plan.
136
+
137
+ Enhance the plan with:
138
+ - A `## Quality Gates` section listing project-specific checks (auto-detect: `pytest`, `npm test`, `npm run lint`, `make test`, or `scripts/quality-gate.sh`)
139
+ - Cross-references to `tasks/prd.json` task IDs in plan steps
140
+ - `progress.txt` initialization as the first plan step
141
+ - Plans with 3+ batches MUST include a final "Integration Wiring" batch
142
+
143
+ **Exit criteria:** Plan file exists at `docs/plans/YYYY-MM-DD-<topic>.md`, user approves.
144
+
145
+ **Telegram:** `✅ Stage 3 complete: Plan written — <N> batches, <M> tasks`
146
+
147
+ ---
148
+
149
+ ### Stage 4: Execute
150
+
151
+ Ask the user which execution mode to use:
152
+
153
+ | Mode | Best For | How |
154
+ |------|----------|-----|
155
+ | **In-session** | Small plans (1-3 batches) | Execute here with TDD |
156
+ | **Subagent** | 5-15 independent tasks | `autonomous-coding-toolkit:subagent-driven-development` |
157
+ | **Headless** | 4+ batches, unattended | `scripts/run-plan.sh <plan> --notify` |
158
+ | **Ralph loop** | Iterate until done | `/ralph-loop` with completion promise |
159
+ | **MAB** | Learn best strategy per batch type | `scripts/run-plan.sh <plan> --mab --notify` |
160
+
161
+ #### For in-session and subagent modes:
162
+
163
+ Between EVERY batch:
164
+ 1. Run quality gate:
165
+ ```bash
166
+ scripts/quality-gate.sh --project-root .
167
+ ```
168
+ If not available, run the project's test command directly.
169
+ 2. Update `tasks/prd.json` — set `"passes": true` for criteria that now pass
170
+ 3. Append batch summary to `progress.txt`
171
+ 4. Notify per batch:
172
+ ```
173
+ ✅ Batch <N>/<total>: <title>
174
+ Tests: <count> (↑<delta>) | <duration>
175
+ ```
176
+ 5. If quality gate fails: fix before proceeding. Notify:
177
+ ```
178
+ ❌ Batch <N>/<total> failed: <title>
179
+ Issue: <error summary>
180
+ ```
181
+
182
+ #### For headless mode:
183
+
184
+ Launch via bash:
185
+ ```bash
186
+ scripts/run-plan.sh <plan-file> --notify --on-failure retry --max-retries 3 --verify
187
+ ```
188
+
189
+ Report the command to the user and let them decide to run it.
190
+
191
+ **Exit criteria:** All batches complete, all quality gates pass, test count monotonically increased.
192
+
193
+ **Telegram:** `✅ Stage 4 complete: All <N> batches executed — <total tests> tests passing`
194
+
195
+ ---
196
+
197
+ ### Stage 5: Verify
198
+
199
+ Invoke `autonomous-coding-toolkit:verification-before-completion`.
200
+
201
+ Additionally:
202
+ 1. Run ALL acceptance criteria from `tasks/prd.json`:
203
+ ```bash
204
+ # For each criterion in prd.json
205
+ eval "<criterion_command>" && echo "PASS" || echo "FAIL"
206
+ ```
207
+ 2. Every task must have `"passes": true`
208
+ 3. Run lesson scanner against changed files
209
+ 4. For plans with 3+ batches: run A/B verification (see `ab-verification.md`)
210
+
211
+ <HARD-GATE>
212
+ Never claim completion if ANY PRD criterion fails. Fix failures and re-verify.
213
+ </HARD-GATE>
214
+
215
+ **Exit criteria:** All PRD criteria pass, verification evidence collected, no lesson violations.
216
+
217
+ **Telegram:** `✅ Stage 5 complete: All <N> acceptance criteria passing`
218
+
219
+ ---
220
+
221
+ ### Stage 6: Finish
222
+
223
+ Invoke `autonomous-coding-toolkit:finishing-a-development-branch`.
224
+
225
+ After the user's choice (merge/PR/keep/discard):
226
+
227
+ **Telegram:**
228
+ - Merge: `🎉 Autocode complete: <feature> merged to <branch>`
229
+ - PR: `🎉 Autocode complete: <feature> — PR #<N> created`
230
+ - Keep: `📌 Autocode paused: <feature> on branch <name>`
231
+ - Discard: `🗑️ Autocode cancelled: <feature> discarded`
232
+
233
+ ---
234
+
235
+ ## Telegram Notifications
236
+
237
+ Notifications are sent via the Telegram Bot API using credentials from `~/.env`. They are **optional** — the pipeline works without them.
238
+
239
+ To send a notification from within Claude Code:
240
+ ```bash
241
+ TELEGRAM_BOT_TOKEN=$(grep 'TELEGRAM_BOT_TOKEN' ~/.env | cut -d= -f2-)
242
+ TELEGRAM_CHAT_ID=$(grep 'TELEGRAM_CHAT_ID' ~/.env | cut -d= -f2-)
243
+ curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
244
+ -d chat_id="$TELEGRAM_CHAT_ID" \
245
+ -d text="<message>" \
246
+ -d parse_mode="Markdown" \
247
+ --max-time 10 > /dev/null 2>&1
248
+ ```
249
+
250
+ If credentials are missing, skip notifications silently — never block the pipeline on notification failure.
251
+
252
+ ## Rules
253
+
254
+ - **Never skip a stage.** The design must be approved before PRD generation.
255
+ - **Every acceptance criterion is a shell command.** No vague criteria.
256
+ - **Quality gates run between EVERY batch**, not just at the end.
257
+ - **Progress.txt is append-only** during execution — never truncate it.
258
+ - **Test counts only go up.** If tests decrease, something broke — fix it.
259
+ - **Notification failures are non-fatal.** Log and continue.
260
+ - **Fresh context matters.** If past batch 5 in-session, suggest headless mode for remaining batches.
261
+
262
+ ## Common Mistakes
263
+
264
+ **Skipping brainstorming for "simple" features**
265
+ - Problem: Unexamined assumptions cause rework
266
+ - Fix: Every feature goes through Stage 1, even one-line changes
267
+
268
+ **Generating vague PRD criteria**
269
+ - Problem: "Works correctly" is not verifiable
270
+ - Fix: Every criterion is a shell command. `curl -s localhost:8080/api/health | jq -e '.status == "ok"'`
271
+
272
+ **Proceeding past failed quality gates**
273
+ - Problem: Cascading failures compound in later batches
274
+ - Fix: Fix the gate failure BEFORE moving to the next batch
275
+
276
+ **Not updating progress.txt**
277
+ - Problem: Next batch (fresh context) loses discoveries
278
+ - Fix: Append batch summary after every batch, before moving on
279
+
280
+ ## Integration
281
+
282
+ **Called by:** User via `/autocode <feature>` or Skill tool
283
+ **Calls:** brainstorming, writing-plans, executing-plans/subagent-driven-development, verification-before-completion, finishing-a-development-branch
284
+ **State files:** `progress.txt`, `tasks/prd.json`, `.run-plan-state.json`
285
+ **Scripts:** `scripts/run-plan.sh`, `scripts/quality-gate.sh`, `scripts/analyze-report.sh`
@@ -0,0 +1,51 @@
1
+ # A/B Verification
2
+
3
+ Post-completion dual-axis verification for plans with 3+ batches. Catches non-overlapping bug classes that neither strategy alone finds.
4
+
5
+ ## When to Run
6
+
7
+ After ALL batches are complete, regardless of execution mode. Cost: ~5 minutes, 2 agent runs.
8
+
9
+ ## Process
10
+
11
+ Dispatch TWO verification agents in parallel:
12
+
13
+ ### Verifier A (Systematic / Bottom-Up)
14
+
15
+ subagent_type=general-purpose
16
+
17
+ Check:
18
+ - File sizes: flag any file over 300 lines (Python or JSX)
19
+ - Test coverage gaps: modules with no corresponding test file
20
+ - Anti-patterns: bare `except`, silent `return []`, `sqlite3.connect()` without `closing()`
21
+ - Dead config keys: keys registered in config_defaults but never consumed via `get_config_value()`
22
+ - Import health: circular imports, unused imports, duplicate exports
23
+ - Metrics: total test count, ruff/lint clean, file count by type
24
+
25
+ ### Verifier B (Holistic / Top-Down)
26
+
27
+ subagent_type=general-purpose
28
+
29
+ Check:
30
+ - Integration boundaries: trace data from producer → consumer, verify key names match
31
+ - Module lifecycle: `__init__` vs `initialize()` discipline, subscribe/unsubscribe pairing
32
+ - Data flow: follow one real input through every layer to the final output
33
+ - Security: no secrets, no hardcoded IPs, no debug artifacts
34
+ - Dashboard cohesion: frontend props match backend response keys, shared constants not duplicated
35
+
36
+ ## Report Format
37
+
38
+ ```
39
+ A/B VERIFICATION — [date]
40
+ Verifier A (bottom-up): [N] critical, [N] important, [N] minor
41
+ Verifier B (top-down): [N] critical, [N] important, [N] minor
42
+ Overlap: [N] (should be 0)
43
+ Combined critical issues: [list]
44
+ Combined important issues: [list]
45
+ ```
46
+
47
+ ## Rules
48
+
49
+ - If ANY critical issues found: fix them before proceeding to finishing-a-development-branch
50
+ - Create fix tasks, implement, re-run affected tests
51
+ - Save report to `.ab-verification-report.md`
@@ -0,0 +1,37 @@
1
+ # Code Quality Standards
2
+
3
+ Shared quality standards injected into all competitor and implementer prompts. Referenced by competitive-mode.md and team-mode implementer prompts.
4
+
5
+ ## File Size & Modularity
6
+
7
+ - Target ~300 lines per file MAX. If a file exceeds 300 lines, split it into focused modules.
8
+ - Each file should have ONE clear responsibility. If you can't describe the file's purpose in one sentence, it's doing too much.
9
+ - Extract logical groups into separate files: constants → constants.py, helpers → helpers.py, types → models.py.
10
+ - Functions should be short (under 30 lines). If a function needs a comment saying "Step 1... Step 2...", extract each step into a named function.
11
+ - Prefer composition over inheritance. Small, focused functions that compose together.
12
+ - For frontend: one component per file. Shared hooks/utilities in separate files. If a JSX file exceeds 300 lines, extract sub-components into their own files.
13
+
14
+ ## Code Cohesion
15
+
16
+ Your code must look like ONE author wrote the whole codebase:
17
+
18
+ - BEFORE writing anything: read 2-3 existing files in the same package to absorb the project's style — naming conventions, docstring format, import ordering, error handling patterns, logging style.
19
+ - Match existing patterns EXACTLY: if the codebase uses `logger = logging.getLogger(__name__)`, do the same. If it uses `from __future__ import annotations`, include it. If functions use type hints, yours must too.
20
+ - Naming: follow the codebase's conventions. `_private_helper()` with leading underscore, `UPPER_SNAKE` for module constants, `CamelCase` for classes.
21
+ - Imports: group and order (stdlib → third-party → local). Use absolute imports (`from aria.x import Y`).
22
+ - Error handling: follow codebase patterns. `logger.warning()` before returning fallback — never bare `except: pass`. Use specific exception types.
23
+ - Docstrings: match existing format. One-line for simple helpers, multi-line for complex functions.
24
+ - File structure: constants at top, public API in middle, private helpers at bottom.
25
+ - DRY: check if utilities exist before writing new ones. Search shared modules, utils directories, sibling modules.
26
+ - YAGNI: implement exactly what the spec requires. No extra config options, no "future-proofing" abstractions.
27
+ - Frontend: match existing component patterns — same hook usage, prop naming, CSS classes, state management. Read sibling pages before writing.
28
+
29
+ ## Best Practices
30
+
31
+ - Type hints on all function signatures (args and return).
32
+ - Guard clauses over nested conditionals. Return early.
33
+ - Descriptive variable names — no single-letter variables except loop counters.
34
+ - No magic numbers — extract to named constants.
35
+ - Errors should be logged with context before being handled: `logger.warning("Failed to X for entity %s: %s", entity_id, err)`.
36
+ - Tests: one test function per behavior. Descriptive test names: `test_returns_empty_list_when_no_entities`.
37
+ - Avoid deep nesting (>3 levels). Extract inner logic into helper functions.