contextdevkit 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (345) hide show
  1. package/CHANGELOG.md +592 -0
  2. package/LICENSE +21 -0
  3. package/README.md +401 -0
  4. package/docs/AGENT-PACKAGE-FORMAT.md +140 -0
  5. package/docs/ARCHITECTURE.md +258 -0
  6. package/docs/CHANGELOG.md +559 -0
  7. package/docs/CUSTOMIZING.md +211 -0
  8. package/docs/LEVELS.md +151 -0
  9. package/docs/ROADMAP.md +385 -0
  10. package/docs/SQUAD-PIPELINE-FORMAT.md +258 -0
  11. package/docs/SQUADS/agent-forge.md +65 -0
  12. package/docs/SQUADS/design-team.md +161 -0
  13. package/docs/token-economy-plan.md +135 -0
  14. package/install.mjs +273 -0
  15. package/instrucoes.md +274 -0
  16. package/package.json +46 -0
  17. package/templates/CLAUDE.md.tpl +133 -0
  18. package/templates/claude/agents/_TEMPLATE.md +52 -0
  19. package/templates/claude/agents/accessibility.md +36 -0
  20. package/templates/claude/agents/agent-architect.md +37 -0
  21. package/templates/claude/agents/architect.md +39 -0
  22. package/templates/claude/agents/code-reviewer.md +43 -0
  23. package/templates/claude/agents/code-security.md +59 -0
  24. package/templates/claude/agents/context-keeper.md +40 -0
  25. package/templates/claude/agents/devops.md +40 -0
  26. package/templates/claude/agents/eval-designer.md +40 -0
  27. package/templates/claude/agents/forge-orchestrator.md +42 -0
  28. package/templates/claude/agents/governance-officer.md +45 -0
  29. package/templates/claude/agents/growth.md +92 -0
  30. package/templates/claude/agents/infra-security.md +53 -0
  31. package/templates/claude/agents/landing-architect.md +154 -0
  32. package/templates/claude/agents/model-router.md +34 -0
  33. package/templates/claude/agents/packager.md +38 -0
  34. package/templates/claude/agents/privacy-lgpd.md +64 -0
  35. package/templates/claude/agents/product-owner.md +51 -0
  36. package/templates/claude/agents/prompt-engineer.md +33 -0
  37. package/templates/claude/agents/qa-e2e.md +52 -0
  38. package/templates/claude/agents/qa-fuzzer.md +24 -0
  39. package/templates/claude/agents/qa-integration.md +21 -0
  40. package/templates/claude/agents/qa-orchestrator.md +40 -0
  41. package/templates/claude/agents/qa-perf.md +40 -0
  42. package/templates/claude/agents/qa-unit.md +39 -0
  43. package/templates/claude/agents/rag-designer.md +54 -0
  44. package/templates/claude/agents/retention.md +85 -0
  45. package/templates/claude/agents/security.md +48 -0
  46. package/templates/claude/agents/seo-specialist.md +106 -0
  47. package/templates/claude/agents/test-engineer.md +48 -0
  48. package/templates/claude/agents/tool-designer.md +32 -0
  49. package/templates/claude/agents/ui-designer.md +37 -0
  50. package/templates/claude/agents/ux-designer.md +38 -0
  51. package/templates/claude/commands/README.md +95 -0
  52. package/templates/claude/commands/advise.md +80 -0
  53. package/templates/claude/commands/audit/analyze-code-ia-practices.md +75 -0
  54. package/templates/claude/commands/audit/audit.md +35 -0
  55. package/templates/claude/commands/audit/contract-check.md +21 -0
  56. package/templates/claude/commands/audit/deep-analysis.md +48 -0
  57. package/templates/claude/commands/audit/deps-audit.md +49 -0
  58. package/templates/claude/commands/audit/security-setup.md +35 -0
  59. package/templates/claude/commands/audit/seo-audit.md +63 -0
  60. package/templates/claude/commands/audit/tech-debt-sweep.md +35 -0
  61. package/templates/claude/commands/bug-hunt.md +42 -0
  62. package/templates/claude/commands/claude-md.md +36 -0
  63. package/templates/claude/commands/close-version.md +25 -0
  64. package/templates/claude/commands/context-refresh.md +19 -0
  65. package/templates/claude/commands/context-stats.md +15 -0
  66. package/templates/claude/commands/dashboard.md +66 -0
  67. package/templates/claude/commands/distill-apply.md +19 -0
  68. package/templates/claude/commands/distill-sessions.md +26 -0
  69. package/templates/claude/commands/fleet.md +47 -0
  70. package/templates/claude/commands/forge/forge-audit.md +16 -0
  71. package/templates/claude/commands/forge/forge-budget.md +16 -0
  72. package/templates/claude/commands/forge/forge-deprecate.md +16 -0
  73. package/templates/claude/commands/forge/forge-doctor.md +17 -0
  74. package/templates/claude/commands/forge/forge-eval.md +16 -0
  75. package/templates/claude/commands/forge/forge-fallback-test.md +17 -0
  76. package/templates/claude/commands/forge/forge-killswitch.md +17 -0
  77. package/templates/claude/commands/forge/forge-list.md +17 -0
  78. package/templates/claude/commands/forge/forge-new.md +41 -0
  79. package/templates/claude/commands/forge/forge-policy.md +16 -0
  80. package/templates/claude/commands/forge/forge-redteam.md +17 -0
  81. package/templates/claude/commands/forge/forge-refresh-matrix.md +20 -0
  82. package/templates/claude/commands/forge/forge-route.md +17 -0
  83. package/templates/claude/commands/forge/forge-show.md +16 -0
  84. package/templates/claude/commands/landing-page.md +71 -0
  85. package/templates/claude/commands/log-session.md +59 -0
  86. package/templates/claude/commands/media-gen.md +93 -0
  87. package/templates/claude/commands/new-adr.md +30 -0
  88. package/templates/claude/commands/pipeline/dev-start.md +64 -0
  89. package/templates/claude/commands/pipeline/pipeline.md +36 -0
  90. package/templates/claude/commands/pipeline/resume.md +70 -0
  91. package/templates/claude/commands/pipeline/retro.md +34 -0
  92. package/templates/claude/commands/pipeline/runs.md +63 -0
  93. package/templates/claude/commands/pipeline/ship.md +54 -0
  94. package/templates/claude/commands/pipeline/workflow.md +85 -0
  95. package/templates/claude/commands/playbook.md +27 -0
  96. package/templates/claude/commands/predictions-review.md +28 -0
  97. package/templates/claude/commands/qa/qa-signoff.md +24 -0
  98. package/templates/claude/commands/qa/scaffold-tests.md +27 -0
  99. package/templates/claude/commands/qa/test-plan.md +26 -0
  100. package/templates/claude/commands/qa/visual-test.md +42 -0
  101. package/templates/claude/commands/roadmap.md +48 -0
  102. package/templates/claude/commands/setup/aidevtool-from0.md +104 -0
  103. package/templates/claude/commands/setup/context-config.md +25 -0
  104. package/templates/claude/commands/setup/context-doctor.md +21 -0
  105. package/templates/claude/commands/setup/context-level.md +17 -0
  106. package/templates/claude/commands/setup/setupcontextdevkit.md +121 -0
  107. package/templates/claude/commands/simulate-impact.md +32 -0
  108. package/templates/claude/commands/squad.md +44 -0
  109. package/templates/claude/commands/state.md +21 -0
  110. package/templates/claude/commands/token-report.md +29 -0
  111. package/templates/claude/commands/tune-agents.md +35 -0
  112. package/templates/claude/commands/vcs/claim.md +18 -0
  113. package/templates/claude/commands/vcs/git.md +83 -0
  114. package/templates/claude/commands/vcs/release.md +15 -0
  115. package/templates/claude/commands/vcs/worktree-new.md +18 -0
  116. package/templates/claude/commands/watch.md +47 -0
  117. package/templates/contextkit/.env.example +36 -0
  118. package/templates/contextkit/CLAUDE.child.md.tpl +38 -0
  119. package/templates/contextkit/README.md +74 -0
  120. package/templates/contextkit/behaviors-examples.md +183 -0
  121. package/templates/contextkit/behaviors.md +116 -0
  122. package/templates/contextkit/best-practices.md +323 -0
  123. package/templates/contextkit/config.json +66 -0
  124. package/templates/contextkit/detectors/README.md +45 -0
  125. package/templates/contextkit/detectors/example-detector.mjs.example +25 -0
  126. package/templates/contextkit/instrucoes.md +114 -0
  127. package/templates/contextkit/memory/GLOSSARY.md +13 -0
  128. package/templates/contextkit/memory/SESSIONS.md +9 -0
  129. package/templates/contextkit/memory/WORKSPACE.md +7 -0
  130. package/templates/contextkit/memory/business-rules/_TEMPLATE.md +33 -0
  131. package/templates/contextkit/memory/decisions/0000-record-architecture-decisions.md +34 -0
  132. package/templates/contextkit/memory/decisions/_TEMPLATE.md +25 -0
  133. package/templates/contextkit/memory/predictions/.gitkeep +0 -0
  134. package/templates/contextkit/memory/roadmap.md +28 -0
  135. package/templates/contextkit/memory/sessions/.gitkeep +0 -0
  136. package/templates/contextkit/memory/workflows/.gitkeep +0 -0
  137. package/templates/contextkit/pipeline/backlog/.gitkeep +0 -0
  138. package/templates/contextkit/pipeline/conclusion/.gitkeep +0 -0
  139. package/templates/contextkit/pipeline/devpipeline.md +9 -0
  140. package/templates/contextkit/pipeline/testing/.gitkeep +0 -0
  141. package/templates/contextkit/pipeline/working/.gitkeep +0 -0
  142. package/templates/contextkit/review-protocol.md +214 -0
  143. package/templates/contextkit/runtime/config/defaults.mjs +215 -0
  144. package/templates/contextkit/runtime/config/levels.mjs +42 -0
  145. package/templates/contextkit/runtime/config/load.mjs +105 -0
  146. package/templates/contextkit/runtime/config/paths.mjs +92 -0
  147. package/templates/contextkit/runtime/config/presets.mjs +47 -0
  148. package/templates/contextkit/runtime/config/schema.mjs +88 -0
  149. package/templates/contextkit/runtime/config/settings-compose.mjs +55 -0
  150. package/templates/contextkit/runtime/git-hooks/commit-msg.mjs +55 -0
  151. package/templates/contextkit/runtime/git-hooks/pre-commit.mjs +47 -0
  152. package/templates/contextkit/runtime/git-hooks/pre-push.mjs +102 -0
  153. package/templates/contextkit/runtime/hooks/boot-context-readers.mjs +111 -0
  154. package/templates/contextkit/runtime/hooks/boot-signals.mjs +135 -0
  155. package/templates/contextkit/runtime/hooks/check-registration.mjs +228 -0
  156. package/templates/contextkit/runtime/hooks/concurrency-guard.mjs +110 -0
  157. package/templates/contextkit/runtime/hooks/ledger.mjs +231 -0
  158. package/templates/contextkit/runtime/hooks/md-extract.mjs +65 -0
  159. package/templates/contextkit/runtime/hooks/path-classification.mjs +62 -0
  160. package/templates/contextkit/runtime/hooks/safe-io.mjs +84 -0
  161. package/templates/contextkit/runtime/hooks/session-digest-core.mjs +85 -0
  162. package/templates/contextkit/runtime/hooks/session-start.mjs +248 -0
  163. package/templates/contextkit/runtime/hooks/simulate-gate.mjs +108 -0
  164. package/templates/contextkit/runtime/hooks/track-edits.mjs +154 -0
  165. package/templates/contextkit/runtime/providers/media/_adapter.mjs +120 -0
  166. package/templates/contextkit/runtime/providers/media/nano-banana.mjs +110 -0
  167. package/templates/contextkit/runtime/providers/media/veo.mjs +162 -0
  168. package/templates/contextkit/runtime/providers/review/_adapter.mjs +71 -0
  169. package/templates/contextkit/runtime/providers/review/detect.mjs +115 -0
  170. package/templates/contextkit/runtime/providers/review/gh.mjs +103 -0
  171. package/templates/contextkit/runtime/state/state-io.mjs +172 -0
  172. package/templates/contextkit/runtime/statusline.mjs +51 -0
  173. package/templates/contextkit/squads/README.md +115 -0
  174. package/templates/contextkit/squads/_BRIEFING.md.tpl +27 -0
  175. package/templates/contextkit/squads/agent-forge/README.md +69 -0
  176. package/templates/contextkit/squads/agent-forge/ROADMAP.md +108 -0
  177. package/templates/contextkit/squads/agent-forge/best-practices.md +89 -0
  178. package/templates/contextkit/squads/agent-forge/cli/forge-admin.mjs +132 -0
  179. package/templates/contextkit/squads/agent-forge/cli/forge-eval-cli.mjs +163 -0
  180. package/templates/contextkit/squads/agent-forge/cli/forge-new.mjs +97 -0
  181. package/templates/contextkit/squads/agent-forge/cli/forge-ops.mjs +177 -0
  182. package/templates/contextkit/squads/agent-forge/lib/architect.mjs +112 -0
  183. package/templates/contextkit/squads/agent-forge/lib/eval-designer.mjs +133 -0
  184. package/templates/contextkit/squads/agent-forge/lib/eval-runner.mjs +167 -0
  185. package/templates/contextkit/squads/agent-forge/lib/governance-officer.mjs +178 -0
  186. package/templates/contextkit/squads/agent-forge/lib/package-ops.mjs +101 -0
  187. package/templates/contextkit/squads/agent-forge/lib/packager.mjs +219 -0
  188. package/templates/contextkit/squads/agent-forge/lib/prompt-gen.mjs +122 -0
  189. package/templates/contextkit/squads/agent-forge/lib/rag-designer.mjs +102 -0
  190. package/templates/contextkit/squads/agent-forge/lib/router.mjs +165 -0
  191. package/templates/contextkit/squads/agent-forge/lib/tool-gen.mjs +113 -0
  192. package/templates/contextkit/squads/agent-forge/lib/yaml.mjs +47 -0
  193. package/templates/contextkit/squads/agent-forge/pipeline.yaml +65 -0
  194. package/templates/contextkit/squads/agent-forge/router/capability-matrix.json +112 -0
  195. package/templates/contextkit/squads/agent-forge/router/decision-rules.json +120 -0
  196. package/templates/contextkit/squads/agent-forge/templates/agent-package/.agentforgerc +12 -0
  197. package/templates/contextkit/squads/agent-forge/templates/agent-package/CHANGELOG.md +13 -0
  198. package/templates/contextkit/squads/agent-forge/templates/agent-package/LICENSE +5 -0
  199. package/templates/contextkit/squads/agent-forge/templates/agent-package/README.md +39 -0
  200. package/templates/contextkit/squads/agent-forge/templates/agent-package/adapters/go/README.md +10 -0
  201. package/templates/contextkit/squads/agent-forge/templates/agent-package/adapters/go/agent.go +14 -0
  202. package/templates/contextkit/squads/agent-forge/templates/agent-package/adapters/go/go.mod +3 -0
  203. package/templates/contextkit/squads/agent-forge/templates/agent-package/adapters/node/README.md +11 -0
  204. package/templates/contextkit/squads/agent-forge/templates/agent-package/adapters/node/index.js +53 -0
  205. package/templates/contextkit/squads/agent-forge/templates/agent-package/adapters/node/package.json +9 -0
  206. package/templates/contextkit/squads/agent-forge/templates/agent-package/adapters/python/README.md +10 -0
  207. package/templates/contextkit/squads/agent-forge/templates/agent-package/adapters/python/agent.py +16 -0
  208. package/templates/contextkit/squads/agent-forge/templates/agent-package/adapters/python/pyproject.toml +10 -0
  209. package/templates/contextkit/squads/agent-forge/templates/agent-package/evals/golden.jsonl +1 -0
  210. package/templates/contextkit/squads/agent-forge/templates/agent-package/evals/red-team.jsonl +3 -0
  211. package/templates/contextkit/squads/agent-forge/templates/agent-package/evals/rubric.yaml +14 -0
  212. package/templates/contextkit/squads/agent-forge/templates/agent-package/evals/run-eval.md +17 -0
  213. package/templates/contextkit/squads/agent-forge/templates/agent-package/evals/thresholds.yaml +18 -0
  214. package/templates/contextkit/squads/agent-forge/templates/agent-package/examples/basic.node.md +17 -0
  215. package/templates/contextkit/squads/agent-forge/templates/agent-package/examples/with-fallback.node.md +24 -0
  216. package/templates/contextkit/squads/agent-forge/templates/agent-package/examples/with-rag.python.md +20 -0
  217. package/templates/contextkit/squads/agent-forge/templates/agent-package/governance/audit.schema.json +23 -0
  218. package/templates/contextkit/squads/agent-forge/templates/agent-package/governance/compliance.policy.yaml +43 -0
  219. package/templates/contextkit/squads/agent-forge/templates/agent-package/governance/cost.policy.yaml +36 -0
  220. package/templates/contextkit/squads/agent-forge/templates/agent-package/governance/fallback-chain.yaml +16 -0
  221. package/templates/contextkit/squads/agent-forge/templates/agent-package/governance/quality.policy.yaml +43 -0
  222. package/templates/contextkit/squads/agent-forge/templates/agent-package/manifest.yaml +91 -0
  223. package/templates/contextkit/squads/agent-forge/templates/agent-package/prompts/system.anthropic.md +19 -0
  224. package/templates/contextkit/squads/agent-forge/templates/agent-package/prompts/system.canonical.md +25 -0
  225. package/templates/contextkit/squads/agent-forge/templates/agent-package/prompts/system.deepseek.md +21 -0
  226. package/templates/contextkit/squads/agent-forge/templates/agent-package/prompts/system.google.md +19 -0
  227. package/templates/contextkit/squads/agent-forge/templates/agent-package/prompts/system.ollama.md +21 -0
  228. package/templates/contextkit/squads/agent-forge/templates/agent-package/prompts/system.openai.md +20 -0
  229. package/templates/contextkit/squads/agent-forge/templates/agent-package/rag/config.yaml +17 -0
  230. package/templates/contextkit/squads/agent-forge/templates/agent-package/rag/index/.gitkeep +3 -0
  231. package/templates/contextkit/squads/agent-forge/templates/agent-package/rag/ingestion/chunker.config.yaml +6 -0
  232. package/templates/contextkit/squads/agent-forge/templates/agent-package/rag/ingestion/sources.yaml +8 -0
  233. package/templates/contextkit/squads/agent-forge/templates/agent-package/rag/retrieval/query-template.md +16 -0
  234. package/templates/contextkit/squads/agent-forge/templates/agent-package/rag/retrieval/rerank.config.yaml +6 -0
  235. package/templates/contextkit/squads/agent-forge/templates/agent-package/tools/adapters/anthropic.tools.json +11 -0
  236. package/templates/contextkit/squads/agent-forge/templates/agent-package/tools/adapters/deepseek.tools.json +14 -0
  237. package/templates/contextkit/squads/agent-forge/templates/agent-package/tools/adapters/google.tools.json +11 -0
  238. package/templates/contextkit/squads/agent-forge/templates/agent-package/tools/adapters/ollama.tools.json +14 -0
  239. package/templates/contextkit/squads/agent-forge/templates/agent-package/tools/adapters/openai.tools.json +14 -0
  240. package/templates/contextkit/squads/agent-forge/templates/agent-package/tools/schemas.canonical.json +25 -0
  241. package/templates/contextkit/starters/tanstack/README.md +86 -0
  242. package/templates/contextkit/starters/tanstack/index.html +12 -0
  243. package/templates/contextkit/starters/tanstack/package.json +25 -0
  244. package/templates/contextkit/starters/tanstack/src/main.tsx +40 -0
  245. package/templates/contextkit/starters/tanstack/src/router.tsx +12 -0
  246. package/templates/contextkit/starters/tanstack/src/routes/__root.tsx +10 -0
  247. package/templates/contextkit/starters/tanstack/src/routes/index.tsx +17 -0
  248. package/templates/contextkit/starters/tanstack/tsconfig.json +19 -0
  249. package/templates/contextkit/starters/tanstack/vite.config.ts +10 -0
  250. package/templates/contextkit/tools/scripts/adr-digest-core.mjs +42 -0
  251. package/templates/contextkit/tools/scripts/adr-digest.mjs +78 -0
  252. package/templates/contextkit/tools/scripts/agent-tuning.mjs +74 -0
  253. package/templates/contextkit/tools/scripts/aiso-audit.mjs +174 -0
  254. package/templates/contextkit/tools/scripts/audit-shared.mjs +129 -0
  255. package/templates/contextkit/tools/scripts/claim.mjs +133 -0
  256. package/templates/contextkit/tools/scripts/claude-md.mjs +123 -0
  257. package/templates/contextkit/tools/scripts/clean-drive.mjs +78 -0
  258. package/templates/contextkit/tools/scripts/context-config.mjs +111 -0
  259. package/templates/contextkit/tools/scripts/context-level.mjs +98 -0
  260. package/templates/contextkit/tools/scripts/context-pack.mjs +120 -0
  261. package/templates/contextkit/tools/scripts/contract-scan.mjs +186 -0
  262. package/templates/contextkit/tools/scripts/dashboard-data.mjs +198 -0
  263. package/templates/contextkit/tools/scripts/dashboard-html.mjs +215 -0
  264. package/templates/contextkit/tools/scripts/dashboard-server.mjs +129 -0
  265. package/templates/contextkit/tools/scripts/dashboard.mjs +107 -0
  266. package/templates/contextkit/tools/scripts/deep-analysis.mjs +62 -0
  267. package/templates/contextkit/tools/scripts/deps-audit.mjs +201 -0
  268. package/templates/contextkit/tools/scripts/detect-stack.mjs +164 -0
  269. package/templates/contextkit/tools/scripts/distill-detect.mjs +90 -0
  270. package/templates/contextkit/tools/scripts/doctor.mjs +165 -0
  271. package/templates/contextkit/tools/scripts/fleet.mjs +170 -0
  272. package/templates/contextkit/tools/scripts/generate-context.mjs +142 -0
  273. package/templates/contextkit/tools/scripts/gh-alerts.mjs +117 -0
  274. package/templates/contextkit/tools/scripts/git.mjs +97 -0
  275. package/templates/contextkit/tools/scripts/home.mjs +106 -0
  276. package/templates/contextkit/tools/scripts/mark-simulation.mjs +78 -0
  277. package/templates/contextkit/tools/scripts/media-gen.mjs +154 -0
  278. package/templates/contextkit/tools/scripts/pipeline-board.mjs +74 -0
  279. package/templates/contextkit/tools/scripts/pipeline-prioritize.mjs +68 -0
  280. package/templates/contextkit/tools/scripts/pipeline-session.mjs +99 -0
  281. package/templates/contextkit/tools/scripts/pipeline-validate.mjs +136 -0
  282. package/templates/contextkit/tools/scripts/pipeline.mjs +302 -0
  283. package/templates/contextkit/tools/scripts/playbook.mjs +123 -0
  284. package/templates/contextkit/tools/scripts/predictions-review.mjs +113 -0
  285. package/templates/contextkit/tools/scripts/release.mjs +60 -0
  286. package/templates/contextkit/tools/scripts/resume.mjs +114 -0
  287. package/templates/contextkit/tools/scripts/roadmap.mjs +86 -0
  288. package/templates/contextkit/tools/scripts/runs.mjs +116 -0
  289. package/templates/contextkit/tools/scripts/seo-audit.mjs +150 -0
  290. package/templates/contextkit/tools/scripts/session-digest.mjs +89 -0
  291. package/templates/contextkit/tools/scripts/session-reindex.mjs +91 -0
  292. package/templates/contextkit/tools/scripts/setup-complete.mjs +69 -0
  293. package/templates/contextkit/tools/scripts/squad-meta.mjs +23 -0
  294. package/templates/contextkit/tools/scripts/squad-pipeline-condition.mjs +192 -0
  295. package/templates/contextkit/tools/scripts/squad-pipeline.mjs +301 -0
  296. package/templates/contextkit/tools/scripts/squad.mjs +80 -0
  297. package/templates/contextkit/tools/scripts/stats.mjs +138 -0
  298. package/templates/contextkit/tools/scripts/sync-check.mjs +235 -0
  299. package/templates/contextkit/tools/scripts/tech-debt-detectors.mjs +76 -0
  300. package/templates/contextkit/tools/scripts/tech-debt-scan.mjs +164 -0
  301. package/templates/contextkit/tools/scripts/token-report.mjs +153 -0
  302. package/templates/contextkit/tools/scripts/visual-test.mjs +132 -0
  303. package/templates/contextkit/tools/scripts/watch.mjs +106 -0
  304. package/templates/contextkit/tools/scripts/workflow.mjs +136 -0
  305. package/templates/contextkit/tools/scripts/workspace-sync.mjs +220 -0
  306. package/templates/contextkit/tools/scripts/worktree-new.mjs +50 -0
  307. package/templates/contextkit/workflows/L1-static-loading.md +59 -0
  308. package/templates/contextkit/workflows/L2-session-ledger.md +86 -0
  309. package/templates/contextkit/workflows/L3-multi-session.md +80 -0
  310. package/templates/contextkit/workflows/L4-squads.md +68 -0
  311. package/templates/contextkit/workflows/L5-proactive.md +88 -0
  312. package/templates/contextkit/workflows/README.md +47 -0
  313. package/templates/contextkit/workflows/playbooks/distillation-cycle.md +74 -0
  314. package/templates/contextkit/workflows/playbooks/landing-page.md +197 -0
  315. package/templates/contextkit/workflows/playbooks/security-batch.md +68 -0
  316. package/templates/contextkit/workflows/playbooks/seo-aiso.md +288 -0
  317. package/templates/contextkit/workflows/playbooks/simulate-impact.md +83 -0
  318. package/templates/contextkit/workflows/playbooks/tanstack.md +164 -0
  319. package/templates/contextkit/workflows/playbooks/tech-debt-sweep.md +77 -0
  320. package/templates/docs/CHANGELOG.md.tpl +11 -0
  321. package/templates/gitattributes +3 -0
  322. package/templates/github/ISSUE_TEMPLATE/bug_report.md +30 -0
  323. package/templates/github/ISSUE_TEMPLATE/feature_request.md +22 -0
  324. package/templates/github/PULL_REQUEST_TEMPLATE.md +27 -0
  325. package/templates/github/dependabot.yml +27 -0
  326. package/templates/github/workflows/quality.yml +36 -0
  327. package/templates/github/workflows/security.yml +54 -0
  328. package/tools/install/cli.mjs +62 -0
  329. package/tools/install/fs.mjs +56 -0
  330. package/tools/install/git.mjs +114 -0
  331. package/tools/install/project.mjs +51 -0
  332. package/tools/install/uninstall.mjs +54 -0
  333. package/tools/integration-test-compozy.mjs +88 -0
  334. package/tools/integration-test-guards.mjs +269 -0
  335. package/tools/integration-test-tooling-agent-forge.mjs +189 -0
  336. package/tools/integration-test-tooling-pipeline.mjs +164 -0
  337. package/tools/integration-test-tooling.mjs +172 -0
  338. package/tools/integration-test.mjs +228 -0
  339. package/tools/it-helpers.mjs +60 -0
  340. package/tools/selfcheck-agent-forge-ops.mjs +107 -0
  341. package/tools/selfcheck-agent-forge.mjs +304 -0
  342. package/tools/selfcheck-config.mjs +80 -0
  343. package/tools/selfcheck-runtime.mjs +135 -0
  344. package/tools/selfcheck-source.mjs +326 -0
  345. package/tools/selfcheck.mjs +268 -0
