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,195 @@
1
+ ---
2
+ description: Unified review orchestrator — detect changes, dispatch reviewers, validate findings, optionally post GitHub inline comments
3
+ argument-hint: "[base-branch | PR#number | --full] [--comment] (default: HEAD~1)"
4
+ allowed-tools: Bash, Read, Grep, Glob, Agent
5
+ ---
6
+
7
+ # Unified Orchestrated Code Review
8
+
9
+ Detect changed files, dispatch specialized reviewer agents in parallel with injected git context, independently validate every finding, and produce a deduplicated report. Optionally post the results to a GitHub PR.
10
+
11
+ ## Target
12
+
13
+ $ARGUMENTS
14
+
15
+ ## Hard Rules
16
+
17
+ 1. Review ONLY the diff scope — changed lines plus their surrounding context. Pre-existing issues outside the diff are out of scope (exception: `--full` reviews all tracked files).
18
+ 2. Dispatch each agent **at most once**, and only agents that exist in `.claude/agents/`.
19
+ 3. Every HIGH/MEDIUM-confidence finding passes independent validation (Step 5) before reaching the report. LOW-confidence (<60) items skip validation and go to **Open Questions** — never silently dropped.
20
+ 4. **goal-verifier** produces a verdict report (PASS / NEEDS-ATTENTION / NEEDS-REMEDIATION), not severity findings — its output bypasses Steps 4–6 validation and lands in its own report section.
21
+ 5. Zero confirmed findings is a valid outcome — report "clean" honestly, do not pad.
22
+
23
+ ## Step 1 — Parse Arguments and Detect Changes
24
+
25
+ **Flags:** `--comment` → post GitHub PR comments (default: terminal only). Remaining argument → diff target.
26
+
27
+ **Diff base:**
28
+ - `PR#NNN` or a number → `gh pr diff $TARGET --name-only`
29
+ - branch name → `git diff --name-only $TARGET...HEAD`
30
+ - `--full` → all tracked files (`git ls-files`)
31
+ - empty → `git diff --name-only HEAD~1`
32
+
33
+ **Gather context** (run in parallel):
34
+ ```bash
35
+ git diff --stat ${BASE}...HEAD # changed files + line counts
36
+ git diff ${BASE}...HEAD # full hunks for agent injection
37
+ git log --oneline -5 # intent
38
+ gh pr view $PR_NUMBER --json title,body 2>/dev/null # PR mode only
39
+ ```
40
+
41
+ Build a `REVIEW_CONTEXT` block:
42
+ ```
43
+ === REVIEW CONTEXT ===
44
+ ## PR Info (if available)
45
+ Title / Description (first 500 chars)
46
+ ## Changed Files (N files, +X/-Y)
47
+ <git diff --stat>
48
+ ## Recent Commits (intent)
49
+ <git log --oneline -5>
50
+ ## Diff Hunks
51
+ <diff, truncated to 8000 chars per agent if needed>
52
+ === END CONTEXT ===
53
+ ```
54
+
55
+ ## Step 2 — Map Files to Agents
56
+
57
+ | File pattern | Agents |
58
+ |---|---|
59
+ | `*.go` (excluding `*_test.go`, migrations) | **go-reviewer**, **security-scanner** |
60
+ | `migrations/*.sql` or `db/migrate/*.sql` | **migration-reviewer**, **database-reviewer** |
61
+ | Data-access files (`*_repo.go`, repositories) | **database-reviewer** |
62
+ | `*.tsx` | **ts-reviewer**, **design-system-reviewer** |
63
+ | `*.ts` | **ts-reviewer** |
64
+ | `*.py` | **py-reviewer**, **security-scanner** |
65
+ | `*.rs` | **rs-reviewer** |
66
+ | `**/bot*/**/*.go` or `**/bot*/**/*.py` | **bot-reviewer** |
67
+ | `*.yaml` / `*.yml` (OpenAPI/GraphQL) | **api-contract-sync** |
68
+ | Any changed code files | **silent-failure-hunter**, **comment-rot-analyzer** |
69
+ | Any changed code files, IF an implementation plan exists in `docs/superpowers/plans/` | **goal-verifier** (verdict track — Hard Rule 4) |
70
+
71
+ Rules: skip agents missing from `.claude/agents/`; if no files match any pattern, report "No reviewable changes detected" and stop; print the dispatch plan (agent + matched file count) before executing.
72
+
73
+ ## Step 3 — Dispatch All Agents in Parallel
74
+
75
+ All triggered agents are independent — dispatch ALL of them simultaneously in one message. For each, inject the `REVIEW_CONTEXT` block filtered to its files:
76
+
77
+ - **go-reviewer** → `*.go` hunks (minus tests/migrations) · **ts-reviewer** → `*.ts`/`*.tsx` · **py-reviewer** → `*.py` · **rs-reviewer** → `*.rs` · **migration-reviewer**/**database-reviewer** → SQL + data-access hunks · **bot-reviewer** → bot hunks · **design-system-reviewer** → `*.tsx`/`*.vue`/`*.svelte` UI hunks · **api-contract-sync** → spec hunks
78
+ - Cross-cutting, receive ALL hunks: **security-scanner**, **silent-failure-hunter**, **comment-rot-analyzer**, **goal-verifier**
79
+
80
+ Prompt template for each reviewer:
81
+ ```
82
+ Start with Phase 0 — read project docs (CLAUDE.md/AGENTS.md + relevant docs/architecture/) before reviewing.
83
+
84
+ {REVIEW_CONTEXT — filtered to your files}
85
+
86
+ ## Your Task
87
+ Review the diff hunks against your checklist. Recent commits show intent — judge whether changes are complete and consistent with it. Focus on: contradictions with commit intent, missing pieces (e.g. "add endpoint" but no route registration), regressions in existing patterns.
88
+ Report in your standard output format. Every finding MUST include: file, line, severity, confidence, description, evidence, fix.
89
+ ```
90
+
91
+ Exception — **goal-verifier** (verdict track, Hard Rule 4): instead of the checklist task above, give it ALL hunks plus the implementation plan path from `docs/superpowers/plans/` and request its verdict report.
92
+
93
+ ## Step 4 — Collect and Triage Findings
94
+
95
+ Merge all findings (excluding goal-verifier — verdict track). Each must carry: `file`, `line`, `severity` (CRITICAL/WARNING/SUGGESTION), `confidence` (HIGH ≥80 / MEDIUM 60–79 / LOW <60), `agent`, `description`, `evidence`, `fix`.
96
+
97
+ Triage — route, don't drop:
98
+ - LOW confidence → **Open Questions** bucket (appears in the final report; skips validation).
99
+ - SUGGESTION from a non-primary reviewer for that file type → validate last; if you skip its validation, route it to Open Questions — never to the confirmed sections (Hard Rule 3).
100
+ - Everything else → validation queue.
101
+
102
+ ## Step 5 — Validate Findings (Double Verification)
103
+
104
+ Launch one validation agent PER FINDING, all in parallel:
105
+
106
+ ```
107
+ You are a code review validator. Independently verify whether a reported issue is real.
108
+
109
+ ## Reported Issue
110
+ Agent: {agent} · File: {file}:{line} · Severity: {severity}
111
+ Description: {description}
112
+ Evidence: {evidence}
113
+
114
+ ## Your Task
115
+ 1. Read the file at the reported location (the actual file, not the diff).
116
+ 2. Read ±20 lines of surrounding context.
117
+ 3. Decide: is the problem real? Could it be a false positive (pre-existing, intentional, linter-covered)? Is the severity right?
118
+
119
+ ## Verdict — reply with exactly one of:
120
+ CONFIRMED — real and correctly described
121
+ DOWNGRADE — real but severity should be lower (say which and why)
122
+ REJECTED — false positive (say why)
123
+
124
+ Be strict. When in doubt, REJECT — false positives waste more time than missed issues.
125
+ ```
126
+
127
+ Apply verdicts: REJECTED → dropped (counted in validation stats); DOWNGRADE → severity adjusted; CONFIRMED → kept. Validators reading the real file also catch stale/wrong line references.
128
+
129
+ ## Step 6 — Deduplicate and Report
130
+
131
+ 1. Deduplicate: same file:line flagged twice → keep the higher-severity confirmed finding.
132
+ 2. Group and print:
133
+
134
+ ```
135
+ ### Blocking (CRITICAL confirmed)
136
+ - [agent] file:line — description
137
+ ### Important (WARNING confirmed)
138
+ - [agent] file:line — description
139
+ ### Nit (SUGGESTION confirmed)
140
+ - [agent] file:line — description
141
+ ### Open Questions (LOW confidence — surfaced, not dropped)
142
+ - [agent] file:line — suspicion + what would confirm it
143
+ ### Goal Verification (only if goal-verifier ran)
144
+ Verdict: PASS / NEEDS-ATTENTION / NEEDS-REMEDIATION + its gap list verbatim
145
+ ```
146
+
147
+ 3. Summary table:
148
+
149
+ | Agent | Blocking | Important | Nit | Raw | Confirmed | Status |
150
+ |-------|----------|-----------|-----|-----|-----------|--------|
151
+ | go-reviewer | 0 | 2 | 1 | 5 | 3 | PASS |
152
+
153
+ Status per agent: **FAIL** if any Blocking, **WARN** if Important only, **PASS** otherwise.
154
+
155
+ 4. Validation stats: "X findings reported → Y confirmed (Z% hit rate), R rejected".
156
+
157
+ 5. Confidence distribution:
158
+
159
+ | Band | Count | Route |
160
+ |------|-------|-------|
161
+ | HIGH (80–100) | N | validated (Step 5) |
162
+ | MEDIUM (60–79) | N | validated (Step 5) |
163
+ | LOW (<60) | N | Open Questions — surfaced, not dropped |
164
+
165
+ ### Overall Verdict
166
+ **PASS / WARN / FAIL** — FAIL if any Blocking confirmed; WARN if Important only; PASS otherwise. One line naming the most critical confirmed finding (or "clean").
167
+
168
+ ## Step 7 — Post GitHub Comments (only if --comment)
169
+
170
+ No `--comment` → stop here (terminal output only).
171
+
172
+ With `--comment`, post ONE summary comment via `gh pr comment $PR_NUMBER --body "..."` containing: confirmed-issue count (raw → confirmed), the Blocking/Important lists with GitHub permalinks, the summary table, and the validation hit rate. If zero confirmed issues, post the clean-review variant ("No issues found. Agents dispatched: […]. Findings: 0 confirmed of X raw.").
173
+
174
+ Permalink format (exact, or GitHub won't render):
175
+ ```
176
+ https://github.com/OWNER/REPO/blob/FULL_SHA/path/to/file.ext#LSTART-LEND
177
+ ```
178
+ `FULL_SHA` = full 40-char `git rev-parse HEAD`; include ≥1 context line on each side in the range.
179
+
180
+ ## Done ONLY when
181
+
182
+ - [ ] Every agent in the printed dispatch plan returned (or is named as skipped/failed — never silently absent).
183
+ - [ ] Every HIGH/MEDIUM finding carries an applied validation verdict (CONFIRMED / DOWNGRADE / REJECTED).
184
+ - [ ] Dedup ran and the full report printed: severity groups + summary table + validation stats + confidence distribution + Overall Verdict.
185
+ - [ ] If `--comment` was given: the PR comment was actually posted (show the `gh` output).
186
+
187
+ Not all boxes checked → say what is missing; do not claim the review is complete.
188
+
189
+ ## Recap — non-negotiables
190
+
191
+ - Diff scope only (unless `--full`); pre-existing issues are not findings.
192
+ - Every reported finding survived independent validation; LOW confidence → Open Questions, never dropped silently.
193
+ - goal-verifier is a verdict, not findings — separate report section.
194
+ - Clean review is a valid review.
195
+ - `--comment` requires an authenticated `gh` CLI.
@@ -0,0 +1,142 @@
1
+ ---
2
+ description: Run AgentShield security scan on .claude/ configurations — detect secrets, permission issues, hook injection, MCP vulnerabilities
3
+ argument-hint: "[--fix] [--opus] [--format json|markdown]"
4
+ allowed-tools: Bash, Read
5
+ ---
6
+
7
+ # Security Scan
8
+
9
+ Run AgentShield to audit `.claude/` configurations for vulnerabilities (102 rules, 5 categories), then report the score and findings.
10
+
11
+ ## Target
12
+
13
+ $ARGUMENTS
14
+
15
+ ## Hard Rules
16
+
17
+ - Report ONLY what the scanner actually output — never invent a score, grade, or finding. If the scan cannot run or exits with an error, report that error and stop.
18
+ - AgentShield grades on its own scale `critical / high / medium / low`. Relay it verbatim; do NOT remap it to the kit's CRITICAL / WARNING / SUGGESTION.
19
+ - Run the scan at most once, using the single Step 2 command that matches the flags in Target.
20
+ - `--opus` needs `ANTHROPIC_API_KEY` set in the environment; if it is unset, run without `--opus` and say so.
21
+ - Emit the report only after the scan command has actually returned.
22
+
23
+ ## Step 1 — Check AgentShield availability
24
+
25
+ ```bash
26
+ npx ecc-agentshield --version
27
+ ```
28
+
29
+ Branch on the result:
30
+ - **Prints a version** → installed; go to Step 2.
31
+ - **Errors because the package is not cached yet** → `npx` will download `ecc-agentshield` on first run in Step 2; go to Step 2.
32
+ - **`npx` unavailable, no network, or download fails** → report `AgentShield unavailable: <error>` and stop. Do not fabricate results.
33
+
34
+ Done when: you know whether the scan can run.
35
+
36
+ ## Step 2 — Run the scan
37
+
38
+ Select ONE command by the flags in Target (flags are independent; if Target names more than one, append each form to the single `scan` command):
39
+
40
+ | Flag in Target | Command |
41
+ |----------------|---------|
42
+ | (none) | `npx ecc-agentshield scan` |
43
+ | `--fix` | `npx ecc-agentshield scan --fix` — auto-remediate safe issues |
44
+ | `--opus` | `npx ecc-agentshield scan --opus --stream` — AI deep analysis (needs `ANTHROPIC_API_KEY`) |
45
+ | `--format json` | `npx ecc-agentshield scan --format json` — for CI integration |
46
+ | `--format markdown` | `npx ecc-agentshield scan --format markdown` — for reports |
47
+
48
+ If the command exits non-zero for a reason other than findings-present (e.g. a crash), report the exit code and stderr; do not invent a score.
49
+
50
+ Done when: the scan command has returned output, or its failure has been captured.
51
+
52
+ ## Step 3 — Report results
53
+
54
+ Extract from the scanner output and fill the Output Contract:
55
+ - Security score (0–100) and grade (A–F)
56
+ - Findings grouped by AgentShield severity: `critical → high → medium → low`
57
+ - Category breakdown (secrets, permissions, hooks, MCP, agents)
58
+
59
+ Threshold rules:
60
+ - Score < 70 → recommend re-running with `--fix`.
61
+ - Any `critical` findings → list the specific files and remediation steps.
62
+
63
+ Done when: score, grade, findings-by-severity, category breakdown, and the recommendation line are all present in the report.
64
+
65
+ ## What it checks (102 rules)
66
+
67
+ | Category | Rules | Examples |
68
+ |----------|:-----:|---------|
69
+ | Secrets | 10 | API keys, tokens, passwords in config files |
70
+ | Permissions | 10 | Wildcard Bash(*), missing deny lists |
71
+ | Hooks | 34 | Command injection, data exfiltration, silent error suppression |
72
+ | MCP Servers | 23 | Supply chain (npx -y), shell metacharacters, network exposure |
73
+ | Agent Configs | 25 | Prompt injection, hidden instructions, auto-run directives |
74
+
75
+ ## Output Contract
76
+
77
+ ```
78
+ ## Security Scan — AgentShield
79
+
80
+ Score: <0-100> Grade: <A-F>
81
+ Command run: <exact command from Step 2>
82
+
83
+ ### Findings by severity (AgentShield scale, not the kit's)
84
+ | Severity | Count |
85
+ |----------|:-----:|
86
+ | critical | <N> |
87
+ | high | <N> |
88
+ | medium | <N> |
89
+ | low | <N> |
90
+
91
+ ### Category breakdown
92
+ | Category | Findings |
93
+ |---------------|:--------:|
94
+ | Secrets | <N> |
95
+ | Permissions | <N> |
96
+ | Hooks | <N> |
97
+ | MCP Servers | <N> |
98
+ | Agent Configs | <N> |
99
+
100
+ ### Critical findings (only if any)
101
+ - <file> — <issue> → <remediation>
102
+
103
+ Recommendation: <e.g. "Score 62 < 70 — re-run with --fix" | "No critical findings; score 88 (B)">
104
+ ```
105
+
106
+ Mini example:
107
+
108
+ ```
109
+ ## Security Scan — AgentShield
110
+
111
+ Score: 62 Grade: D
112
+ Command run: npx ecc-agentshield scan
113
+
114
+ ### Findings by severity (AgentShield scale, not the kit's)
115
+ | Severity | Count |
116
+ |----------|:-----:|
117
+ | critical | 1 |
118
+ | high | 3 |
119
+ | medium | 5 |
120
+ | low | 2 |
121
+
122
+ ### Category breakdown
123
+ | Category | Findings |
124
+ |---------------|:--------:|
125
+ | Secrets | 1 |
126
+ | Permissions | 4 |
127
+ | Hooks | 3 |
128
+ | MCP Servers | 2 |
129
+ | Agent Configs | 1 |
130
+
131
+ ### Critical findings
132
+ - .claude/settings.json — hardcoded API key in env block → move to a secret manager / .env not committed
133
+
134
+ Recommendation: Score 62 < 70 — re-run with --fix.
135
+ ```
136
+
137
+ ## Recap — non-negotiables
138
+
139
+ - Never fabricate a score or finding; the scan must actually run first, and a failed scan is reported as an error.
140
+ - AgentShield's `critical/high/medium/low` is the tool's own scale — relay it verbatim, do not remap.
141
+ - Run the scan at most once, matching the Target flags.
142
+ - Score < 70 → recommend `--fix`; any `critical` finding → list the files and their remediation.
@@ -0,0 +1,231 @@
1
+ ---
2
+ description: Incremental documentation update — detect drift, fix stale docs, add missing coverage
3
+ argument-hint: "[--fix-all]"
4
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep, Agent
5
+ ---
6
+
7
+ # Superkit Evolve — Incremental Documentation Update
8
+
9
+ Detect what is outdated or missing in the documentation of a project already using superkit, then fix it. Six drift checks → report → confirmed fixes → verified commit.
10
+
11
+ ## Mode
12
+
13
+ $ARGUMENTS
14
+
15
+ | Arguments | Mode | Behavior |
16
+ |-----------|------|----------|
17
+ | (empty) | interactive | Report issues in Step 7, ask before fixing |
18
+ | `--fix-all` | automatic | Print the Step 7 scan block, skip the prompt, fix everything except [UNKNOWN] |
19
+
20
+ ## Hard Rules
21
+
22
+ 1. Run ALL six checks (Steps 1–6) before reporting. A check whose command fails or whose value cannot be parsed records an **[UNKNOWN]** issue with the reason — never guess a value, never claim drift from an unparsed value.
23
+ 2. Interactive mode: fix NOTHING until the user confirms in Step 7.
24
+ 3. Touch only documentation and config: `docs/`, `CLAUDE.md`, `.claude/rules/`, `.claude/scripts/hooks/`. Never edit application source code.
25
+ 4. Canonical architecture doc names are the shipped template names (Step 2 table): `api-reference.md`, `frontend-state.md`, etc. Do not check for or generate other spellings.
26
+ 5. A fix counts as FIXED only after re-running the check that produced the issue and seeing it pass.
27
+ 6. Use the portable commands below as written — they run on both macOS and Linux. Do not substitute `grep -P` or `stat -f` variants.
28
+ 7. Zero issues is a valid result — emit the final report saying so; do not manufacture drift.
29
+
30
+ ## Step 1 — Migration Counter Drift
31
+
32
+ ```bash
33
+ # Count actual migrations
34
+ ACTUAL=$(find . -path "*/migrations/*" -name "*.up.sql" -not -path "*/node_modules/*" 2>/dev/null | wc -l | tr -d ' ')
35
+ # Extract claimed upper counter from CLAUDE.md: last NNN..NNN range on the first matching line, zero-padding stripped
36
+ CLAIMED=$(grep -E '[0-9]{3,}\.\.[0-9]{3,}' CLAUDE.md 2>/dev/null | head -1 | sed -n 's/.*\.\.0*\([1-9][0-9]*\).*/\1/p')
37
+ ```
38
+
39
+ Branches (exactly one applies):
40
+ - `ACTUAL` is 0 but a `migrations/` directory exists → recount with `-name "*.sql"` (project without `.up/.down` split), then continue below.
41
+ - No migrations in the project at all → no issue, done.
42
+ - `CLAIMED` empty while `ACTUAL > 0` → issue `[UNKNOWN] Migration counter not parseable from CLAUDE.md (actual: $ACTUAL)`.
43
+ - `CLAIMED != ACTUAL` → issue `[DRIFT] Migration counter (CLAUDE.md: $CLAIMED, actual: $ACTUAL)`.
44
+ - `CLAIMED == ACTUAL` → no issue.
45
+
46
+ Done when: one branch recorded.
47
+
48
+ ## Step 2 — Missing Architecture Docs
49
+
50
+ For each detected component, run the check:
51
+
52
+ | Component present | Expected doc | Check |
53
+ |-------------------|-------------|-------|
54
+ | `go.mod` or backend code | `backend-layers.md` | `test -f docs/architecture/backend-layers.md` |
55
+ | API route files | `api-reference.md` | `test -f docs/architecture/api-reference.md` |
56
+ | `migrations/` dir | `database-schema.md` | `test -f docs/architecture/database-schema.md` |
57
+ | Auth code | `auth-and-sessions.md` | `test -f docs/architecture/auth-and-sessions.md` |
58
+ | Frontend code | `frontend-state.md` | `test -f docs/architecture/frontend-state.md` |
59
+ | Docker/CI files | `deployment.md` | `test -f docs/architecture/deployment.md` |
60
+
61
+ Component present + check fails → issue `[MISSING] docs/architecture/<doc>`.
62
+
63
+ Done when: every row with a present component was tested.
64
+
65
+ ## Step 3 — Tree Freshness
66
+
67
+ ```bash
68
+ NEWEST_TREE=$(ls -t docs/trees 2>/dev/null | grep '^tree-.*\.md$' | head -1)
69
+ if [ -n "$NEWEST_TREE" ]; then
70
+ NEWEST_TREE="docs/trees/$NEWEST_TREE"
71
+ # Parentheses group the -name alternatives so -newer applies to ALL of them
72
+ NEW_FILES=$(find . -newer "$NEWEST_TREE" \
73
+ \( -name "*.go" -o -name "*.ts" -o -name "*.tsx" -o -name "*.py" \) \
74
+ -not -path "*/node_modules/*" -not -path "*/.git/*" | wc -l | tr -d ' ')
75
+ fi
76
+ ```
77
+
78
+ Branches:
79
+ - `NEWEST_TREE` empty → issue `[MISSING] No tree files in docs/trees/`.
80
+ - `NEW_FILES > 10` → issue `[STALE] Tree outdated — $NEW_FILES new source files since last generation`.
81
+ - Otherwise → no issue.
82
+
83
+ Done when: one branch recorded.
84
+
85
+ ## Step 4 — Rule Path Validity
86
+
87
+ Verify every path referenced in `.claude/rules/documentation.md` still exists:
88
+
89
+ ```bash
90
+ grep -o '`[^`]*`' .claude/rules/documentation.md 2>/dev/null | tr -d '`' | while read -r pattern; do
91
+ case "$pattern" in
92
+ */*) sh -c "ls -- $pattern" >/dev/null 2>&1 || echo "BROKEN PATH: $pattern" ;; # sh -c expands globs in any parent shell
93
+ esac
94
+ done
95
+ ```
96
+
97
+ Only strings containing `/` are treated as paths; other backticked spans (commands, names) are skipped.
98
+
99
+ - Rule file absent → issue `[MISSING] .claude/rules/documentation.md not installed`.
100
+ - Each `BROKEN PATH` line → issue `[BROKEN] Rule path: <pattern>`.
101
+
102
+ Done when: rule file checked and every path-like span tested.
103
+
104
+ ## Step 5 — New Components Without Docs
105
+
106
+ ```bash
107
+ for dir in */ ; do
108
+ d=${dir%/}
109
+ case "$d" in node_modules|vendor|dist|build|docs|test|tests) continue ;; esac
110
+ SRC=$(find "$d" \( -name "*.go" -o -name "*.ts" -o -name "*.tsx" -o -name "*.py" -o -name "*.rs" \) \
111
+ -not -path "*/node_modules/*" 2>/dev/null | wc -l | tr -d ' ')
112
+ if [ "$SRC" -ge 5 ] && ! ls docs/architecture 2>/dev/null | grep -Fq -- "$d"; then
113
+ echo "UNDOCUMENTED: $d ($SRC source files)"
114
+ fi
115
+ done
116
+ ```
117
+
118
+ Then filter: drop any `UNDOCUMENTED` line whose directory is a conventional source root (`src`, `app`, `cmd`, `internal`, `pkg`, `lib`) already covered by an existing Step 2 doc (`backend-layers.md` for backend roots, `frontend-state.md` for frontend roots). Each remaining line → issue `[MISSING] No docs for <dir>/ component`.
119
+
120
+ Done when: every top-level code directory flagged or explicitly covered.
121
+
122
+ ## Step 6 — CLAUDE.md Staleness
123
+
124
+ Read `CLAUDE.md` and run three sub-checks:
125
+ - **Versions** — compare each version in the tech-stack table against actual `go.mod` / `package.json`. Mismatch → issue `[DRIFT] CLAUDE.md stack table: <component> says X, actual Y`.
126
+ - **Coverage** — list `docs/architecture/` (Glob or `ls`); a doc on disk missing from the Architecture Reference table → issue `[DRIFT] Architecture table missing <doc>`.
127
+ - **Dead links** — a doc path referenced in CLAUDE.md that fails `test -f` → issue `[BROKEN] Dead reference: <path>`.
128
+
129
+ Done when: all three sub-checks ran.
130
+
131
+ ## Step 7 — Report and Confirm
132
+
133
+ Print the scan block (both modes):
134
+
135
+ ```
136
+ 📊 superkit-evolve scan complete — 6/6 checks run
137
+
138
+ Found N issues:
139
+
140
+ 1. [DRIFT] Migration counter: CLAUDE.md says 48, actual is 50
141
+ 2. [MISSING] No docs for workers/ component
142
+ 3. [STALE] Tree outdated — 22 new files since last generation
143
+ 4. [BROKEN] Rule path: services/feed/*.go → should be services/feed_engine/*.go
144
+ 5. [UNKNOWN] Migration counter not parseable from CLAUDE.md
145
+
146
+ Fix? [yes / issue numbers / no]
147
+ ```
148
+
149
+ If `N == 0`: skip Steps 8–9, go straight to Output.
150
+
151
+ **Interactive mode** — handle the reply:
152
+
153
+ | Reply | Action |
154
+ |-------|--------|
155
+ | `yes` | fix every issue |
156
+ | issue numbers (e.g. `1 3`) | fix only those; mark the rest `SKIPPED (user)` |
157
+ | `no` / `skip` | fix nothing; mark all `SKIPPED (user)`; still emit the Output report |
158
+ | anything else | ask once more; still unclear → treat as `no` |
159
+
160
+ **--fix-all mode**: print the scan block without the final `Fix?` line; fix every issue without waiting. In BOTH modes, `[UNKNOWN]` issues are never fixed automatically — mark them `SKIPPED (needs human)`.
161
+
162
+ Done when: every issue has a decision (fix or skip).
163
+
164
+ ## Step 8 — Fix
165
+
166
+ For each issue selected for fixing:
167
+
168
+ | Issue | Fix |
169
+ |-------|-----|
170
+ | Migration counter drift | Update the migration range in CLAUDE.md to the actual count |
171
+ | Missing architecture doc | Generate from code following the /superkit-init doc-generation procedure; use the canonical name from the Step 2 table |
172
+ | Stale tree | Regenerate `docs/trees/` using tree/find |
173
+ | Broken rule path | Grep for where the files moved, update the rule with the correct path |
174
+ | CLAUDE.md staleness | Re-read go.mod/package.json, update versions; sync the Architecture Reference table |
175
+ | New component without docs | Generate an architecture doc named `<component>-<topic>.md` |
176
+ | Dead architecture reference | Doc should exist → regenerate it; obsolete → remove the reference |
177
+
178
+ After each fix, re-run the Step 1–6 check that produced the issue: pass → `FIXED`; fail → retry the fix once; still failing → `SKIPPED (fix failed: <error>)`.
179
+
180
+ Done when: every selected issue is FIXED or SKIPPED (fix failed).
181
+
182
+ ## Step 9 — Commit
183
+
184
+ Only when at least one issue is FIXED:
185
+
186
+ ```bash
187
+ git add docs/ CLAUDE.md .claude/rules/ .claude/scripts/hooks/
188
+ git commit -m "docs: superkit-evolve — fix N documentation issues
189
+
190
+ Fixed:
191
+ - [list of fixes]
192
+
193
+ Co-Authored-By: Claude <noreply@anthropic.com>"
194
+ git rev-parse --short HEAD
195
+ ```
196
+
197
+ Done when: commit created and sha captured, or no fixes were applied.
198
+
199
+ ## Output
200
+
201
+ End with exactly this report:
202
+
203
+ ```
204
+ ✅ superkit-evolve complete
205
+
206
+ | # | Issue | Result |
207
+ |---|-------|--------|
208
+ | 1 | [DRIFT] Migration counter 48 → 50 | FIXED |
209
+ | 2 | [MISSING] No docs for workers/ | SKIPPED (user) |
210
+
211
+ Checks run: 6/6 · Found: 2 · Fixed: 1 · Skipped: 1
212
+ Commit: a1b2c3d
213
+ ```
214
+
215
+ - `Found: 0` → table replaced by the line `No documentation drift detected.`
216
+ - No fixes applied → `Commit: none`.
217
+
218
+ ## Done ONLY when
219
+
220
+ - [ ] All six checks (Steps 1–6) ran; command failures recorded as [UNKNOWN], not guessed.
221
+ - [ ] Every issue in the final table is FIXED (its check re-run and passing) or SKIPPED with a reason.
222
+ - [ ] Commit created if at least one fix was applied, and its sha is in the report.
223
+ - [ ] Final report emitted in the exact Output format.
224
+
225
+ ## Recap
226
+
227
+ - All six checks run before any report; unparseable values become [UNKNOWN], never claimed drift.
228
+ - Interactive mode fixes nothing without confirmation; `--fix-all` fixes everything except [UNKNOWN].
229
+ - Docs and config only — never application source code.
230
+ - FIXED means the originating check was re-run and passes; then commit, sha in the report.
231
+ - Canonical doc names come from the Step 2 table (`api-reference.md`, `frontend-state.md`).