claude-code-superkit 0.0.0-stage → 1.5.3

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 (353) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +374 -2
  3. package/bin/cli.js +153 -0
  4. package/bin/inject-tokens.js +224 -0
  5. package/bin/measure-tokens.js +17 -0
  6. package/bin/superkit-counts-verify.sh +30 -0
  7. package/lib/codex.js +246 -0
  8. package/lib/docs-scaffold.js +147 -0
  9. package/lib/installer.js +499 -0
  10. package/lib/prompts.js +51 -0
  11. package/lib/settings-builder.js +51 -0
  12. package/lib/superpowers.js +99 -0
  13. package/lib/utils.js +117 -0
  14. package/lib/validator.js +84 -0
  15. package/package.json +49 -4
  16. package/packages/codex/AGENTS.md +396 -0
  17. package/packages/codex/INSTALL.md +342 -0
  18. package/packages/codex/config.toml +22 -0
  19. package/packages/codex/hooks/superkit.mjs +203 -0
  20. package/packages/codex/hooks.json +30 -0
  21. package/packages/codex/legacy-baseline.json +88 -0
  22. package/packages/codex/native-skills.txt +65 -0
  23. package/packages/codex/rules/default.rules +565 -0
  24. package/packages/codex/skills/ai-slop-cleaner/SKILL.md +44 -0
  25. package/packages/codex/skills/api-contract-sync/SKILL.md +96 -0
  26. package/packages/codex/skills/architect/SKILL.md +49 -0
  27. package/packages/codex/skills/audit-backend/SKILL.md +80 -0
  28. package/packages/codex/skills/audit-frontend/SKILL.md +82 -0
  29. package/packages/codex/skills/audit-infra/SKILL.md +87 -0
  30. package/packages/codex/skills/audit-orchestrator/SKILL.md +114 -0
  31. package/packages/codex/skills/behavioral-nudge-engine/SKILL.md +110 -0
  32. package/packages/codex/skills/benchmark/SKILL.md +49 -0
  33. package/packages/codex/skills/bot-reviewer/SKILL.md +94 -0
  34. package/packages/codex/skills/code-reviewer/SKILL.md +67 -0
  35. package/packages/codex/skills/codebase-onboarding-engineer/SKILL.md +46 -0
  36. package/packages/codex/skills/comment-rot-analyzer/SKILL.md +75 -0
  37. package/packages/codex/skills/commit-helper/SKILL.md +101 -0
  38. package/packages/codex/skills/critic/SKILL.md +56 -0
  39. package/packages/codex/skills/database-reviewer/SKILL.md +79 -0
  40. package/packages/codex/skills/debug-observer/SKILL.md +107 -0
  41. package/packages/codex/skills/dependency-checker/SKILL.md +69 -0
  42. package/packages/codex/skills/design-system-reviewer/SKILL.md +121 -0
  43. package/packages/codex/skills/dev-orchestrator/SKILL.md +304 -0
  44. package/packages/codex/skills/docs-reviewer/SKILL.md +86 -0
  45. package/packages/codex/skills/drizzle-orm-expert/SKILL.md +246 -0
  46. package/packages/codex/skills/e2e-test-generator/SKILL.md +95 -0
  47. package/packages/codex/skills/evaluator/SKILL.md +63 -0
  48. package/packages/codex/skills/frontend-perf-reviewer/SKILL.md +95 -0
  49. package/packages/codex/skills/frontend-ui-color-reviewer/SKILL.md +68 -0
  50. package/packages/codex/skills/frontend-ui-design-critic/SKILL.md +99 -0
  51. package/packages/codex/skills/frontend-ui-interaction-reviewer/SKILL.md +102 -0
  52. package/packages/codex/skills/frontend-ui-motion-reviewer/SKILL.md +85 -0
  53. package/packages/codex/skills/frontend-ui-reviewer/SKILL.md +81 -0
  54. package/packages/codex/skills/frontend-ui-typography-reviewer/SKILL.md +62 -0
  55. package/packages/codex/skills/gltf-debugging/SKILL.md +128 -0
  56. package/packages/codex/skills/go-benchmark/SKILL.md +217 -0
  57. package/packages/codex/skills/go-concurrency-reviewer/SKILL.md +113 -0
  58. package/packages/codex/skills/go-error-reviewer/SKILL.md +107 -0
  59. package/packages/codex/skills/go-grpc-patterns/SKILL.md +285 -0
  60. package/packages/codex/skills/go-modernizer/SKILL.md +111 -0
  61. package/packages/codex/skills/go-observability-reviewer/SKILL.md +121 -0
  62. package/packages/codex/skills/go-performance-reviewer/SKILL.md +112 -0
  63. package/packages/codex/skills/go-reviewer/SKILL.md +109 -0
  64. package/packages/codex/skills/go-samber-do/SKILL.md +158 -0
  65. package/packages/codex/skills/go-samber-lo/SKILL.md +178 -0
  66. package/packages/codex/skills/go-samber-oops/SKILL.md +174 -0
  67. package/packages/codex/skills/goal-verifier/SKILL.md +53 -0
  68. package/packages/codex/skills/health-checker/SKILL.md +109 -0
  69. package/packages/codex/skills/html-to-3d-texture/SKILL.md +153 -0
  70. package/packages/codex/skills/impeccable-craft/SKILL.md +101 -0
  71. package/packages/codex/skills/lint-runner/SKILL.md +85 -0
  72. package/packages/codex/skills/migrate/SKILL.md +60 -0
  73. package/packages/codex/skills/migration-reviewer/SKILL.md +88 -0
  74. package/packages/codex/skills/minimal-change-engineer/SKILL.md +44 -0
  75. package/packages/codex/skills/new-migration/SKILL.md +59 -0
  76. package/packages/codex/skills/nextjs-supabase-auth/SKILL.md +227 -0
  77. package/packages/codex/skills/output-enforcement/SKILL.md +71 -0
  78. package/packages/codex/skills/plan-checker/SKILL.md +53 -0
  79. package/packages/codex/skills/postgresql-optimization/SKILL.md +159 -0
  80. package/packages/codex/skills/pre-deploy-validator/SKILL.md +111 -0
  81. package/packages/codex/skills/presentation-reviewer/SKILL.md +88 -0
  82. package/packages/codex/skills/product-3d-lighting/SKILL.md +137 -0
  83. package/packages/codex/skills/project-architecture/SKILL.md +52 -0
  84. package/packages/codex/skills/py-reviewer/SKILL.md +100 -0
  85. package/packages/codex/skills/r3f-scene-reviewer/SKILL.md +88 -0
  86. package/packages/codex/skills/r3f-scroll-driven-3d/SKILL.md +162 -0
  87. package/packages/codex/skills/reality-checker/SKILL.md +61 -0
  88. package/packages/codex/skills/redis-patterns/SKILL.md +260 -0
  89. package/packages/codex/skills/review-orchestrator/SKILL.md +151 -0
  90. package/packages/codex/skills/rs-reviewer/SKILL.md +98 -0
  91. package/packages/codex/skills/ru-text/SKILL.md +132 -0
  92. package/packages/codex/skills/scaffold-endpoint/SKILL.md +44 -0
  93. package/packages/codex/skills/security-scanner/SKILL.md +94 -0
  94. package/packages/codex/skills/silent-failure-hunter/SKILL.md +176 -0
  95. package/packages/codex/skills/telegram-bot-builder/SKILL.md +120 -0
  96. package/packages/codex/skills/test-generator/SKILL.md +79 -0
  97. package/packages/codex/skills/test-runner/SKILL.md +101 -0
  98. package/packages/codex/skills/threejs-color-management/SKILL.md +97 -0
  99. package/packages/codex/skills/tree-generator/SKILL.md +63 -0
  100. package/packages/codex/skills/ts-reviewer/SKILL.md +90 -0
  101. package/packages/codex/skills/ui-design-reviewer/SKILL.md +89 -0
  102. package/packages/codex/skills/ui-reviewer/SKILL.md +103 -0
  103. package/packages/codex/skills/visual-reviewer/SKILL.md +85 -0
  104. package/packages/codex/skills/writing-agents/SKILL.md +165 -0
  105. package/packages/codex/skills/writing-commands/SKILL.md +173 -0
  106. package/packages/core/CLAUDE.md +118 -0
  107. package/packages/core/INTERNAL-FILES +16 -0
  108. package/packages/core/agents/ai-slop-cleaner.md +187 -0
  109. package/packages/core/agents/api-contract-sync.md +127 -0
  110. package/packages/core/agents/architect.md +205 -0
  111. package/packages/core/agents/audit-backend.md +137 -0
  112. package/packages/core/agents/audit-frontend.md +129 -0
  113. package/packages/core/agents/audit-infra.md +182 -0
  114. package/packages/core/agents/behavioral-nudge-engine.md +170 -0
  115. package/packages/core/agents/code-reviewer.md +195 -0
  116. package/packages/core/agents/codebase-onboarding-engineer.md +172 -0
  117. package/packages/core/agents/comment-rot-analyzer.md +115 -0
  118. package/packages/core/agents/critic.md +172 -0
  119. package/packages/core/agents/database-reviewer.md +201 -0
  120. package/packages/core/agents/debug-observer.md +261 -0
  121. package/packages/core/agents/dependency-checker.md +199 -0
  122. package/packages/core/agents/docs-reviewer.md +206 -0
  123. package/packages/core/agents/e2e-test-generator.md +261 -0
  124. package/packages/core/agents/evaluator.md +141 -0
  125. package/packages/core/agents/goal-verifier.md +130 -0
  126. package/packages/core/agents/health-checker.md +194 -0
  127. package/packages/core/agents/migration-reviewer.md +161 -0
  128. package/packages/core/agents/minimal-change-engineer.md +219 -0
  129. package/packages/core/agents/plan-checker.md +139 -0
  130. package/packages/core/agents/pre-deploy-validator.md +189 -0
  131. package/packages/core/agents/reality-checker.md +175 -0
  132. package/packages/core/agents/scaffold-endpoint.md +162 -0
  133. package/packages/core/agents/security-scanner.md +236 -0
  134. package/packages/core/agents/silent-failure-hunter.md +276 -0
  135. package/packages/core/agents/test-generator.md +146 -0
  136. package/packages/core/agents/tree-generator.md +141 -0
  137. package/packages/core/agents/ui-reviewer.md +172 -0
  138. package/packages/core/agents/visual-reviewer.md +211 -0
  139. package/packages/core/commands/audit.md +166 -0
  140. package/packages/core/commands/benchmark.md +130 -0
  141. package/packages/core/commands/commit.md +148 -0
  142. package/packages/core/commands/dev.md +302 -0
  143. package/packages/core/commands/docs-init.md +75 -0
  144. package/packages/core/commands/lint.md +137 -0
  145. package/packages/core/commands/migrate.md +146 -0
  146. package/packages/core/commands/new-migration.md +182 -0
  147. package/packages/core/commands/pair.md +209 -0
  148. package/packages/core/commands/review.md +195 -0
  149. package/packages/core/commands/security-scan.md +142 -0
  150. package/packages/core/commands/superkit-evolve.md +231 -0
  151. package/packages/core/commands/superkit-init.md +274 -0
  152. package/packages/core/commands/test.md +108 -0
  153. package/packages/core/commands/workflow.md +150 -0
  154. package/packages/core/docs/guide/01-getting-started.md +41 -0
  155. package/packages/core/docs-templates/README.md +33 -0
  156. package/packages/core/docs-templates/adr-template.md +62 -0
  157. package/packages/core/docs-templates/architecture/api-contracts.md +26 -0
  158. package/packages/core/docs-templates/architecture/api-reference.md +48 -0
  159. package/packages/core/docs-templates/architecture/auth-and-sessions.md +38 -0
  160. package/packages/core/docs-templates/architecture/backend-layers.md +42 -0
  161. package/packages/core/docs-templates/architecture/data-flow.md +26 -0
  162. package/packages/core/docs-templates/architecture/database-schema.md +51 -0
  163. package/packages/core/docs-templates/architecture/deployment.md +41 -0
  164. package/packages/core/docs-templates/architecture/frontend-state.md +46 -0
  165. package/packages/core/helpers/statusline.cjs +370 -0
  166. package/packages/core/hooks/CHAIN-SEMANTICS.md +84 -0
  167. package/packages/core/hooks/audit-settings-source.sh +98 -0
  168. package/packages/core/hooks/audit-trail.sh +120 -0
  169. package/packages/core/hooks/block-dangerous-git.sh +189 -0
  170. package/packages/core/hooks/bundle-import-check.sh +64 -0
  171. package/packages/core/hooks/compact-state-inject.sh +84 -0
  172. package/packages/core/hooks/config-protection.sh +68 -0
  173. package/packages/core/hooks/console-log-warning.sh +28 -0
  174. package/packages/core/hooks/context-monitor.sh +35 -0
  175. package/packages/core/hooks/dev-edit-counter.sh +59 -0
  176. package/packages/core/hooks/dev-marker-set.sh +55 -0
  177. package/packages/core/hooks/dev-required-on-commit.sh +426 -0
  178. package/packages/core/hooks/doc-check-on-commit.sh +396 -0
  179. package/packages/core/hooks/edit-streak-check.sh +63 -0
  180. package/packages/core/hooks/evolve-check.sh +78 -0
  181. package/packages/core/hooks/gateguard-pre-edit.sh +154 -0
  182. package/packages/core/hooks/gateguard-record-facts.sh +37 -0
  183. package/packages/core/hooks/intake-classifier.py +449 -0
  184. package/packages/core/hooks/lib/profile.sh +141 -0
  185. package/packages/core/hooks/loop-guard.sh +75 -0
  186. package/packages/core/hooks/migration-safety.sh +56 -0
  187. package/packages/core/hooks/plan-completion-gate.sh +61 -0
  188. package/packages/core/hooks/pre-compact-save.sh +89 -0
  189. package/packages/core/hooks/security-patterns.sh +119 -0
  190. package/packages/core/hooks/session-context-restore.sh +76 -0
  191. package/packages/core/hooks/subagent-stop-validate.sh +73 -0
  192. package/packages/core/hooks/superkit-counts-verify.sh +346 -0
  193. package/packages/core/hooks/superkit-update.sh +367 -0
  194. package/packages/core/hooks/tests/README.md +42 -0
  195. package/packages/core/hooks/tests/audit-trail-chain_test.sh +62 -0
  196. package/packages/core/hooks/tests/block-dangerous-git_test.sh +144 -0
  197. package/packages/core/hooks/tests/chain-semantics/h1.sh +11 -0
  198. package/packages/core/hooks/tests/chain-semantics/h2.sh +9 -0
  199. package/packages/core/hooks/tests/chain-semantics/h3.sh +11 -0
  200. package/packages/core/hooks/tests/chain-semantics/run-experiment.sh +65 -0
  201. package/packages/core/hooks/tests/chain-semantics/settings-experiment.json +15 -0
  202. package/packages/core/hooks/tests/counts-verify_test.sh +118 -0
  203. package/packages/core/hooks/tests/dev-required-on-commit_test.sh +207 -0
  204. package/packages/core/hooks/tests/dev-required-wip-on-main_test.sh +20 -0
  205. package/packages/core/hooks/tests/doc-check-on-commit_test.sh +122 -0
  206. package/packages/core/hooks/tests/edit-streak-check_test.sh +106 -0
  207. package/packages/core/hooks/tests/internal-manifest_test.sh +130 -0
  208. package/packages/core/hooks/tests/json-path_test.sh +108 -0
  209. package/packages/core/hooks/tests/mirror-invariants_test.sh +139 -0
  210. package/packages/core/hooks/tests/nudge-throttle_test.sh +95 -0
  211. package/packages/core/hooks/tests/profile-helper_test.sh +21 -0
  212. package/packages/core/hooks/tests/run-all.sh +47 -0
  213. package/packages/core/hooks/tests/session-key-helper_test.sh +17 -0
  214. package/packages/core/hooks/tests/superkit-update_test.sh +311 -0
  215. package/packages/core/hooks/tests/warn-visibility_test.sh +59 -0
  216. package/packages/core/hooks/user-intent-detect.sh +44 -0
  217. package/packages/core/hooks/verify-hooks.sh +69 -0
  218. package/packages/core/rules/auto-commands.md +124 -0
  219. package/packages/core/rules/coding-style.md +68 -0
  220. package/packages/core/rules/dev-workflow.md +77 -0
  221. package/packages/core/rules/documentation.md +106 -0
  222. package/packages/core/rules/frontend-aesthetics.md +53 -0
  223. package/packages/core/rules/git-workflow.md +14 -0
  224. package/packages/core/rules/security.md +29 -0
  225. package/packages/core/rules/superkit-integrity.md +114 -0
  226. package/packages/core/settings.json +229 -0
  227. package/packages/core/skills/drizzle-orm-expert/SKILL.md +260 -0
  228. package/packages/core/skills/nextjs-supabase-auth/SKILL.md +259 -0
  229. package/packages/core/skills/postgresql-optimization/SKILL.md +150 -0
  230. package/packages/core/skills/project-architecture/SKILL.md +31 -0
  231. package/packages/core/skills/project-scanner/SKILL.md +132 -0
  232. package/packages/core/skills/redis-patterns/SKILL.md +261 -0
  233. package/packages/core/skills/ru-text/SKILL.md +156 -0
  234. package/packages/core/skills/telegram-bot-builder/SKILL.md +145 -0
  235. package/packages/core/skills/writing-agents/SKILL.md +220 -0
  236. package/packages/core/skills/writing-commands/SKILL.md +176 -0
  237. package/packages/core/skills/writing-hooks/SKILL.md +335 -0
  238. package/packages/extras/bot-reviewer.md +279 -0
  239. package/packages/extras/design-system-reviewer.md +234 -0
  240. package/packages/extras/red-blue-auditor/README.md +117 -0
  241. package/packages/extras/red-blue-auditor/agent.md +128 -0
  242. package/packages/extras/red-blue-auditor/patterns/agent-config.txt +4 -0
  243. package/packages/extras/red-blue-auditor/patterns/hook-injection.txt +8 -0
  244. package/packages/extras/red-blue-auditor/patterns/mcp-risk.txt +5 -0
  245. package/packages/extras/red-blue-auditor/patterns/permission-abuse.txt +6 -0
  246. package/packages/extras/red-blue-auditor/patterns/secrets.txt +17 -0
  247. package/packages/extras/red-blue-auditor/scan.sh +88 -0
  248. package/packages/extras/skillsmp-search/SKILL.md +134 -0
  249. package/packages/frontend-3d/README.md +62 -0
  250. package/packages/frontend-3d/agents/frontend-perf-reviewer.md +164 -0
  251. package/packages/frontend-3d/agents/presentation-reviewer.md +146 -0
  252. package/packages/frontend-3d/agents/r3f-scene-reviewer.md +128 -0
  253. package/packages/frontend-3d/agents/ui-design-reviewer.md +169 -0
  254. package/packages/frontend-3d/commands/capture-screen.md +166 -0
  255. package/packages/frontend-3d/hooks/bundle-size-warn.sh +93 -0
  256. package/packages/frontend-3d/hooks/gsap-pattern-check.sh +74 -0
  257. package/packages/frontend-3d/hooks/r3f-color-check.sh +76 -0
  258. package/packages/frontend-3d/hooks/tailwind-version-guard.sh +98 -0
  259. package/packages/frontend-3d/rules/frontend-aesthetics-3d.md +81 -0
  260. package/packages/frontend-3d/rules/gsap-conventions.md +129 -0
  261. package/packages/frontend-3d/rules/threejs-conventions.md +116 -0
  262. package/packages/frontend-3d/skills/gltf-debugging/SKILL.md +145 -0
  263. package/packages/frontend-3d/skills/html-to-3d-texture/SKILL.md +183 -0
  264. package/packages/frontend-3d/skills/output-enforcement/SKILL.md +79 -0
  265. package/packages/frontend-3d/skills/product-3d-lighting/SKILL.md +166 -0
  266. package/packages/frontend-3d/skills/r3f-scroll-driven-3d/SKILL.md +209 -0
  267. package/packages/frontend-3d/skills/threejs-color-management/SKILL.md +111 -0
  268. package/packages/frontend-ui/NOTICE.md +99 -0
  269. package/packages/frontend-ui/README.md +59 -0
  270. package/packages/frontend-ui/agents/ui-color-reviewer.md +174 -0
  271. package/packages/frontend-ui/agents/ui-design-critic.md +198 -0
  272. package/packages/frontend-ui/agents/ui-interaction-reviewer.md +259 -0
  273. package/packages/frontend-ui/agents/ui-motion-reviewer.md +266 -0
  274. package/packages/frontend-ui/agents/ui-reviewer.md +251 -0
  275. package/packages/frontend-ui/agents/ui-typography-reviewer.md +222 -0
  276. package/packages/frontend-ui/hooks/tests/ui-animation-easing-check_test.sh +78 -0
  277. package/packages/frontend-ui/hooks/tests/ui-banned-fonts-check_test.sh +77 -0
  278. package/packages/frontend-ui/hooks/tests/ui-color-check_test.sh +75 -0
  279. package/packages/frontend-ui/hooks/ui-animation-easing-check.sh +86 -0
  280. package/packages/frontend-ui/hooks/ui-banned-fonts-check.sh +90 -0
  281. package/packages/frontend-ui/hooks/ui-color-check.sh +102 -0
  282. package/packages/frontend-ui/rules/color-and-contrast.md +230 -0
  283. package/packages/frontend-ui/rules/frontend-design-aesthetics.md +124 -0
  284. package/packages/frontend-ui/rules/interaction-polish.md +335 -0
  285. package/packages/frontend-ui/rules/motion-and-animation.md +283 -0
  286. package/packages/frontend-ui/rules/spatial-and-layout.md +212 -0
  287. package/packages/frontend-ui/rules/typography-guidelines.md +185 -0
  288. package/packages/frontend-ui/rules/ui-anti-patterns.md +309 -0
  289. package/packages/frontend-ui/settings.json +24 -0
  290. package/packages/frontend-ui/skills/impeccable-craft/SKILL.md +187 -0
  291. package/packages/gan/README.md +232 -0
  292. package/packages/gan/agents/gan-evaluator.md +214 -0
  293. package/packages/gan/agents/gan-generator.md +171 -0
  294. package/packages/gan/agents/gan-planner.md +206 -0
  295. package/packages/gan/rubrics/functionality.md +66 -0
  296. package/packages/gan/rubrics/ui-quality.md +77 -0
  297. package/packages/gan/skills/gan-evaluator/SKILL.md +91 -0
  298. package/packages/gan/skills/gan-generator/SKILL.md +72 -0
  299. package/packages/gan/skills/gan-planner/SKILL.md +93 -0
  300. package/packages/stack-agents/go/go-concurrency-reviewer.md +210 -0
  301. package/packages/stack-agents/go/go-error-reviewer.md +187 -0
  302. package/packages/stack-agents/go/go-modernizer.md +160 -0
  303. package/packages/stack-agents/go/go-observability-reviewer.md +185 -0
  304. package/packages/stack-agents/go/go-performance-reviewer.md +160 -0
  305. package/packages/stack-agents/go/go-reviewer.md +277 -0
  306. package/packages/stack-agents/go/references/benchmark-methodology.md +280 -0
  307. package/packages/stack-agents/go/references/channel-patterns.md +384 -0
  308. package/packages/stack-agents/go/references/cli-cobra-viper.md +190 -0
  309. package/packages/stack-agents/go/references/code-style.md +262 -0
  310. package/packages/stack-agents/go/references/context-propagation.md +317 -0
  311. package/packages/stack-agents/go/references/data-structures.md +315 -0
  312. package/packages/stack-agents/go/references/database-patterns.md +334 -0
  313. package/packages/stack-agents/go/references/design-patterns.md +411 -0
  314. package/packages/stack-agents/go/references/di-frameworks.md +146 -0
  315. package/packages/stack-agents/go/references/error-creation.md +251 -0
  316. package/packages/stack-agents/go/references/error-inspection.md +348 -0
  317. package/packages/stack-agents/go/references/error-wrapping.md +230 -0
  318. package/packages/stack-agents/go/references/gopls-driving.md +62 -0
  319. package/packages/stack-agents/go/references/goroutine-lifecycle.md +351 -0
  320. package/packages/stack-agents/go/references/graphql-patterns.md +221 -0
  321. package/packages/stack-agents/go/references/grpc-patterns.md +373 -0
  322. package/packages/stack-agents/go/references/modernize-guide.md +522 -0
  323. package/packages/stack-agents/go/references/module-management.md +191 -0
  324. package/packages/stack-agents/go/references/naming-conventions.md +176 -0
  325. package/packages/stack-agents/go/references/observability-pipeline.md +352 -0
  326. package/packages/stack-agents/go/references/performance-profiling.md +250 -0
  327. package/packages/stack-agents/go/references/refactoring-mechanics.md +127 -0
  328. package/packages/stack-agents/go/references/rest-openapi-patterns.md +160 -0
  329. package/packages/stack-agents/go/references/samber-do.md +201 -0
  330. package/packages/stack-agents/go/references/samber-libraries.md +363 -0
  331. package/packages/stack-agents/go/references/samber-lo.md +260 -0
  332. package/packages/stack-agents/go/references/samber-oops.md +200 -0
  333. package/packages/stack-agents/go/references/security-checklist.md +441 -0
  334. package/packages/stack-agents/go/references/standard-stdlib-now.md +181 -0
  335. package/packages/stack-agents/go/references/stay-updated.md +147 -0
  336. package/packages/stack-agents/go/references/structs-interfaces.md +312 -0
  337. package/packages/stack-agents/go/references/sync-primitives.md +395 -0
  338. package/packages/stack-agents/go/references/testing-patterns.md +483 -0
  339. package/packages/stack-agents/go/references/troubleshooting.md +98 -0
  340. package/packages/stack-agents/python/py-reviewer.md +194 -0
  341. package/packages/stack-agents/rust/rs-reviewer.md +188 -0
  342. package/packages/stack-agents/typescript/ts-reviewer.md +135 -0
  343. package/packages/stack-hooks/go/go-context-check-on-edit.sh +56 -0
  344. package/packages/stack-hooks/go/go-error-check-on-edit.sh +54 -0
  345. package/packages/stack-hooks/go/go-format-on-edit.sh +32 -0
  346. package/packages/stack-hooks/go/go-safety-check-on-edit.sh +54 -0
  347. package/packages/stack-hooks/go/go-vet-on-edit.sh +61 -0
  348. package/packages/stack-hooks/go/golangci-lint-on-edit.sh +54 -0
  349. package/packages/stack-hooks/python/ruff-on-edit.sh +67 -0
  350. package/packages/stack-hooks/rust/cargo-check-on-edit.sh +64 -0
  351. package/packages/stack-hooks/typescript/typecheck-on-edit.sh +76 -0
  352. package/packages/stack-rules/go/go-conventions.md +44 -0
  353. package/packages/stack-rules/go/go-safety.md +35 -0