@@ -0,0 +1,288 @@
1
+ # Playbook — SEO + AISO (the two index spaces)
2
+
3
+ > Operational entry: `/seo-audit` runs both static analysers
4
+ > (`seo-audit.mjs` + `aiso-audit.mjs`) and the
5
+ > [`seo-specialist`](../../squads/_BRIEFING.md.tpl) agent reads this
6
+ > page on every invocation. Refuse-on-unindexable is the load-bearing
7
+ > rule; this playbook is what "indexable" means in practice.
8
+ >
9
+ > Authority: [ADR-0025](../../memory/decisions/0025-seo-and-aiso-posture.md). Freshness: AISO conventions dated **2026-06-02** — `llms.txt` + FAQ-schema effectiveness re-evaluated quarterly.
10
+
11
+ ## Two indexes, two rule sets
12
+
13
+ A public page lives in two index spaces at the same time and is judged
14
+ by different signals in each.
15
+
16
+ | Index | Crawlers | What they reward | What kills you |
17
+ |---|---|---|---|
18
+ | **Classical SEO** | Googlebot, Bingbot, DuckDuckBot | server-rendered HTML, semantic tags, canonical URLs, sitemap, Core Web Vitals, JSON-LD entity markup | empty `<div id="root">`, JS-rendered titles, missing `<meta description>`, CLS > 0.1 |
19
+ | **AISO (AI Search Optimization)** | GPTBot, ClaudeBot, PerplexityBot, Google-Extended, OAI-SearchBot | `llms.txt`, FAQ schema, scannable Q&A headings, semantic HTML5, author + date schema | div-soup, JS-rendered content, no FAQ schema, no `llms.txt`, robots.txt blocking AI crawlers without user opting out |
20
+
21
+ Most projects optimise the first and ignore the second. In 2026 the
22
+ second is a measurable distribution channel — ChatGPT search, Claude
23
+ with web search, Perplexity, Gemini — and the gap between "ranks on
24
+ Google" and "appears in LLM answers" is a real conversion gap.
25
+
26
+ ## SEO — the floor (refuse if missing)
27
+
28
+ ### Server-rendered HTML
29
+
30
+ The smell that kills indexability: `curl https://your-page` returns
31
+ `<body><div id="root"></div></body>` and the rest is JS.
32
+
33
+ The refusal is automatic on landing surfaces (ADR-0025 + ADR-0023).
34
+ The fix is to pick a framework that ships SSR or SSG by default —
35
+ Astro, Next App Router (RSC), Nuxt, SvelteKit. Plain Vite + React for
36
+ a landing page is refused; use Astro.
37
+
38
+ ### Per-page meta
39
+
40
+ - **`<title>`** — set server-side, descriptive, unique per route.
41
+ Length: 50–60 chars (Google may truncate longer ones in SERPs).
42
+ - **`<meta name="description">`** — unique per route, 120–160 chars,
43
+ rewrites the page in a way that earns the click.
44
+ - **`<link rel="canonical" href="https://...">`** — absolute URL,
45
+ one per page. Without it Google may pick a wrong canonical and your
46
+ internal links scatter ranking.
47
+
48
+ ### Site-wide files
49
+
50
+ | File | Purpose | Smell |
51
+ |---|---|---|
52
+ | `sitemap.xml` | lists every public route Google should crawl | absent, or stale (missing recently-added routes) |
53
+ | `robots.txt` | tells crawlers what to fetch and what to skip | `User-agent: * Disallow: /` left over from staging |
54
+ | `humans.txt` | optional — credit the team | absent (not a refusal, but nice) |
55
+
56
+ ### Structured data (JSON-LD)
57
+
58
+ For a marketing site, at minimum:
59
+
60
+ - `Organization` — the brand entity. Name, logo, sameAs (linked
61
+ social), URL.
62
+ - `WebSite` with `SearchAction` — enables Google's sitelinks search
63
+ box.
64
+ - `BreadcrumbList` on internal pages — shows breadcrumbs in SERPs.
65
+ - One per content type — `Product`, `SoftwareApplication`,
66
+ `Article`, etc — relevant to the page.
67
+
68
+ The JSON-LD validator is at https://validator.schema.org/. Run it on
69
+ the rendered HTML, not the source.
70
+
71
+ ### Images
72
+
73
+ - Every `<img>` has `alt`. Empty `alt=""` is correct for decorative
74
+ images (better than absent — explicit no-text-needed signal).
75
+ - `width` and `height` attributes set — prevents CLS.
76
+ - Modern formats: AVIF or WebP with a JPEG/PNG fallback via
77
+ `<picture>`.
78
+ - `loading="lazy"` on below-the-fold images; `loading="eager"` (the
79
+ default) on the hero.
80
+ - `fetchpriority="high"` on the LCP image — measurable LCP
81
+ improvement.
82
+
83
+ ### Core Web Vitals (ranking signal since 2021)
84
+
85
+ | Metric | Threshold |
86
+ |---|---|
87
+ | **LCP** (Largest Contentful Paint) | < 2.5 s |
88
+ | **INP** (Interaction to Next Paint — replaced FID in 2024) | < 200 ms |
89
+ | **CLS** (Cumulative Layout Shift) | < 0.1 |
90
+
91
+ Measure with PageSpeed Insights (lab) + Plausible / Vercel Analytics
92
+ (real users). Lighthouse CI on every PR catches lab regressions.
93
+
94
+ ## AISO — above the floor
95
+
96
+ ### `llms.txt` at the root
97
+
98
+ A 2024-vintage convention (https://llmstxt.org) — the analogue of
99
+ `sitemap.xml` for AI crawlers. Format is markdown, listing the
100
+ canonical pages an LLM should cite.
101
+
102
+ Minimum viable `llms.txt`:
103
+
104
+ ```
105
+ # Project name
106
+
107
+ > One-sentence description of what the project is.
108
+
109
+ ## Docs
110
+
111
+ - [Page title](https://example.com/page): one-line description
112
+ - [Another page](https://example.com/another): ...
113
+
114
+ ## Examples
115
+
116
+ - [Example 1](https://example.com/example-1): ...
117
+ ```
118
+
119
+ The LLM crawlers that honour it (early 2026: Anthropic, partial OAI,
120
+ partial Perplexity) get a curated routing map instead of having to
121
+ guess from the HTML.
122
+
123
+ ### FAQ schema — the load-bearing AISO move
124
+
125
+ LLM answer engines cite `FAQPage` JSON-LD near-verbatim. A marketing
126
+ page with 3–5 real Q&A pairs in `FAQPage` schema shows up in
127
+ ChatGPT / Perplexity answers; a marketing page without one does not.
128
+
129
+ The pattern:
130
+
131
+ ```html
132
+ <script type="application/ld+json">
133
+ {
134
+ "@context": "https://schema.org",
135
+ "@type": "FAQPage",
136
+ "mainEntity": [
137
+ {
138
+ "@type": "Question",
139
+ "name": "What is [Product]?",
140
+ "acceptedAnswer": {
141
+ "@type": "Answer",
142
+ "text": "One-sentence concrete answer. No marketing fluff. No 'leverage synergies'."
143
+ }
144
+ },
145
+ // 2–4 more
146
+ ]
147
+ }
148
+ </script>
149
+ ```
150
+
151
+ Questions to pick: the **real** customer questions, in the customer's
152
+ words. The same 5 questions sales answers on every demo. If the team
153
+ does not know them, ask sales for a list — the 5 that come up most.
154
+
155
+ ### Semantic HTML5
156
+
157
+ LLM extractors weight semantic tags. `<article>`, `<section>`,
158
+ `<nav>`, `<main>`, `<aside>`, `<header>`, `<footer>`. Not divs
159
+ everywhere with class names that describe the same thing.
160
+
161
+ Bad:
162
+ ```html
163
+ <div class="article">
164
+ <div class="header">
165
+ <div class="title">Why X matters</div>
166
+ </div>
167
+ <div class="content">...</div>
168
+ </div>
169
+ ```
170
+
171
+ Good:
172
+ ```html
173
+ <article>
174
+ <header>
175
+ <h2>Why X matters</h2>
176
+ </header>
177
+ <p>...</p>
178
+ </article>
179
+ ```
180
+
181
+ The `aiso-audit.mjs` script flags pages with a low semantic-tag ratio
182
+ (divs : semantic > 5:1).
183
+
184
+ ### Scannable Q&A headings
185
+
186
+ LLM summarisers look for question-shaped headings. A page with
187
+ `## What is X?` / `## How do I Y?` / `## When should I use Z?` is
188
+ easier for an LLM to extract than the same content as flowing prose.
189
+
190
+ The pattern is best for help / docs / "how it works" sections, not
191
+ for the hero. Use it on the second half of the page.
192
+
193
+ ### Author + organization schema
194
+
195
+ LLM rankers weight authored content over anonymous. Every public
196
+ document carries:
197
+
198
+ - `Organization` schema (brand-level — see SEO section).
199
+ - `Person` schema for the author when the page has one.
200
+ - `datePublished` and `dateModified` — LLMs care about recency.
201
+
202
+ ### Robots & AI crawlers
203
+
204
+ `robots.txt` default for a marketing site:
205
+
206
+ ```
207
+ User-agent: *
208
+ Allow: /
209
+ Sitemap: https://your-domain/sitemap.xml
210
+
211
+ # AI crawlers — explicitly named. Opt out by changing Allow: / to
212
+ # Disallow: / under the specific user-agent block.
213
+ User-agent: GPTBot
214
+ Allow: /
215
+
216
+ User-agent: ClaudeBot
217
+ Allow: /
218
+
219
+ User-agent: PerplexityBot
220
+ Allow: /
221
+
222
+ User-agent: Google-Extended
223
+ Allow: /
224
+
225
+ User-agent: OAI-SearchBot
226
+ Allow: /
227
+ ```
228
+
229
+ The `aiso-audit.mjs` script flags a `robots.txt` that blocks any of
230
+ these without a project-local ADR opting out explicitly.
231
+
232
+ ### Avoid JS-rendered content for cited material
233
+
234
+ Most LLM crawlers in 2026 do not execute JS reliably. The pricing
235
+ table, the FAQ, the documentation, the marketing copy — all in the
236
+ HTML. Reserve JS for interactivity (open the modal, animate the
237
+ chart, toggle the menu) — never for content the user wants cited.
238
+
239
+ ## Audit codes (what the scripts emit)
240
+
241
+ `seo-audit.mjs` and `aiso-audit.mjs` emit findings:
242
+
243
+ ```json
244
+ { "file": "src/pages/index.astro", "line": 12, "code": "MISSING_DESCRIPTION", "severity": "high", "message": "..." }
245
+ ```
246
+
247
+ ### SEO codes
248
+
249
+ | Code | Severity |
250
+ |---|---|
251
+ | `SPA_ENTRYPOINT` | critical (refusal) |
252
+ | `MISSING_TITLE` | high |
253
+ | `MISSING_DESCRIPTION` | high |
254
+ | `MULTIPLE_H1` | high |
255
+ | `MISSING_CANONICAL` | medium |
256
+ | `MISSING_ALT` | medium |
257
+ | `MISSING_SITEMAP` | high |
258
+ | `MISSING_ROBOTS` | medium |
259
+
260
+ ### AISO codes
261
+
262
+ | Code | Severity |
263
+ |---|---|
264
+ | `MISSING_LLMS_TXT` | high |
265
+ | `MISSING_FAQ_SCHEMA` | high |
266
+ | `MISSING_ORG_SCHEMA` | medium |
267
+ | `DIV_SOUP` | medium |
268
+ | `JS_RENDERED_CONTENT` | high |
269
+ | `MISSING_AUTHOR_SCHEMA` | low |
270
+ | `MISSING_DATE_STAMP` | low |
271
+ | `BLOCKS_AI_CRAWLERS` | high |
272
+
273
+ ## When this playbook does NOT apply
274
+
275
+ - **Internal admin tools / dashboards behind auth** — no indexability
276
+ expected. The override is a project-local ADR.
277
+ - **Single-customer apps** — same posture as admin tools.
278
+ - **API endpoints / JSON resources** — no SEO surface.
279
+
280
+ The seo-specialist agent respects these overrides; do not re-litigate
281
+ them.
282
+
283
+ ## Freshness protocol
284
+
285
+ AISO conventions are young (2024–2026). This playbook's AISO section
286
+ carries a date. When `llms.txt` adoption stalls or a new convention
287
+ overtakes FAQ schema, the playbook is amended via an ADR. Re-evaluate
288
+ quarterly.
@@ -0,0 +1,83 @@
1
+ # Playbook — `/simulate-impact`
2
+
3
+ > Operational spec: [`.claude/commands/simulate-impact.md`](../../../.claude/commands/simulate-impact.md).
4
+ > This page explains **why** it exists, **when** to fire it, **how to read the
5
+ > report**, and the common **anti-patterns**.
6
+
7
+ ## Why it exists
8
+
9
+ Three frictions motivated L5:
10
+ 1. High-blast-radius changes land **silently** without prior analysis.
11
+ 2. "Architecture before syntax" is a posture; a posture with no executable mechanism
12
+ becomes drift.
13
+ 3. The squad was used in **serial** delegation — `/simulate-impact` is the first
14
+ feature to exploit **parallelism**, multiplying the squad's ROI.
15
+
16
+ ## When to fire it
17
+
18
+ Use it when the objective crosses **≥ 2** high-risk surfaces, e.g.:
19
+ - a data-model / schema change;
20
+ - a change to a shared type or validation schema;
21
+ - a change to a public route/endpoint signature;
22
+ - the auth or crypto surface;
23
+ - a new service/module on a critical path;
24
+ - direct implementation of an accepted ADR.
25
+
26
+ **When NOT to** (it wastes tokens):
27
+ - a bug fix with the root cause already mapped (use `/bug-hunt`);
28
+ - a refactor with scope locked by `/dev-start`;
29
+ - a cosmetic / i18n / comment / internal-rename change.
30
+
31
+ ## How to read the Blast Radius Report
32
+
33
+ - **`Risk overall`** = `max(per-agent risks)`, not the average. If **High**, do not
34
+ proceed without understanding *which* agent said High and why.
35
+ - **`Affected paths (union)`** becomes `coveredPaths` in the ledger. The PreToolUse
36
+ gate authorizes edits against this set — **if a path isn't listed, the gate blocks
37
+ the edit** on high-risk paths. If the simulation missed a critical path, re-run
38
+ with a refined objective.
39
+ - **`Per sub-agent`** — each speaks from its own view. **Disagreement is the
40
+ signal** — don't reconcile it mentally. (The data agent says "trivial"; the QA
41
+ agent says "no fixture exists" → the real risk is in tests, not the schema.)
42
+ - **`Mitigations`** — each needs an owner: a feature TODO, a new ADR, or an explicit
43
+ discard.
44
+ - **`Decision required`** — Proceed (with mitigations), Defer (too big without an
45
+ ADR), or Abort (mis-scoped — re-scope).
46
+
47
+ ## Prediction-file lifecycle
48
+
49
+ ```
50
+ /simulate-impact "<obj>" → contextkit/memory/predictions/<date>-<sid>-<slug>.md (pending, coveredPaths)
51
+ implementation in the same session (or discard)
52
+ /predictions-review → fills "Actual": paths changed, delta vs predicted, risk note
53
+ (auto-run by /log-session at session end)
54
+ ```
55
+ This corpus calibrates future simulations.
56
+
57
+ ## Anti-patterns
58
+
59
+ 1. **Firing to validate a decision already made.** It's a search for disagreement,
60
+ not an approval checklist. If you already know the answer, you're burning tokens.
61
+ 2. **Implementing before showing the report.** L5 requires an explicit user decision
62
+ among the three outcomes.
63
+ 3. **Ignoring disagreement ("5 said Low, 1 said High → Low").** Risk is max, not
64
+ average; the lone High *is* the signal.
65
+ 4. **Running without reading active ADRs first.** Sub-agents get the objective + a
66
+ domain briefing, not the full project state — anchoring in ADRs is step 1.
67
+ 5. **Forgetting to mark the ledger.** Without `mark-simulation.mjs`, the PreToolUse
68
+ gate blocks the next edit. It's part of the contract, not cosmetic.
69
+
70
+ ## Calibration over time
71
+
72
+ After 10+ predictions with "Predicted vs Actual" filled in, look for systematic
73
+ patterns (an agent that underestimates risk; a path that's always collateral but
74
+ actually central). Refine the command's prompts; if the pattern is architectural,
75
+ make it an ADR.
76
+
77
+ ## Relation to other L5 components
78
+
79
+ - **PreToolUse gate** — reads the ledger's `simulations[]`; no simulation on a
80
+ high-risk path → it blocks.
81
+ - **`/tech-debt-sweep`** — independent; neither requires nor produces simulations.
82
+ - **Contract-drift gate** — independent; may flag the very change the simulation
83
+ predicted.
@@ -0,0 +1,164 @@
1
+ # Playbook — TanStack
2
+
3
+ > Operational entry points: `/aidevtool-from0` Phase 3 (proposing the stack),
4
+ > `/setupcontextdevkit` Phase 4 (writing rules when detected), and the opt-in
5
+ > starter under `templates/contextkit/starters/tanstack/`. This page is **why**
6
+ > TanStack, **when** to pick it, **how** to live with it, and the
7
+ > **anti-patterns** we will not write.
8
+ >
9
+ > Authority: [ADR-0017](../../memory/decisions/0017-tanstack-stack-recognition-and-opt-in-starter.md).
10
+
11
+ ## Why TanStack as a curated option
12
+
13
+ TanStack is a family of headless, type-safe libraries with overlapping ergonomics
14
+ (Query / Router / Table / Form / Virtual) and one full-stack frame (Start). The
15
+ kit treats it as a curated option because three properties match its own
16
+ constitution:
17
+
18
+ - **Type safety as a first-class invariant.** Router params, Query data, and
19
+ Table columns are typed end-to-end — drift between intent and runtime is
20
+ caught by `tsc`, not by a regression. The kit's "fail fast at the boundary"
21
+ posture (constitution §4) inherits this for free.
22
+ - **Headless by default.** No design-system bundled — the user owns the visual
23
+ layer. Matches constitution rule 9 (no invented domain content) at the
24
+ library level.
25
+ - **Cache & invalidation as explicit primitives.** Query forces `queryKey` +
26
+ `staleTime` to be deliberate choices, not defaults. That is the same posture
27
+ the kit takes for ledger paths and high-risk zones: refuse by default
28
+ (rule 8), opt in to permit.
29
+
30
+ ## When to pick TanStack (and when not to)
31
+
32
+ Pick it when:
33
+ - the project is a **type-safe React** (or Solid / Vue) app and the team values
34
+ end-to-end inference over framework lock-in;
35
+ - routing needs to be **co-located with the data fetching contract** (Router
36
+ loaders + Query) rather than scattered across page components;
37
+ - a future migration off a backend host (BFF, edge, serverless) is plausible —
38
+ TanStack Start's adapter model is friendlier than baking a single host
39
+ assumption into routes.
40
+
41
+ **Don't pick it (or pick a smaller subset) when:**
42
+ - the project already commits to a full-stack framework whose router is
43
+ load-bearing (Next/Nuxt/Remix/SvelteKit) — adding TanStack Router on top
44
+ creates two routing systems; use TanStack Query *with* the framework's
45
+ router instead, that combination is the common case;
46
+ - the team is new to React patterns generally — TanStack rewards developers
47
+ who already know what a query key, a stale time, and a suspense boundary
48
+ *are*. Pair it with a senior, or pick a more opinionated frame first;
49
+ - the app is mostly **forms + CRUD on a single backend you own** — a single
50
+ framework router + plain `fetch` may stay simpler than wiring Query + Router
51
+ + Form for the same outcome.
52
+
53
+ ## The family — pick by concern, not by reflex
54
+
55
+ | Concern | Sub-library | When to add |
56
+ | --- | --- | --- |
57
+ | Server state (fetching, caching, invalidation) | `@tanstack/react-query` | Any app that talks to a server. Add first. |
58
+ | Type-safe routing | `@tanstack/react-router` | When routes carry typed params/search and loaders. Skip if the host framework already owns routing. |
59
+ | Headless tables (sorting, filtering, virtualization-ready) | `@tanstack/react-table` | A data-heavy table with custom UI. Don't add for a simple list. |
60
+ | Headless forms | `@tanstack/react-form` | Complex multi-step forms or strict validation. Plain `useState` + zod is fine for a contact form. |
61
+ | Virtualized lists/grids | `@tanstack/react-virtual` | List > 200 items rendered concurrently. Premature for short lists. |
62
+ | Full-stack frame | `@tanstack/start` | New project that wants TanStack Router + a sanctioned server story. Not for grafting onto an existing Next/Nuxt app. |
63
+
64
+ Solid and Vue users substitute `@tanstack/solid-query` / `@tanstack/vue-query`;
65
+ the Query conventions below are identical.
66
+
67
+ ## Core conventions (these go into the user's CLAUDE.md)
68
+
69
+ When TanStack is detected (or chosen on greenfield), `/setupcontextdevkit` /
70
+ `/aidevtool-from0` writes the following block into the project's `CLAUDE.md`
71
+ under "Stack" or "Immutable rules":
72
+
73
+ 1. **Server state lives in Query, never in `useState`/Redux.** Fetch + cache +
74
+ invalidation are Query's job. Cross-component server data is read with
75
+ `useQuery` against the same `queryKey`, not propagated by hand.
76
+ 2. **`queryOptions` is the unit of reuse.** Every cross-component query is
77
+ declared via `queryOptions({ queryKey, queryFn, staleTime })` and consumed
78
+ by both `useQuery(queryOptions(...))` and `queryClient.prefetchQuery` /
79
+ `ensureQueryData`. No copy-pasted `queryKey` literals across files.
80
+ 3. **Cache keys are arrays, hierarchical, stable.** Shape: `['domain', 'list', filters]`
81
+ or `['domain', id]`. Filters are serializable. Never a stringified JSON
82
+ blob; never an unstable object literal in the render path.
83
+ 4. **Router params are typed via the route definition.** `Route.useParams()` /
84
+ `Route.useSearch()` only — never `useParams()` from a generic hook on top
85
+ of `window.location`. Add a `validateSearch` to anything that takes search
86
+ params from a URL.
87
+ 5. **`staleTime` is set deliberately on data with a known lifetime.** The
88
+ default `0` (always stale) is correct for dashboards; a known-static lookup
89
+ (countries, role list) sets `staleTime: Infinity` and invalidates on the
90
+ event that actually changes it.
91
+ 6. **Mutations invalidate the smallest viable key.** Don't invalidate
92
+ `['domain']` after a single-row update; invalidate `['domain', id]` and the
93
+ list keys that include it. The convention is one line of comment naming
94
+ the invariant the invalidation preserves.
95
+
96
+ ## Anti-patterns (caught in review)
97
+
98
+ 1. **`useState(server data)` + a manual `useEffect` to refetch.** That is
99
+ Query's job. Even one such pattern in the codebase signals that the team
100
+ has not internalized the boundary; refactor before adding more.
101
+ 2. **Untyped Router params.** `useParams<{ id: string }>()` cast at the call
102
+ site instead of `Route.useParams()`. The Router's whole value proposition
103
+ is that the route owns the type.
104
+ 3. **`data: any` in a Query result.** The whole pipeline is generic; `any`
105
+ defeats inference. Either give `queryFn` an explicit return type or use a
106
+ zod parser to narrow at the boundary.
107
+ 4. **`queryKey: [JSON.stringify(filters)]`.** Cache keys must be arrays of
108
+ plain values; stringification hides drift and breaks invalidation.
109
+ 5. **One giant `queryClient` configured per route.** Configure
110
+ `defaultOptions` once at the provider; route-specific overrides go on the
111
+ individual `queryOptions`. Multiple clients fragment the cache.
112
+ 6. **Adding `@tanstack/react-router` on top of Next/Nuxt/Remix.** Two routing
113
+ systems = two source-of-truth disputes. Pick one.
114
+ 7. **Starting from a copy-pasted "examples/" repo with a fake `Pokemon` or
115
+ `TodoList` domain.** Delete the fake first, then build. The opt-in starter
116
+ ships nothing of the sort precisely so this anti-pattern doesn't enter the
117
+ codebase.
118
+
119
+ ## The opt-in starter
120
+
121
+ `templates/contextkit/starters/tanstack/` is a **minimal wiring scaffold** the
122
+ user explicitly accepts during `/aidevtool-from0` Phase 6. It contains:
123
+
124
+ - `package.json` with the TanStack family chosen for the project (Start +
125
+ Router + Query by default; user can drop subsets);
126
+ - `src/main.tsx` with the `QueryClient` provider mounted once;
127
+ - `src/router.tsx` with one route (`/`) that renders a placeholder asking the
128
+ user to wire their first real route;
129
+ - a `README.md` pointing back to this playbook and the user-project's ADR-0001
130
+ recording the choice.
131
+
132
+ What the starter **does not** ship: a fake domain, a CSS framework, an auth
133
+ provider, a backend client, or example queries. See ADR-0017 for the five
134
+ constraints that govern any future stack-starter under
135
+ `templates/contextkit/starters/`.
136
+
137
+ `/setupcontextdevkit` (existing projects) **never** copies the starter — it
138
+ detects, writes rules, and stops.
139
+
140
+ ## Freshness
141
+
142
+ TanStack is moving fast — especially Start. This playbook reflects conventions
143
+ as of **2026-05**. Before relying on a specific API named here:
144
+
145
+ 1. Run `npm view @tanstack/start version` (or the sub-lib you care about) and
146
+ compare against the starter's `package.json`.
147
+ 2. If a major has shipped since this playbook's date, open `/new-adr "Refresh
148
+ TanStack playbook against vX.Y"` in the **kit** repo before changing the
149
+ user-project — the playbook is shared infrastructure.
150
+
151
+ ## Relation to other parts of the kit
152
+
153
+ - **Detection** — `templates/contextkit/tools/scripts/detect-stack.mjs` surfaces
154
+ any `@tanstack/*` dep in `frameworks`. Consumers branch on
155
+ `frameworks.some(f => f.startsWith('@tanstack/'))`.
156
+ - **CLAUDE.md scoping** — when the kit detects TanStack inside a sub-app of a
157
+ monorepo, the *scoped* `CLAUDE.md` for that app carries these conventions,
158
+ not the root one (`/claude-md scaffold` + per-app fill).
159
+ - **QA squad** — Query-heavy apps benefit from `qa-integration` against a real
160
+ backend (the cache is part of the contract); `qa-fuzzer` against
161
+ `validateSearch` schemas catches Router parser drift.
162
+ - **`/contract-check`** — exported `queryOptions` factories are part of the
163
+ public contract of a module; renaming `userListQueryOptions` is a breaking
164
+ change for every consumer.
@@ -0,0 +1,77 @@
1
+ # Playbook — `/tech-debt-sweep`
2
+
3
+ > Operational spec: [`.claude/commands/tech-debt-sweep.md`](../../../.claude/commands/tech-debt-sweep.md).
4
+ > This page is **why** the board exists, **how to read it**, and the **anti-patterns**.
5
+
6
+ ## Why it exists
7
+
8
+ The constitution defines rules (file size, SRP, JSDoc) but the audit used to be
9
+ manual and disposable. Without a persistent artifact, debt grows unseen, nobody sees
10
+ the trend, and each session re-discovers the same problem.
11
+
12
+ The debt board is the pulse of code health:
13
+ - **versioned** — it shows up in PR review, the boot context, and `git log -p`;
14
+ - **sectioned by bounded context** — product code vs the platform (`contextkit/`);
15
+ - **trended** — red/yellow/info counts let you see the delta between sweeps.
16
+
17
+ ## The detectors (deterministic, regex-based)
18
+
19
+ | Detector | Severity | Trigger |
20
+ | --- | --- | --- |
21
+ | **line-budget** | 🔴 above the hard limit / 🟡 in the yellow zone | File line count vs the constitution's budget. |
22
+ | **srp-and** | 🟡 | A function/const named `doXAndY` — an "And"/"Or" responsibility smell. |
23
+ | **jsdoc-orphan** | 🟡 | JSDoc declares N `@param` but the signature has M ≠ N. |
24
+ | **state-loop** | 🟡 | A UI component with many state hooks + an effect (logic that belongs in a hook/helper). |
25
+
26
+ Detectors are regex-based — **false positives are expected**. The board is input for
27
+ human review, not a verdict.
28
+
29
+ ## How to read it
30
+
31
+ - **Header** — last sweep time, profile, files scanned, findings by severity. If
32
+ `files scanned` drops sharply with no `git rm`, the scan is skipping paths — check
33
+ the ignored-dirs list in `tech-debt-scan.mjs`.
34
+ - **Zero red is the goal.** Yellow is negotiable (a cohesion note can justify the
35
+ +10% tolerance). Info is a nit — optional.
36
+ - **Bounded contexts** — product code takes priority; the platform tolerates a bit
37
+ more. A file in the yellow zone with a documented cohesion reason is expected, not
38
+ real debt.
39
+ - **Each finding** has a severity icon, a clickable `path:line`, an objective
40
+ message, and a snippet.
41
+
42
+ ## Lifecycle
43
+
44
+ ```
45
+ /tech-debt-sweep [profile]
46
+ → node contextkit/tools/scripts/tech-debt-scan.mjs --profile=X --write
47
+ → regenerates the board
48
+ → commit with the feature, or as "chore: refresh tech-debt board"
49
+ Resolution:
50
+ /dev-start "refactor: split <path>" → read board → split → re-run sweep → expect a drop
51
+ ```
52
+
53
+ ## Anti-patterns
54
+
55
+ 1. **Treating findings as a bug queue ("I'll fix all 10").** A sweep is an audit,
56
+ not a backlog. Resolve one finding per focused `/dev-start` session.
57
+ 2. **Silencing a false positive by editing the detector.** First add a top-of-file
58
+ note explaining why JSDoc looks divergent, or fix the signature, or accept the
59
+ nit. Touching the detector is the last resort (separate PR, new code + test).
60
+ 3. **Letting the yellow zone grow "because there's a cohesion note".** The +10%
61
+ tolerance is for specific cases; beyond the budget without a reason is debt.
62
+ 4. **Disabling the `security` profile "because it's rare".** That profile is exactly
63
+ what catches auth/crypto changes when they happen — keep it configured.
64
+ 5. **Hand-editing the board.** Manual edits drift from the scan output and break
65
+ future diffs. Always re-run the sweep.
66
+
67
+ ## Cadence & configuration
68
+
69
+ Profiles and cadence come from `contextkit/config.json`. Edit via `/context-config set`,
70
+ never by hand. Add a custom profile under the sweep config the same way.
71
+
72
+ ## Relation to other L5 components
73
+
74
+ - **`/simulate-impact`** — independent (ledger vs source code).
75
+ - **Contract-drift gate** — complementary: the sweep measures internal health, the
76
+ contract gate measures external commitments.
77
+ - **`/distill-sessions`** — can use recurring findings as a pattern signal.
@@ -0,0 +1,11 @@
1
+ # Changelog
2
+
3
+ All notable changes to {{PROJECT_NAME}} are documented here.
4
+ Format based on [Keep a Changelog](https://keepachangelog.com/).
5
+ This project adheres to [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [Unreleased]
8
+
9
+ Add your changes here. Use sub-sections: Added / Changed / Fixed / Removed.
10
+
11
+ - Added: ContextDevKit context platform scaffolded ({{DATE}}).
@@ -0,0 +1,3 @@
1
+ # ContextDevKit — keep engine scripts and git-hook wrappers LF on all platforms.
2
+ contextkit/**/*.mjs text eol=lf
3
+ .claude/**/*.json text eol=lf
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: Bug report
3
+ about: Something isn't working
4
+ title: 'fix: '
5
+ labels: bug
6
+ ---
7
+
8
+ ## What happened
9
+
10
+ <!-- Clear description of the bug. -->
11
+
12
+ ## Steps to reproduce
13
+
14
+ 1.
15
+ 2.
16
+ 3.
17
+
18
+ ## Expected vs actual
19
+
20
+ - **Expected:**
21
+ - **Actual:**
22
+
23
+ ## Evidence
24
+
25
+ <!-- Error message, stack trace, logs, screenshot. The more exact, the faster the fix. -->
26
+
27
+ ## Environment
28
+
29
+ - OS / runtime version:
30
+ - App version / commit:
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: Feature request
3
+ about: Propose a change or new capability
4
+ title: 'feat: '
5
+ labels: enhancement
6
+ ---
7
+
8
+ ## Problem
9
+
10
+ <!-- What's the user/business problem? Not the solution yet. -->
11
+
12
+ ## Proposed solution
13
+
14
+ <!-- What you'd like to happen. -->
15
+
16
+ ## Alternatives considered
17
+
18
+ <!-- Other approaches and why they're worse. -->
19
+
20
+ ## Does this need an ADR?
21
+
22
+ <!-- If it changes stack/library/pattern, it likely deserves /new-adr before work starts. -->