@@ -0,0 +1,232 @@
1
+ # GAN Harness — packages/gan/
2
+
3
+ Three-agent loop for **adversarial verification** of UI / interactive features.
4
+
5
+ Inspired by the GAN (Generator-Adversarial-Network) pattern from
6
+ [affaan-m/everything-claude-code](https://github.com/affaan-m/everything-claude-code)
7
+ (Anthropic Hackathon Winner).
8
+
9
+ ## What it does
10
+
11
+ Most "this is done" claims fail under real-world conditions because the
12
+ implementor never asked "what does failure look like?" GAN forces that
13
+ question by structurally separating planning from implementation from
14
+ verification.
15
+
16
+ ```
17
+ gan-planner → gan-generator → gan-evaluator
18
+ ↑ │
19
+ └─ (NEEDS-ATTENTION / NEEDS-REMEDIATION) ─┘
20
+ ```
21
+
22
+ - **gan-planner** writes a plan with falsifiable scenarios (happy + empty
23
+ + error + auth) and a rubric.
24
+ - **gan-generator** implements the code AND the Playwright tests against
25
+ the plan.
26
+ - **gan-evaluator** runs Playwright, checks anti-slop, scores against
27
+ the rubric. Adversarial — defaults to NEEDS-REMEDIATION. (A blocked
28
+ run — environment broken, can't even execute — is surfaced separately
29
+ as BLOCKED.)
30
+
31
+ If the evaluator rejects, the generator gets specific failures back and
32
+ iterates. Loop closes when verdict = PASS, or escalates after 3 iterations
33
+ without progress (→ human escalation).
34
+
35
+ ## When to use
36
+
37
+ - UI features where "looks right" matters
38
+ - Forms, dashboards, components, interactive flows
39
+ - Bug-fix verification where unit tests aren't enough evidence
40
+ - Any change where passing tests + visible polish are both required
41
+
42
+ ## When NOT to use
43
+
44
+ - Pure backend / library work without a UI surface (use `reality-checker` instead)
45
+ - Refactors with no behavior change
46
+ - Bug fixes covered by a single failing test
47
+
48
+ ## Installation
49
+
50
+ GAN is an **optional** package and is **not wired into the installer** — copy it
51
+ in manually. It requires Playwright (~150 MB), so install it only if you'll
52
+ actually use it.
53
+
54
+ ```bash
55
+ # From your project root
56
+ cp packages/gan/agents/*.md .claude/agents/
57
+ cp -r packages/gan/skills/* .claude/skills/
58
+ mkdir -p .claude/rubrics && cp packages/gan/rubrics/*.md .claude/rubrics/
59
+
60
+ # Playwright is required for gan-evaluator to run the tests
61
+ npx playwright install
62
+ ```
63
+
64
+ For Codex, install the three Codex-native skills separately. The standard kit
65
+ installer does not install this optional package or its rubric resources. From
66
+ your target project, set `SUPERKIT_SOURCE` to the checkout you are copying from.
67
+ Inspect existing destination files first and preserve customized copies.
68
+
69
+ ```bash
70
+ SUPERKIT_SOURCE=/absolute/path/to/claude-code-superkit
71
+ for role in gan-planner gan-generator gan-evaluator; do
72
+ mkdir -p "$HOME/.agents/skills/$role"
73
+ gan_target="$HOME/.agents/skills/$role/SKILL.md"
74
+ if [ -e "$gan_target" ] || [ -L "$gan_target" ]; then
75
+ printf 'Preserved existing %s; compare manually before updating.\n' "$gan_target"
76
+ else
77
+ cp "$SUPERKIT_SOURCE/packages/gan/skills/$role/SKILL.md" "$gan_target"
78
+ fi
79
+ done
80
+
81
+ # Separate, explicit rubric copy; Claude Code is not a prerequisite.
82
+ mkdir -p .gan/rubrics
83
+ for rubric in ui-quality functionality; do
84
+ gan_target=".gan/rubrics/$rubric.md"
85
+ if [ -e "$gan_target" ] || [ -L "$gan_target" ]; then
86
+ printf 'Preserved existing %s; compare manually before updating.\n' "$gan_target"
87
+ else
88
+ cp "$SUPERKIT_SOURCE/packages/gan/rubrics/$rubric.md" "$gan_target"
89
+ fi
90
+ done
91
+ ```
92
+
93
+ Alternatively, supply accessible rubric paths without copying them. Pass those
94
+ exact paths to the planner, generator and evaluator; the plan binds the actual
95
+ contents and approved applicability. Copying only SKILL.md never supplies the
96
+ rubrics. Missing required rubric/environment evidence leaves the corresponding
97
+ Codex gate incomplete or BLOCKED. The commands above copy local files only;
98
+ installing Playwright/browser dependencies or starting an application requires
99
+ the task's actual setup authority.
100
+
101
+ ## Structure
102
+
103
+ ```
104
+ packages/gan/
105
+ ├── agents/ # Claude Code agents (Opus)
106
+ │ ├── gan-planner.md
107
+ │ ├── gan-generator.md
108
+ │ └── gan-evaluator.md
109
+ ├── skills/ # Codex-native skills
110
+ │ ├── gan-planner/SKILL.md
111
+ │ ├── gan-generator/SKILL.md
112
+ │ └── gan-evaluator/SKILL.md
113
+ ├── rubrics/
114
+ │ ├── ui-quality.md # 21-criterion UI rubric
115
+ │ └── functionality.md # 15-criterion API/backend rubric
116
+ └── README.md
117
+ ```
118
+
119
+ ## How to invoke
120
+
121
+ In Claude Code:
122
+
123
+ ```
124
+ /agent gan-planner
125
+ Plan a feature: add a "create post" form with title + body, optimistic
126
+ update, and graceful error recovery.
127
+ ```
128
+
129
+ After planner outputs the plan:
130
+
131
+ ```
132
+ /agent gan-generator
133
+ Implement the plan above. Run Playwright when done.
134
+ ```
135
+
136
+ After generator hand-off:
137
+
138
+ ```
139
+ /agent gan-evaluator
140
+ Evaluate the implementation against the plan's rubric.
141
+ ```
142
+
143
+ In Codex, request the named installed role in the task and provide its inputs:
144
+ “Use gan-planner for this feature with these rubric paths”, then “Use
145
+ gan-generator with this approved plan”, then “Use gan-evaluator with the plan
146
+ and generator hand-off.” Follow the current host's supported skill-selection
147
+ mechanism; `skill gan-planner` is not a universal shell/CLI command. These roles
148
+ retain `user-invocable: false` and may be selected by the agent for the task.
149
+
150
+ ### Codex contract
151
+
152
+ The Codex-native SKILL.md instructions govern Codex execution; the Claude agent
153
+ files and shared rubric recipes retain their own contracts. Codex binds the
154
+ approved plan, stable requirement/scenario IDs, rubric row IDs, N/A rationale,
155
+ extras, critical requirements and content version/hash before implementation.
156
+ The original selected rubric rows and any approved project adaptations stay
157
+ visible. Historical style recipes are not blanket font/framework bans, and
158
+ “ship it” in a rubric does not authorize shipping, merge or release.
159
+
160
+ The generator implements application code plus Playwright tests. Its green run
161
+ is not independent acceptance. Use available, authorized independent execution
162
+ for the evaluator; an inline fallback must say INLINE SELF-REVIEW and cannot
163
+ satisfy mandatory independence. Requested routing and observed runtime identity
164
+ are separate; no invented model/agent identity or obsolete claim that Codex has
165
+ no subagents.
166
+
167
+ The evaluator runs required existing checks when authorized and reports actual
168
+ scenario coverage, rendered/interaction evidence and rubric results. It cannot
169
+ edit implementation, tests or criteria to obtain PASS. Missing required rubric,
170
+ runtime or independence evidence blocks acceptance; zero, skipped, truncated or
171
+ error-only results cannot establish PASS. Confirmed defects remain reportable
172
+ alongside an incomplete gate. Verdicts are PASS, NEEDS-ATTENTION,
173
+ NEEDS-REMEDIATION or BLOCKED, with Gate status COMPLETE or INCOMPLETE; an incomplete
174
+ gate never yields PASS. Scores do not waive critical failures. Fixture, local
175
+ functional and production evidence remain distinct.
176
+
177
+ Codex handoffs preserve `# GAN Plan`, one `## Rubric`, `## Generator hand-off`
178
+ and `EVALUATION REPORT`. Looping is manual unless explicitly authorized: at most
179
+ 3 corrective generator/evaluator cycles and 3 fix attempts per failing test, or
180
+ the stricter task limit. Keep counters across handoffs/re-plans; stop earlier on
181
+ user steering or unchanged unavailable evidence. Tool availability does not
182
+ authorize dependency/browser installation, app startup, private captures,
183
+ network side effects or production changes. Reuse authority already granted;
184
+ do not ask again for ordinary implementation/checks inside that scope.
185
+
186
+ ## Loop control
187
+
188
+ The loop is human-driven by default — you decide when to re-dispatch.
189
+
190
+ For autopilot:
191
+ - Run gan-planner → save plan
192
+ - Run gan-generator → save hand-off
193
+ - Run gan-evaluator → if NEEDS-ATTENTION or NEEDS-REMEDIATION, re-run generator with the failure list as input
194
+ - Repeat up to 3 times; if no progress → escalate
195
+
196
+ ## Anti-slop checks
197
+
198
+ The rubrics include explicit anti-slop criteria the evaluator enforces:
199
+
200
+ - No `console.log` left in production code
201
+ - No "Lorem ipsum" / "Click me" / placeholder text
202
+ - No generic Tailwind defaults — brand colors required
203
+ - Empty state has specific content + CTA (not blank, not spinner)
204
+ - Error state is specific (not "Something went wrong")
205
+ - All `// TODO` in changed lines addressed
206
+
207
+ ## Cost / time
208
+
209
+ - A typical GAN loop takes 3-8× the time of a single-agent implementation
210
+ - Use it when correctness + polish are worth that cost (production features)
211
+ - Don't use it for quick fixes or experiments
212
+
213
+ ## Comparison to other agents
214
+
215
+ | Pattern | Best for |
216
+ |---------|----------|
217
+ | Single agent | Simple feature, you'll review yourself |
218
+ | `architect` + impl | Complex feature with structural design decisions |
219
+ | `architect` → impl → `reality-checker` | Production feature, you want a single verification pass |
220
+ | **GAN loop** | Production UI feature, you want iterative adversarial verification |
221
+ | `silent-failure-hunter` | Final quality pass for error handling |
222
+
223
+ ## Source
224
+
225
+ Adapted from `affaan-m/everything-claude-code` GAN pattern. Original
226
+ reports +2.25 quality score gain. Our adaptation differs:
227
+ - Codex-native SKILL.md roles for Codex users
228
+ - Explicit rubric files (ui-quality.md, functionality.md) instead of
229
+ agent-internal scoring
230
+ - Optional, manual install (Playwright dependency is heavy)
231
+
232
+ License: MIT (consistent with rest of the kit).
@@ -0,0 +1,214 @@
1
+ ---
2
+ name: gan-evaluator
3
+ description: Runs Playwright against gan-generator's output, scores against the plan's rubric, returns concrete failures. Step 3 of 3 in GAN harness — the adversarial verification step
4
+ tokens: 2366
5
+ model: opus
6
+ allowed-tools: Read, Bash, Grep, Glob
7
+ ---
8
+
9
+ # GAN Evaluator
10
+
11
+ Step 3 of 3 in the GAN harness. Adversarial and distrustful: runs Playwright against the implementation, scores it against the rubric, demands evidence for every claim.
12
+
13
+ ## Hard Rules
14
+
15
+ - NEVER return PASS without green Playwright output from a run YOU executed this session — "close enough" is not PASS.
16
+ - BLOCKED is NOT a score band. Use it only when the evaluation itself cannot run (Playwright/deps missing, dev server won't start, plan/spec unusable). Low scores map to NEEDS-REMEDIATION.
17
+ - Score X / N per rubric: N comes from the plan's `## Rubric` section; with no planner handoff, default to BOTH rubrics at their own stated totals (ui-quality.md: 21, functionality.md: 15) minus their own `N/A if` conditions.
18
+ - Every ✗ cites evidence: failing test output, grep hit with file:line, or a screenshot/DOM snippet path. A rubric file you cannot find is `NOT FOUND: <path>` — never invent its contents.
19
+ - Any critical failure (per the rubric's list) forces NEEDS-REMEDIATION regardless of score.
20
+ - The report separates VERIFIED (tool output you saw) from ASSUMED (not directly checked).
21
+
22
+ ## Phase 0 — Load Inputs
23
+
24
+ You receive:
25
+ 1. The plan from `gan-planner` — scenarios, acceptance criteria, and the `## Rubric` section (files + N + N/A + extra criteria)
26
+ 2. The generator's hand-off note — what changed, local test result
27
+ 3. The codebase as-is
28
+
29
+ Locate the rubric file(s) in `.claude/rubrics/` (if not found: Glob `**/rubrics/ui-quality.md`). Each acceptance criterion is a falsifiable claim — your job is to falsify or verify.
30
+
31
+ ## Workflow
32
+
33
+ ### Step 1: Run Playwright against the plan
34
+
35
+ ```bash
36
+ npx playwright test tests/e2e/<feature>.spec.ts --reporter=json > /tmp/gan-result.json
37
+ ```
38
+
39
+ Parse the JSON:
40
+ - Total tests
41
+ - Passed / failed / skipped
42
+ - For each failed test: name + assertion that failed + screenshot path
43
+
44
+ If the run itself cannot start (Playwright not installed, dev server won't boot) → report BLOCKED with the specific blocker and stop; do not score.
45
+
46
+ ### Step 2: Run anti-slop checks
47
+
48
+ For each item in the plan's anti-slop checklist:
49
+
50
+ ```bash
51
+ # console.log left behind
52
+ grep -rn 'console\.log' src/ app/ components/ | grep -v test | grep -v node_modules
53
+
54
+ # Placeholder text
55
+ grep -rni 'lorem ipsum\|click me\|placeholder text\|todo:\|fixme:' src/ app/ components/
56
+
57
+ # Generic Tailwind defaults — heuristic: check for brand color usage
58
+ grep -rln 'bg-\(primary\|brand\)' src/ app/ components/ || echo "No brand colors used"
59
+ ```
60
+
61
+ (Adjust roots to the project layout — same scope the generator self-checks.)
62
+
63
+ For each check:
64
+ - Pass: no occurrences in changed files
65
+ - Fail: list of files + line numbers
66
+
67
+ ### Step 3: Verify edge states are rendered
68
+
69
+ Boot the dev server, hit each edge state with Playwright, screenshot:
70
+
71
+ ```typescript
72
+ // 1. Empty state — fresh DB, route through page
73
+ // 2. Error state — Playwright mock returning 500
74
+ // 3. Loading state — Playwright network throttle
75
+ // 4. Auth state — unauthenticated, expired session
76
+ ```
77
+
78
+ For each: was the state visually clear? If "no posts yet" page shows only a spinner, that's a fail. Where screenshot baselines exist, Playwright's `toHaveScreenshot()` diff also catches visual regressions.
79
+
80
+ ### Step 4: Anti-AI-slop visual checks
81
+
82
+ Open the rendered UI and check:
83
+
84
+ | Check | Specific test |
85
+ |-------|---------------|
86
+ | No generic Tailwind look | Are `bg-blue-500`, `text-gray-900` used directly, or via a brand palette? |
87
+ | Real content, not lorem | Search rendered DOM for "Lorem ipsum" / "Sample text" |
88
+ | Action buttons have real verbs | Find buttons; verify text isn't "Click here" / "Submit" alone |
89
+ | Empty states have copy | Search for `<div>No data</div>` style anti-pattern |
90
+ | Errors say what happened | Generic "Error occurred" → FAIL |
91
+ | Spacing / hierarchy | Headings have spacing, not just `<h1>` + `<p>` jammed together |
92
+
93
+ Every ✗ from this table MUST name its evidence — a screenshot file path or the exact DOM snippet captured this session. A concern without captured evidence goes under ASSUMED, not into the ✗ list.
94
+
95
+ ### Step 5: Score against the rubric(s)
96
+
97
+ Resolve the rubric source — first match wins:
98
+ 1. Plan has a `## Rubric` section → use exactly those file(s), N values, N/A list, and extra criteria.
99
+ 2. No plan, or plan lacks `## Rubric` → default to BOTH rubrics: `ui-quality.md` (total 21) and `functionality.md` (total 15); apply each rubric's own `N/A if` conditions yourself and set N = total − N/A.
100
+ 3. A named rubric file cannot be read → output `NOT FOUND: <path>`; score any rubric you can read. If none are readable, report test + anti-slop results with `Rubric: NOT FOUND` — that is still a scoreless verdict on the work, not BLOCKED (the tests ran).
101
+
102
+ Per selected rubric: mark every applicable criterion pass/fail with evidence; X = criteria passed; score X / N. Apply the rubric's verdict bands (first matching row): X = N with zero critical failures → PASS; X ≥ 0.8 × N with zero critical failures → NEEDS-ATTENTION; otherwise → NEEDS-REMEDIATION.
103
+
104
+ Two rubrics selected → score each separately; the overall verdict is the most severe (NEEDS-REMEDIATION > NEEDS-ATTENTION > PASS). BLOCKED is never produced by scoring — see Verdicts.
105
+
106
+ ### Step 6: Return to generator (if NEEDS-ATTENTION or NEEDS-REMEDIATION)
107
+
108
+ The verdict + critical failures become input to the next generator iteration. The generator MUST fix only what failed — no new scope.
109
+
110
+ The loop ends when:
111
+ - Verdict = PASS, OR
112
+ - 3 iterations without progress (→ escalate to human)
113
+
114
+ ## Verdicts
115
+
116
+ Same 3-state vocabulary as the `/dev` goal-verifier, so the workflow knows fix-in-place vs re-plan vs ship:
117
+
118
+ | Verdict | Meaning | Next step |
119
+ |---------|---------|-----------|
120
+ | **PASS** | Acceptance criteria met with evidence — all scenarios green, anti-slop clean, edge states clear | Ship it |
121
+ | **NEEDS-ATTENTION** | Minor gaps fixable in place — specific failures the generator can fix without re-planning | Re-dispatch generator with the exact failure list |
122
+ | **NEEDS-REMEDIATION** | Acceptance criteria not met / wrong approach — includes any critical failure and any low rubric score | Re-plan: re-dispatch generator with reasons, or escalate if the approach itself is wrong |
123
+
124
+ **BLOCKED is reported separately, not folded into the three states above.** Use BLOCKED only when the evaluation itself could not be run on the merits — plan is wrong / spec ambiguous / external dependency broken / dev server or Playwright environment failed to start. An un-runnable evaluation is not a NEEDS-REMEDIATION verdict on the work; surface it as BLOCKED and escalate to the user with the specific blocker.
125
+
126
+ ## Output Contract
127
+
128
+ ```
129
+ EVALUATION REPORT
130
+ Verdict: PASS | NEEDS-ATTENTION | NEEDS-REMEDIATION (or BLOCKED — reported separately, see Verdicts)
131
+
132
+ Test results:
133
+ Passed: X / Y scenarios
134
+ Failed: <test name — failing assertion — screenshot path>
135
+
136
+ Anti-slop checks:
137
+ [✓/✗ per item — every ✗ with file:line]
138
+
139
+ Visual / UX:
140
+ [✓/✗ per check — every ✗ with screenshot path or DOM snippet]
141
+
142
+ Rubric scores:
143
+ <rubric file>: X / N (N from plan `## Rubric` | rubric default; N/A: <list | none>)
144
+
145
+ Critical failures:
146
+ 1. <specific failure with file path + line / test name>
147
+
148
+ Required fixes (in order):
149
+ 1. <action>
150
+
151
+ Evidence:
152
+ VERIFIED: <claims backed by tool output you ran this session>
153
+ ASSUMED: <claims not directly checked>
154
+ ```
155
+
156
+ Mini example:
157
+
158
+ ```
159
+ EVALUATION REPORT
160
+ Verdict: NEEDS-ATTENTION
161
+
162
+ Test results:
163
+ Passed: 3 / 4 scenarios
164
+ Failed: error state — expected /something went wrong/i — test-results/error-state.png
165
+
166
+ Anti-slop checks:
167
+ [✓] No console.log
168
+ [✗] Placeholder text at app/page.tsx:42 "click me"
169
+
170
+ Visual / UX:
171
+ [✓] Empty state has copy (screenshots/empty.png)
172
+
173
+ Rubric scores:
174
+ ui-quality.md: 19 / 21 (N from plan `## Rubric`; N/A: none)
175
+
176
+ Critical failures: none
177
+
178
+ Required fixes (in order):
179
+ 1. Replace "click me" at app/page.tsx:42 with a real verb
180
+ 2. Fix the error-state message rendering
181
+
182
+ Evidence:
183
+ VERIFIED: Playwright JSON run, greps above, screenshots listed
184
+ ASSUMED: none
185
+ ```
186
+
187
+ ## Anti-Patterns You MUST Reject
188
+
189
+ - **"Looks good"** without running tests — never accept the generator's word
190
+ - **Tests pass but UI is empty** — verify visually, not just programmatically
191
+ - **One scenario tests the entire flow** — each edge case needs its own assertion
192
+ - **Generic error toast** — "Something went wrong" is a fail. Specific error is a pass.
193
+ - **Loading spinner forever** — every async operation needs success AND failure paths
194
+ - **No empty state** — empty data must show specific content, not a blank page
195
+
196
+ ## Done ONLY when
197
+
198
+ - [ ] Playwright ran this session; JSON parsed; results in the report (or the run is reported BLOCKED with the specific blocker).
199
+ - [ ] Every ✗ is backed by test output, a grep hit with file:line, or a named screenshot/DOM snippet.
200
+ - [ ] Rubric score line(s) show X / N with N's source named (plan `## Rubric` | rubric default).
201
+ - [ ] Verdict is exactly one of PASS / NEEDS-ATTENTION / NEEDS-REMEDIATION.
202
+ - [ ] Report separates VERIFIED from ASSUMED.
203
+
204
+ Not all boxes checked → the evaluation is not done; do not emit the verdict.
205
+
206
+ ## Recap — non-negotiables
207
+
208
+ - No green run you executed → no PASS.
209
+ - BLOCKED = evaluation couldn't run; never a low-score verdict.
210
+ - X / N with N from the plan's `## Rubric` (fallback: both rubrics at their own totals).
211
+ - Any critical failure → NEEDS-REMEDIATION, regardless of score.
212
+ - Every ✗ carries evidence; VERIFIED vs ASSUMED separated.
213
+
214
+ *Pattern adapted from `affaan-m/everything-claude-code`.*
@@ -0,0 +1,171 @@
1
+ ---
2
+ name: gan-generator
3
+ description: Implements features against a gan-planner plan. Writes code + Playwright tests in lockstep, ensures anti-slop checklist is clean. Step 2 of 3 in GAN harness
4
+ tokens: 1734
5
+ model: opus
6
+ allowed-tools: Read, Edit, Write, Bash, Grep, Glob
7
+ ---
8
+
9
+ # GAN Generator
10
+
11
+ Step 2 of 3 in the GAN harness. Takes a plan from `gan-planner` and writes the production code + Playwright tests that satisfy it. Every scenario gets an implementation AND its own test.
12
+
13
+ ## Hard Rules
14
+
15
+ - NEVER `test.skip` / `xit` / disable a failing test to reach green — fix the code or the test.
16
+ - NEVER mock the project's own backend in e2e tests; mock only external services and injected failures (e.g., route → 500).
17
+ - The happy-path persistence assertion (`page.reload()` + re-assert) is non-negotiable.
18
+ - Implement ONLY what the plan scopes — no extra features, abstractions, or "improvements".
19
+ - Max 3 fix attempts per failing test; after the 3rd, stop and hand off `Local test result: FAILED` with details — an honest FAILED beats a disabled test or an endless loop.
20
+ - Every plan scenario gets both an implementation and its own `test()` block.
21
+
22
+ ## Phase 0 — Load Plan
23
+
24
+ The input is a markdown plan from `gan-planner`. Read it carefully:
25
+ 1. Identify all scenarios (happy + edge + error + auth)
26
+ 2. Identify the file list (what to modify, what to create)
27
+ 3. Identify the test file location
28
+ 4. Identify the anti-slop checklist (the plan's `## Rubric` section is for `gan-evaluator` — pass it through untouched)
29
+
30
+ If anything in the plan is ambiguous → STOP and ask for clarification. Do NOT guess.
31
+
32
+ ## Workflow
33
+
34
+ ### Step 1: Implement the code
35
+
36
+ For each file in the plan's "Files to be modified" list:
37
+ - Read the existing file (if it exists)
38
+ - Apply the smallest change that fulfills the scenarios (`minimal-change-engineer` discipline: no drive-by refactors, no new abstractions for a single use)
39
+ - Do NOT add extra abstractions, features, or "improvements" not in the plan
40
+ - Keep imports tidy
41
+
42
+ ### Step 2: Write Playwright tests
43
+
44
+ For each scenario, write a single `test()` block:
45
+
46
+ ```typescript
47
+ import { test, expect } from '@playwright/test';
48
+
49
+ test.describe('<feature>', () => {
50
+ test('happy path — user creates a post', async ({ page }) => {
51
+ // Given
52
+ await loginAs(page, 'user@example.com');
53
+ await page.goto('/posts');
54
+
55
+ // When
56
+ await page.getByRole('button', { name: 'New post' }).click();
57
+ await page.getByLabel('Title').fill('Hello world');
58
+ await page.getByLabel('Body').fill('First post content');
59
+ await page.getByRole('button', { name: 'Publish' }).click();
60
+
61
+ // Then
62
+ await expect(page.getByText('Hello world')).toBeVisible({ timeout: 2000 });
63
+ await expect(page).toHaveURL(/\/posts\/\w+/);
64
+
65
+ // Persistence assertion
66
+ await page.reload();
67
+ await expect(page.getByText('Hello world')).toBeVisible();
68
+ });
69
+
70
+ test('empty state — no posts shown to first-time user', async ({ page }) => {
71
+ await loginAs(page, 'fresh@example.com');
72
+ await page.goto('/posts');
73
+ await expect(page.getByText(/no posts yet/i)).toBeVisible();
74
+ });
75
+
76
+ test('error state — graceful failure on server error', async ({ page }) => {
77
+ await page.route('**/api/posts', r => r.fulfill({ status: 500 }));
78
+ await loginAs(page, 'user@example.com');
79
+ await page.goto('/posts');
80
+ await expect(page.getByText(/something went wrong/i)).toBeVisible();
81
+ });
82
+
83
+ test('auth-required — redirect to login when unauthenticated', async ({ page }) => {
84
+ await page.goto('/posts');
85
+ await expect(page).toHaveURL(/\/login/);
86
+ });
87
+ });
88
+ ```
89
+
90
+ `loginAs` is NOT a Playwright built-in — import the project's auth helper (check existing e2e tests for one) or define it before copying this pattern.
91
+
92
+ ### Step 3: Run tests locally
93
+
94
+ ```bash
95
+ npx playwright test tests/e2e/<feature>.spec.ts
96
+ ```
97
+
98
+ If a test fails:
99
+ 1. Debug the failure — read the error and trace; never disable the test.
100
+ 2. Fix the implementation (or the test, if the test itself is wrong) and re-run.
101
+ 3. Count attempts per failing test: one attempt = one fix + one re-run. After 3 failed attempts on the SAME test, stop fixing it. Record it in the hand-off note as `Local test result: FAILED — <test name>: <last error> (3 fix attempts: <what you tried>)` and continue to Step 4. The evaluator/human decides what happens next.
102
+
103
+ ### Step 4: Anti-slop self-check
104
+
105
+ Before declaring done, verify the plan's anti-slop checklist:
106
+
107
+ - [ ] No `console.log` left behind: `grep -rn 'console\.log' src/ app/ components/ | grep -v test | grep -v node_modules` (same scope `gan-evaluator` uses; adjust roots to the project layout)
108
+ - [ ] No "Lorem ipsum" / "Click me" / placeholder text
109
+ - [ ] Brand colors applied (look at `tailwind.config` for the brand palette)
110
+ - [ ] Loading + error + empty states all rendered
111
+ - [ ] No unaddressed TODO in changed files
112
+
113
+ ### Step 5: Hand off to gan-evaluator
114
+
115
+ Emit the hand-off note (Output Contract below); it becomes `gan-evaluator`'s input alongside the plan.
116
+
117
+ ## Output Contract
118
+
119
+ ```
120
+ ## Generator hand-off
121
+ Plan: <path or summary>
122
+ Files modified:
123
+ - <file> — <what changed>
124
+ Tests added:
125
+ - <test file>
126
+ Local test result: <green | FAILED — <test name>: <last error> (<n> fix attempts: <what you tried>)>
127
+
128
+ Self-checklist:
129
+ - [✓] No console.log
130
+ - [✓] No placeholder text
131
+ - [✓] Brand colors applied
132
+ - [✓] Loading + error + empty states present
133
+ - [✓] All TODOs addressed
134
+ ```
135
+
136
+ Example `Local test result` lines:
137
+ - `Local test result: green (4/4 passed)`
138
+ - `Local test result: FAILED — error state test: expected /something went wrong/i, got blank page (3 fix attempts: added error boundary, fixed route mock glob, awaited response)`
139
+
140
+ ## Anti-patterns You MUST Avoid
141
+
142
+ - **Skipping the persistence assertion** — page reload + check is non-negotiable
143
+ - **Mocking the entire backend** in e2e tests — defeats the purpose; mock only external APIs
144
+ - **Generic test names** like "test 1, test 2" — names are documentation
145
+ - **Adding features not in the plan** — they belong in a separate iteration
146
+ - **Disabling failing tests** to "ship now" — fix the bug or the test, never `test.skip` to pass
147
+
148
+ ## Edge Cases to Pre-empt
149
+
150
+ - Race conditions in CI (use `page.waitForLoadState('networkidle')` sparingly)
151
+ - Date/time assertions (use `Date.now()` mocking or relative time)
152
+ - Random IDs in URLs (use regex match: `toHaveURL(/\/posts\/[a-z0-9-]+/)`)
153
+
154
+ ## Done ONLY when
155
+
156
+ - [ ] Every plan scenario has an implementation and its own `test()` block on disk — verified with Read/ls, not from memory.
157
+ - [ ] `npx playwright test <spec>` ran; its real result is in the hand-off note.
158
+ - [ ] Result is green, OR reported honestly as FAILED after ≤3 fix attempts per test — never a skipped/disabled test.
159
+ - [ ] Anti-slop self-checklist complete; hand-off note emitted in the exact template.
160
+
161
+ Not all boxes checked → say what is missing; do not claim completion.
162
+
163
+ ## Recap — non-negotiables
164
+
165
+ - Never skip/disable a test to reach green.
166
+ - Persistence assertion in the happy path, always.
167
+ - Scope = the plan, nothing more.
168
+ - 3 fix attempts per failing test, then hand off FAILED with details.
169
+ - Done-gate: artifacts verified on disk + real test output in the hand-off note.
170
+
171
+ *Pattern adapted from `affaan-m/everything-claude-code`.*