@softspark/ai-toolkit 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (327) hide show
  1. package/AGENTS.md +412 -0
  2. package/CHANGELOG.md +68 -0
  3. package/LICENSE +21 -0
  4. package/README.md +632 -0
  5. package/action.yml +53 -0
  6. package/app/.claude-plugin/plugin.json +44 -0
  7. package/app/ARCHITECTURE.md +306 -0
  8. package/app/CLAUDE.md.template +23 -0
  9. package/app/agents/ai-engineer.md +128 -0
  10. package/app/agents/backend-specialist.md +193 -0
  11. package/app/agents/business-intelligence.md +54 -0
  12. package/app/agents/chaos-monkey.md +67 -0
  13. package/app/agents/chief-of-staff.md +51 -0
  14. package/app/agents/code-archaeologist.md +127 -0
  15. package/app/agents/code-reviewer.md +184 -0
  16. package/app/agents/command-expert.md +131 -0
  17. package/app/agents/data-analyst.md +205 -0
  18. package/app/agents/data-scientist.md +151 -0
  19. package/app/agents/database-architect.md +317 -0
  20. package/app/agents/debugger.md +238 -0
  21. package/app/agents/devops-implementer.md +194 -0
  22. package/app/agents/documenter.md +364 -0
  23. package/app/agents/explorer-agent.md +145 -0
  24. package/app/agents/fact-checker.md +172 -0
  25. package/app/agents/frontend-specialist.md +209 -0
  26. package/app/agents/game-developer.md +216 -0
  27. package/app/agents/incident-responder.md +226 -0
  28. package/app/agents/infrastructure-architect.md +127 -0
  29. package/app/agents/infrastructure-validator.md +247 -0
  30. package/app/agents/llm-ops-engineer.md +237 -0
  31. package/app/agents/mcp-expert.md +228 -0
  32. package/app/agents/mcp-server-architect.md +195 -0
  33. package/app/agents/mcp-testing-engineer.md +292 -0
  34. package/app/agents/meta-architect.md +58 -0
  35. package/app/agents/ml-engineer.md +136 -0
  36. package/app/agents/mobile-developer.md +190 -0
  37. package/app/agents/night-watchman.md +55 -0
  38. package/app/agents/nlp-engineer.md +154 -0
  39. package/app/agents/orchestrator.md +437 -0
  40. package/app/agents/performance-optimizer.md +254 -0
  41. package/app/agents/predictive-analyst.md +57 -0
  42. package/app/agents/product-manager.md +194 -0
  43. package/app/agents/project-planner.md +287 -0
  44. package/app/agents/prompt-engineer.md +103 -0
  45. package/app/agents/qa-automation-engineer.md +182 -0
  46. package/app/agents/rag-engineer.md +201 -0
  47. package/app/agents/research-synthesizer.md +138 -0
  48. package/app/agents/search-specialist.md +101 -0
  49. package/app/agents/security-architect.md +62 -0
  50. package/app/agents/security-auditor.md +293 -0
  51. package/app/agents/seo-specialist.md +111 -0
  52. package/app/agents/system-governor.md +57 -0
  53. package/app/agents/tech-lead.md +62 -0
  54. package/app/agents/technical-researcher.md +103 -0
  55. package/app/agents/test-engineer.md +264 -0
  56. package/app/constitution.md +38 -0
  57. package/app/hooks/_profile-check.sh +11 -0
  58. package/app/hooks/guard-destructive.sh +74 -0
  59. package/app/hooks/guard-path.sh +73 -0
  60. package/app/hooks/post-tool-use.sh +35 -0
  61. package/app/hooks/pre-compact.sh +31 -0
  62. package/app/hooks/quality-check.sh +22 -0
  63. package/app/hooks/quality-gate.sh +49 -0
  64. package/app/hooks/save-session.sh +24 -0
  65. package/app/hooks/session-end.sh +37 -0
  66. package/app/hooks/session-start.sh +29 -0
  67. package/app/hooks/subagent-start.sh +16 -0
  68. package/app/hooks/subagent-stop.sh +16 -0
  69. package/app/hooks/track-usage.sh +50 -0
  70. package/app/hooks/user-prompt-submit.sh +25 -0
  71. package/app/hooks.json +178 -0
  72. package/app/mcp-defaults.json +23 -0
  73. package/app/output-styles/golden-rules.md +43 -0
  74. package/app/plugins/README.md +19 -0
  75. package/app/plugins/csharp-pack/README.md +11 -0
  76. package/app/plugins/csharp-pack/plugin.json +18 -0
  77. package/app/plugins/enterprise-pack/README.md +16 -0
  78. package/app/plugins/enterprise-pack/hooks/output-style.sh +6 -0
  79. package/app/plugins/enterprise-pack/hooks/status-line.sh +8 -0
  80. package/app/plugins/enterprise-pack/plugin.json +24 -0
  81. package/app/plugins/frontend-pack/README.md +14 -0
  82. package/app/plugins/frontend-pack/plugin.json +22 -0
  83. package/app/plugins/java-pack/README.md +11 -0
  84. package/app/plugins/java-pack/plugin.json +18 -0
  85. package/app/plugins/kotlin-pack/README.md +11 -0
  86. package/app/plugins/kotlin-pack/plugin.json +18 -0
  87. package/app/plugins/memory-pack/README.md +24 -0
  88. package/app/plugins/memory-pack/hooks/observation-capture.sh +67 -0
  89. package/app/plugins/memory-pack/hooks/session-summary.sh +71 -0
  90. package/app/plugins/memory-pack/plugin.json +22 -0
  91. package/app/plugins/memory-pack/scripts/init_db.py +81 -0
  92. package/app/plugins/memory-pack/scripts/strip_private.py +22 -0
  93. package/app/plugins/memory-pack/skills/mem-search/SKILL.md +70 -0
  94. package/app/plugins/research-pack/README.md +14 -0
  95. package/app/plugins/research-pack/plugin.json +22 -0
  96. package/app/plugins/ruby-pack/README.md +11 -0
  97. package/app/plugins/ruby-pack/plugin.json +18 -0
  98. package/app/plugins/rust-pack/README.md +11 -0
  99. package/app/plugins/rust-pack/plugin.json +18 -0
  100. package/app/plugins/security-pack/README.md +15 -0
  101. package/app/plugins/security-pack/plugin.json +23 -0
  102. package/app/plugins/swift-pack/README.md +11 -0
  103. package/app/plugins/swift-pack/plugin.json +18 -0
  104. package/app/rules/claude-toolkit-rules.md +21 -0
  105. package/app/rules/git-conventions.md +5 -0
  106. package/app/rules/quality-gates.md +10 -0
  107. package/app/skills/_lib/__init__.py +1 -0
  108. package/app/skills/_lib/detect_utils.py +150 -0
  109. package/app/skills/agent-creator/SKILL.md +82 -0
  110. package/app/skills/analyze/SKILL.md +92 -0
  111. package/app/skills/analyze/scripts/complexity.py +165 -0
  112. package/app/skills/api-patterns/SKILL.md +305 -0
  113. package/app/skills/app-builder/SKILL.md +187 -0
  114. package/app/skills/architecture-audit/SKILL.md +141 -0
  115. package/app/skills/architecture-decision/SKILL.md +55 -0
  116. package/app/skills/architecture-decision/templates/adr-template.md +36 -0
  117. package/app/skills/biz-scan/SKILL.md +30 -0
  118. package/app/skills/briefing/SKILL.md +27 -0
  119. package/app/skills/build/SKILL.md +97 -0
  120. package/app/skills/build/scripts/detect-build.py +151 -0
  121. package/app/skills/chaos/SKILL.md +32 -0
  122. package/app/skills/ci/SKILL.md +77 -0
  123. package/app/skills/ci/scripts/ci-detect.py +135 -0
  124. package/app/skills/ci/templates/github-actions-node.yml +38 -0
  125. package/app/skills/ci/templates/github-actions-python.yml +42 -0
  126. package/app/skills/ci-cd-patterns/SKILL.md +299 -0
  127. package/app/skills/clean-code/SKILL.md +110 -0
  128. package/app/skills/clean-code/reference/dart.md +18 -0
  129. package/app/skills/clean-code/reference/go.md +23 -0
  130. package/app/skills/clean-code/reference/php.md +32 -0
  131. package/app/skills/clean-code/reference/python.md +180 -0
  132. package/app/skills/clean-code/reference/typescript.md +26 -0
  133. package/app/skills/command-creator/SKILL.md +83 -0
  134. package/app/skills/commit/SKILL.md +98 -0
  135. package/app/skills/commit/scripts/pre-commit-check.py +87 -0
  136. package/app/skills/commit/templates/conventional-commit.md +52 -0
  137. package/app/skills/csharp-patterns/SKILL.md +450 -0
  138. package/app/skills/database-patterns/SKILL.md +297 -0
  139. package/app/skills/debug/SKILL.md +154 -0
  140. package/app/skills/debug/scripts/error-parser.py +187 -0
  141. package/app/skills/debugging-tactics/SKILL.md +136 -0
  142. package/app/skills/deploy/SKILL.md +130 -0
  143. package/app/skills/deploy/scripts/pre_deploy_check.py +171 -0
  144. package/app/skills/deploy/templates/deployment-checklist.md +31 -0
  145. package/app/skills/design-an-interface/SKILL.md +105 -0
  146. package/app/skills/design-engineering/SKILL.md +260 -0
  147. package/app/skills/docker-devops/SKILL.md +303 -0
  148. package/app/skills/docs/SKILL.md +145 -0
  149. package/app/skills/docs/scripts/doc-inventory.py +176 -0
  150. package/app/skills/docs/templates/adr-template.md +36 -0
  151. package/app/skills/docs/templates/readme-template.md +67 -0
  152. package/app/skills/documentation-standards/SKILL.md +191 -0
  153. package/app/skills/ecommerce-patterns/SKILL.md +209 -0
  154. package/app/skills/evaluate/SKILL.md +132 -0
  155. package/app/skills/evolve/SKILL.md +27 -0
  156. package/app/skills/explain/SKILL.md +54 -0
  157. package/app/skills/explain/scripts/dependency-graph.py +215 -0
  158. package/app/skills/explore/SKILL.md +112 -0
  159. package/app/skills/explore/scripts/visualize.py +117 -0
  160. package/app/skills/fix/SKILL.md +78 -0
  161. package/app/skills/fix/scripts/error-classifier.py +191 -0
  162. package/app/skills/flutter-patterns/SKILL.md +254 -0
  163. package/app/skills/git-mastery/SKILL.md +70 -0
  164. package/app/skills/grill-me/SKILL.md +38 -0
  165. package/app/skills/health/SKILL.md +91 -0
  166. package/app/skills/health/scripts/health_check.py +162 -0
  167. package/app/skills/hive-mind/SKILL.md +56 -0
  168. package/app/skills/hook-creator/SKILL.md +107 -0
  169. package/app/skills/index/SKILL.md +74 -0
  170. package/app/skills/instinct-review/SKILL.md +77 -0
  171. package/app/skills/java-patterns/SKILL.md +442 -0
  172. package/app/skills/kotlin-patterns/SKILL.md +446 -0
  173. package/app/skills/lint/SKILL.md +103 -0
  174. package/app/skills/lint/scripts/detect-linters.py +112 -0
  175. package/app/skills/mcp-patterns/SKILL.md +270 -0
  176. package/app/skills/mem-search/SKILL.md +70 -0
  177. package/app/skills/migrate/SKILL.md +90 -0
  178. package/app/skills/migrate/scripts/migration-status.py +195 -0
  179. package/app/skills/migration-patterns/SKILL.md +260 -0
  180. package/app/skills/night-watch/SKILL.md +28 -0
  181. package/app/skills/observability-patterns/SKILL.md +203 -0
  182. package/app/skills/onboard/SKILL.md +76 -0
  183. package/app/skills/orchestrate/SKILL.md +86 -0
  184. package/app/skills/panic/SKILL.md +30 -0
  185. package/app/skills/performance-profiling/SKILL.md +59 -0
  186. package/app/skills/plan/SKILL.md +110 -0
  187. package/app/skills/plan/templates/plan-template.md +40 -0
  188. package/app/skills/plan-writing/SKILL.md +201 -0
  189. package/app/skills/plugin-creator/SKILL.md +78 -0
  190. package/app/skills/pr/SKILL.md +129 -0
  191. package/app/skills/pr/scripts/pr-summary.py +175 -0
  192. package/app/skills/prd-to-issues/SKILL.md +108 -0
  193. package/app/skills/prd-to-plan/SKILL.md +120 -0
  194. package/app/skills/predict/SKILL.md +30 -0
  195. package/app/skills/qa-session/SKILL.md +110 -0
  196. package/app/skills/rag-patterns/SKILL.md +203 -0
  197. package/app/skills/refactor/SKILL.md +124 -0
  198. package/app/skills/refactor/scripts/refactor-scan.py +210 -0
  199. package/app/skills/refactor-plan/SKILL.md +112 -0
  200. package/app/skills/repeat/SKILL.md +149 -0
  201. package/app/skills/research-mastery/SKILL.md +56 -0
  202. package/app/skills/review/SKILL.md +141 -0
  203. package/app/skills/review/scripts/diff-analyzer.py +170 -0
  204. package/app/skills/rollback/SKILL.md +87 -0
  205. package/app/skills/rollback/scripts/rollback_info.py +149 -0
  206. package/app/skills/ruby-patterns/SKILL.md +454 -0
  207. package/app/skills/rust-patterns/SKILL.md +446 -0
  208. package/app/skills/search/SKILL.md +64 -0
  209. package/app/skills/security-patterns/SKILL.md +91 -0
  210. package/app/skills/security-patterns/reference/authentication.md +37 -0
  211. package/app/skills/security-patterns/reference/authorization.md +22 -0
  212. package/app/skills/security-patterns/reference/input-validation.md +30 -0
  213. package/app/skills/security-patterns/reference/oauth-csrf-audit.md +131 -0
  214. package/app/skills/skill-creator/SKILL.md +154 -0
  215. package/app/skills/skill-creator/templates/dashboard/index.html +130 -0
  216. package/app/skills/skill-creator/templates/reasoning-engine/assets/example.json +12 -0
  217. package/app/skills/skill-creator/templates/reasoning-engine/search.py +110 -0
  218. package/app/skills/subagent-development/SKILL.md +225 -0
  219. package/app/skills/subagent-development/reference/code-quality-reviewer-prompt.md +145 -0
  220. package/app/skills/subagent-development/reference/implementer-prompt.md +118 -0
  221. package/app/skills/subagent-development/reference/spec-reviewer-prompt.md +100 -0
  222. package/app/skills/swarm/SKILL.md +81 -0
  223. package/app/skills/swift-patterns/SKILL.md +500 -0
  224. package/app/skills/tdd/SKILL.md +174 -0
  225. package/app/skills/tdd/reference/deep-modules.md +32 -0
  226. package/app/skills/tdd/reference/interface-design.md +32 -0
  227. package/app/skills/tdd/reference/mocking.md +52 -0
  228. package/app/skills/tdd/reference/refactoring.md +10 -0
  229. package/app/skills/tdd/reference/tests.md +59 -0
  230. package/app/skills/teams/SKILL.md +101 -0
  231. package/app/skills/test/SKILL.md +107 -0
  232. package/app/skills/test/scripts/detect-runner.py +113 -0
  233. package/app/skills/testing-patterns/SKILL.md +73 -0
  234. package/app/skills/testing-patterns/reference/flutter-testing.md +33 -0
  235. package/app/skills/testing-patterns/reference/go-testing.md +52 -0
  236. package/app/skills/testing-patterns/reference/php-phpunit.md +39 -0
  237. package/app/skills/testing-patterns/reference/python-pytest.md +228 -0
  238. package/app/skills/testing-patterns/reference/typescript-vitest.md +50 -0
  239. package/app/skills/triage-issue/SKILL.md +120 -0
  240. package/app/skills/typescript-patterns/SKILL.md +256 -0
  241. package/app/skills/ubiquitous-language/SKILL.md +74 -0
  242. package/app/skills/verification-before-completion/SKILL.md +108 -0
  243. package/app/skills/workflow/SKILL.md +250 -0
  244. package/app/skills/write-a-prd/SKILL.md +129 -0
  245. package/app/skills/write-a-prd/reference/visual-companion.md +78 -0
  246. package/app/skills/write-a-prd/scripts/frame-template.html +111 -0
  247. package/app/skills/write-a-prd/scripts/visual-server.cjs +79 -0
  248. package/app/templates/skill/generator/SKILL.md.template +40 -0
  249. package/app/templates/skill/knowledge/SKILL.md.template +52 -0
  250. package/app/templates/skill/linter/SKILL.md.template +34 -0
  251. package/app/templates/skill/reviewer/SKILL.md.template +51 -0
  252. package/app/templates/skill/workflow/SKILL.md.template +49 -0
  253. package/benchmarks/README.md +111 -0
  254. package/benchmarks/ecosystem-dashboard.json +148 -0
  255. package/benchmarks/ecosystem-harvest.json +148 -0
  256. package/benchmarks/results.json +38 -0
  257. package/benchmarks/run.py +351 -0
  258. package/bin/ai-toolkit.js +345 -0
  259. package/kb/best-practices/README.md +11 -0
  260. package/kb/howto/README.md +11 -0
  261. package/kb/procedures/maintenance-sop.md +306 -0
  262. package/kb/reference/agents-catalog.md +124 -0
  263. package/kb/reference/anti-pattern-registry-format.md +221 -0
  264. package/kb/reference/architecture-overview.md +232 -0
  265. package/kb/reference/benchmark-config.md +62 -0
  266. package/kb/reference/ci-integration.md +66 -0
  267. package/kb/reference/claude-ecosystem-benchmark-snapshot.md +80 -0
  268. package/kb/reference/claude-ecosystem-expansion-foundations.md +102 -0
  269. package/kb/reference/commands-catalog.md +21 -0
  270. package/kb/reference/distribution-model.md +63 -0
  271. package/kb/reference/global-install-model.md +56 -0
  272. package/kb/reference/hierarchical-override-pattern.md +200 -0
  273. package/kb/reference/hooks-catalog.md +306 -0
  274. package/kb/reference/integrations.md +88 -0
  275. package/kb/reference/language-packs.md +52 -0
  276. package/kb/reference/merge-friendly-install-model.md +58 -0
  277. package/kb/reference/plugin-pack-conventions.md +151 -0
  278. package/kb/reference/quick-wins-implementation-summary.md +70 -0
  279. package/kb/reference/skill-templates.md +50 -0
  280. package/kb/reference/skills-catalog.md +215 -0
  281. package/kb/reference/skills-unification.md +57 -0
  282. package/kb/reference/stats.md +69 -0
  283. package/kb/reference/sync.md +76 -0
  284. package/kb/troubleshooting/README.md +11 -0
  285. package/llms-full.txt +3068 -0
  286. package/llms.txt +39 -0
  287. package/package.json +75 -0
  288. package/scripts/_common.py +160 -0
  289. package/scripts/add_rule.py +50 -0
  290. package/scripts/benchmark_config.py +127 -0
  291. package/scripts/benchmark_ecosystem.py +288 -0
  292. package/scripts/check_deps.py +260 -0
  293. package/scripts/create_skill.py +118 -0
  294. package/scripts/doctor.py +504 -0
  295. package/scripts/eject.py +113 -0
  296. package/scripts/emission.py +256 -0
  297. package/scripts/evaluate_skills.py +260 -0
  298. package/scripts/frontmatter.py +58 -0
  299. package/scripts/generate_agents_md.py +91 -0
  300. package/scripts/generate_aider_conf.py +51 -0
  301. package/scripts/generate_cline.py +35 -0
  302. package/scripts/generate_copilot.py +30 -0
  303. package/scripts/generate_cursor_rules.py +35 -0
  304. package/scripts/generate_gemini.py +28 -0
  305. package/scripts/generate_llms_txt.py +164 -0
  306. package/scripts/generate_roo_modes.py +80 -0
  307. package/scripts/generate_windsurf.py +35 -0
  308. package/scripts/generator_base.py +140 -0
  309. package/scripts/harvest_ecosystem.py +50 -0
  310. package/scripts/inject_rule_cli.py +101 -0
  311. package/scripts/inject_section_cli.py +47 -0
  312. package/scripts/injection.py +180 -0
  313. package/scripts/install.py +236 -0
  314. package/scripts/install_git_hooks.py +71 -0
  315. package/scripts/install_steps/__init__.py +5 -0
  316. package/scripts/install_steps/ai_tools.py +261 -0
  317. package/scripts/install_steps/hooks.py +90 -0
  318. package/scripts/install_steps/markers.py +79 -0
  319. package/scripts/install_steps/symlinks.py +87 -0
  320. package/scripts/merge-hooks.py +192 -0
  321. package/scripts/plugin.py +642 -0
  322. package/scripts/plugin_schema.py +138 -0
  323. package/scripts/remove_rule.py +58 -0
  324. package/scripts/stats.py +81 -0
  325. package/scripts/sync.py +215 -0
  326. package/scripts/uninstall.py +292 -0
  327. package/scripts/validate.py +700 -0
package/llms-full.txt ADDED
@@ -0,0 +1,3068 @@
1
+ # ai-toolkit
2
+
3
+ > Professional-grade Claude Code toolkit: 85 skills, 47 agents, machine-enforced constitution, quality hooks.
4
+
5
+ ## Documentation
6
+
7
+ - [README](README.md): Installation, usage, and feature overview
8
+ - [CHANGELOG](CHANGELOG.md): Version history
9
+ - [ARCHITECTURE](app/ARCHITECTURE.md): System design
10
+ - [CONSTITUTION](app/constitution.md): Safety rules
11
+
12
+ ## Knowledge Base
13
+
14
+ - [Best Practices](kb/best-practices/README.md)
15
+ - [How-To Guides](kb/howto/README.md)
16
+ - [SOP: Claude Toolkit Maintenance](kb/procedures/maintenance-sop.md)
17
+ - [Agents Catalog (47 agents)](kb/reference/agents-catalog.md)
18
+ - [Anti-Pattern Registry Format](kb/reference/anti-pattern-registry-format.md)
19
+ - [AI Toolkit Architecture](kb/reference/architecture-overview.md)
20
+ - [Config Benchmark](kb/reference/benchmark-config.md)
21
+ - [CI Integration](kb/reference/ci-integration.md)
22
+ - [Claude Ecosystem Benchmark Snapshot](kb/reference/claude-ecosystem-benchmark-snapshot.md)
23
+ - [Claude Ecosystem Expansion Foundations](kb/reference/claude-ecosystem-expansion-foundations.md)
24
+ - [Commands Catalog (DEPRECATED)](kb/reference/commands-catalog.md)
25
+ - [Distribution Model](kb/reference/distribution-model.md)
26
+ - [Global Install Model](kb/reference/global-install-model.md)
27
+ - [Hierarchical Override Pattern](kb/reference/hierarchical-override-pattern.md)
28
+ - [Hooks Catalog](kb/reference/hooks-catalog.md)
29
+ - [External Integrations](kb/reference/integrations.md)
30
+ - [Language Plugin Packs](kb/reference/language-packs.md)
31
+ - [Merge-Friendly Install Model](kb/reference/merge-friendly-install-model.md)
32
+ - [Plugin Pack Conventions](kb/reference/plugin-pack-conventions.md)
33
+ - [Quick Wins Implementation Summary](kb/reference/quick-wins-implementation-summary.md)
34
+ - [Skill Templates](kb/reference/skill-templates.md)
35
+ - [Skills Catalog (85 skills)](kb/reference/skills-catalog.md)
36
+ - [Skills Unification Model](kb/reference/skills-unification.md)
37
+ - [Usage Statistics](kb/reference/stats.md)
38
+ - [Config Sync](kb/reference/sync.md)
39
+ - [Troubleshooting](kb/troubleshooting/README.md)
40
+
41
+ ## Skills
42
+
43
+ - **agent-creator**: Creates new specialized agents with frontmatter, tool selection, and delegation guidance
44
+ - **analyze**: Analyze code quality, complexity, and patterns
45
+ - **api-patterns**: Loaded when user asks about REST API design or GraphQL patterns
46
+ - **app-builder**: Loaded when user asks to scaffold or build a full-stack app
47
+ - **architecture-audit**: Explore codebase organically for architectural friction, discover shallow modules, and propose module-deepening refactors as GitHub issue RFCs using parallel sub-agent interface designs. Use when user wants to improve architecture, find shallow modules, deepen modules, or reduce coupling.
48
+ - **architecture-decision**: Loaded when user asks about architecture decisions or architecture note writing
49
+ - **biz-scan**: Scan codebase for business opportunities and KPIs
50
+ - **briefing**: Generate executive daily briefing across all agents
51
+ - **build**: Build the project with auto-detected toolchain
52
+ - **chaos**: Inject controlled faults for resilience testing
53
+ - **ci**: Detect and run CI pipeline with status reporting
54
+ - **ci-cd-patterns**: Loaded when user asks about CI/CD pipelines or deployment automation
55
+ - **clean-code**: Loaded when user asks about clean code, naming, or code quality
56
+ - **command-creator**: Creates new Claude Code slash commands with frontmatter, workflow guidance, and validation
57
+ - **commit**: Create Conventional Commits with pre-commit validation
58
+ - **csharp-patterns**: Loaded when user asks about C# or .NET development patterns
59
+ - **database-patterns**: Loaded when user asks about database schema or query optimization
60
+ - **debug**: Debug errors and trace root causes systematically
61
+ - **debugging-tactics**: Loaded when user is debugging an issue or needs root cause analysis
62
+ - **deploy**: Deploy with pre-flight checks and health verification
63
+ - **design-an-interface**: Generate multiple radically different interface designs using parallel sub-agents, then compare on simplicity, depth, and correctness. Based on 'Design It Twice' from Ousterhout. Use when user wants to design an API, explore interface options, compare module shapes, or mentions 'design it twice'.
64
+ - **design-engineering**: Loaded when user asks about UI animations or CSS design craft
65
+ - **docker-devops**: Loaded when user asks about Docker, containers, or DevOps patterns
66
+ - **docs**: Generate and update README, API docs, and architecture notes
67
+ - **documentation-standards**: Loaded when creating or updating KB documents, architecture notes, SOPs, or any file in kb/ directory
68
+ - **ecommerce-patterns**: Loaded when user asks about e-commerce or shopping cart features
69
+ - **evaluate**: Evaluate skill quality and RAG retrieval accuracy
70
+ - **evolve**: Evolve agent definitions via meta-architect
71
+ - **explain**: Explain code, architecture, or concepts with diagrams
72
+ - **explore**: Explore codebase structure, stack, and architecture
73
+ - **fix**: Auto-fix lint errors, type issues, and simple bugs
74
+ - **flutter-patterns**: Loaded when user asks about Flutter or Dart development patterns
75
+ - **git-mastery**: Loaded when user asks about advanced Git workflows or history rewriting
76
+ - **grill-me**: Stress-test a plan or design through relentless Socratic questioning, walking down each decision branch until reaching shared understanding. Use when user wants to stress-test a plan, get grilled, validate assumptions, or mentions 'grill me'.
77
+ - **health**: Report service and infrastructure health status
78
+ - **hive-mind**: Loaded when orchestrating multi-agent swarms or consensus workflows
79
+ - **hook-creator**: Creates new Claude Code hooks with guided workflow, strict conventions, and validation
80
+ - **index**: Index codebase into the knowledge base
81
+ - **instinct-review**: Review and manage learned instincts from past sessions
82
+ - **java-patterns**: Loaded when user asks about Java development patterns
83
+ - **kotlin-patterns**: Loaded when user asks about Kotlin development patterns
84
+ - **lint**: Lint code with auto-detected tools and fix suggestions
85
+ - **mcp-patterns**: Loaded when user asks about MCP servers or tool protocol design
86
+ - **mem-search**: Search past coding sessions using natural language. Finds relevant observations, decisions, and context from previous work.
87
+ - **migrate**: Run database migrations with backup verification
88
+ - **migration-patterns**: Loaded when user asks about database migrations or zero-downtime deploys
89
+ - **night-watch**: Run autonomous maintenance and dependency updates
90
+ - **observability-patterns**: Loaded when user asks about logging, metrics, or tracing patterns
91
+ - **onboard**: Generate project onboarding materials
92
+ - **orchestrate**: Coordinate multiple specialized agents in parallel
93
+ - **panic**: Emergency stabilization via system-governor agent
94
+ - **performance-profiling**: Loaded when user asks about performance profiling or optimization
95
+ - **plan**: Plan implementation with tasks and success criteria
96
+ - **plan-writing**: Loaded when user asks to write an implementation plan or pre-mortem
97
+ - **plugin-creator**: Creates experimental opt-in Claude Code plugin packs with manifests, conventions, and optional module scaffolding
98
+ - **pr**: Create pull requests with pre-flight validation
99
+ - **prd-to-issues**: Break a PRD into independently-grabbable GitHub issues using vertical slices with HITL/AFK tagging and dependency ordering. Use when user wants to convert a PRD to issues, create tickets, or break down a PRD into work items.
100
+ - **prd-to-plan**: Convert a PRD into a phased implementation plan using tracer-bullet vertical slices. Use when user wants to break down a PRD, create an implementation plan, plan phases from a PRD, or mentions tracer bullets.
101
+ - **predict**: Predict regressions and impact before changes land
102
+ - **qa-session**: Interactive QA session where user reports bugs conversationally and agent files GitHub issues with domain language. Explores codebase in background for context. Use when user wants to report bugs, do QA, file issues conversationally, or mentions QA session.
103
+ - **rag-patterns**: Loaded when user asks about RAG systems, embeddings, or vector search
104
+ - **refactor**: Refactor code for quality and maintainability
105
+ - **refactor-plan**: Create a detailed refactor plan with tiny commits via user interview, then file as a GitHub issue RFC. Use when user wants to plan a refactor, create a refactoring RFC, or break a refactor into safe incremental steps.
106
+ - **repeat**: Run a prompt or slash command on a recurring interval until task complete or limits reached. Use when user wants to set up a recurring task, poll for status, or run something repeatedly on an interval.
107
+ - **research-mastery**: Loaded when user asks to research, verify, or synthesize information
108
+ - **review**: Review code for quality, security, and correctness
109
+ - **rollback**: Roll back a deployment safely with verification
110
+ - **ruby-patterns**: Loaded when user asks about Ruby development patterns
111
+ - **rust-patterns**: Loaded when user asks about Rust development patterns
112
+ - **search**: Search the knowledge base with semantic and hybrid modes
113
+ - **security-patterns**: Loaded when user asks about security, OWASP, or auth patterns
114
+ - **skill-creator**: Create new skills from templates with guided workflow
115
+ - **subagent-development**: Execute implementation plans using fresh subagents per task with two-stage review: spec compliance first, then code quality. Use when executing plans with independent tasks.
116
+ - **swarm**: Execute tasks via Map-Reduce, Consensus, or Relay swarms
117
+ - **swift-patterns**: Loaded when user asks about Swift or iOS development patterns
118
+ - **tdd**: Test-driven development with red-green-refactor loop and vertical slices. Use when user wants TDD, test-first development, red-green-refactor, or building features with tests driving the implementation.
119
+ - **teams**: Launch pre-configured Agent Teams for common workflows
120
+ - **test**: Run tests with coverage analysis and reporting
121
+ - **testing-patterns**: Loaded when user asks about testing strategy, fixtures, or mocking
122
+ - **triage-issue**: Triage a bug by deeply exploring the codebase for root cause, then create a GitHub issue with a TDD-based fix plan. Mostly hands-off — minimal user interaction. Use when user reports a bug, wants to investigate an issue, mentions triage, or wants a fix plan.
123
+ - **typescript-patterns**: Loaded when user asks about TypeScript patterns or type safety
124
+ - **ubiquitous-language**: Extract a DDD-style ubiquitous language glossary from the conversation, flagging ambiguities and proposing canonical terms. Saves to UBIQUITOUS_LANGUAGE.md. Use when user wants to define domain terms, build a glossary, harden terminology, or mentions DDD or domain model.
125
+ - **verification-before-completion**: Loaded when agent is about to claim work is complete, fixed, or passing — requires running verification commands and confirming output before making any success claims. Evidence before assertions, always.
126
+ - **workflow**: Start and manage autonomous agent workflows
127
+ - **write-a-prd**: Create a Product Requirements Document through interactive interview, codebase exploration, and deep module design. Use when user wants to write a PRD, create product requirements, or plan a new feature from scratch.
128
+
129
+ ## Agents
130
+
131
+ - **ai-engineer**: AI/ML integration specialist. Use for LLM integration, vector databases, RAG pipelines, embeddings, and AI agent orchestration. Triggers: ai, ml, llm, embedding, vector, rag, agent, openai, anthropic.
132
+ - **backend-specialist**: Expert backend architect for Node.js, Python, PHP, and modern serverless systems. Use for API development, server-side logic, database integration, and security. Triggers: backend, server, api, endpoint, database, auth, fastapi, express, laravel.
133
+ - **business-intelligence**: Opportunity Discovery agent. Scans data models and code to identify missing business metrics, KPIs, and opportunities for value creation.
134
+ - **chaos-monkey**: Resilience testing agent. Use to inject faults, latency, and failures into the system to verify robustness and recovery mechanisms.
135
+ - **chief-of-staff**: Executive Summary agent. Aggregates reports from all other agents to reduce noise and present a single, actionable daily briefing to the user.
136
+ - **code-archaeologist**: Legacy code investigation and understanding specialist. Trigger words: legacy code, code archaeology, dead code, technical debt, dependency analysis, refactoring, code history
137
+ - **code-reviewer**: Code review and security audit expert. Use for security reviews, Devil's Advocate analysis, quality audits, best practices validation. Triggers: review, security, audit, quality, best practices, vulnerability.
138
+ - **command-expert**: CLI commands and shell scripting specialist. Trigger words: bash, shell, CLI, script, automation, command line, build script, deployment script
139
+ - **data-analyst**: Data analysis and visualization expert. Use for SQL queries, data exploration, analytics, reporting, and insights. Triggers: data, analysis, sql, query, visualization, metrics, dashboard, pandas, report.
140
+ - **data-scientist**: Statistical analysis and data insights specialist. Use for statistical analysis, data visualization, EDA, A/B testing, and predictive modeling. Triggers: statistics, visualization, eda, analysis, hypothesis testing, ab test.
141
+ - **database-architect**: Database design, optimization, and operations expert. Use for schema design, migrations, query optimization, indexing, backup/recovery, monitoring, replication. Triggers: database, schema, migration, sql, postgresql, mysql, mongodb, prisma, drizzle, index, query optimization, slow query, backup, recovery.
142
+ - **debugger**: Root cause analysis expert. Use for cryptic errors, stack traces, intermittent failures, silent bugs, and systematic debugging. Triggers: debug, error, exception, traceback, bug, failure, root cause.
143
+ - **devops-implementer**: Infrastructure implementation expert. Use for writing Terraform, Ansible, Docker, and shell scripts based on approved architecture notes and implementation summaries. Triggers: terraform, ansible, docker, kubernetes, shell, infrastructure, deployment, configuration.
144
+ - **documenter**: Documentation and KB expert. Use for architecture notes, runbooks, changelogs, KB updates, how-to guides, API docs, READMEs, tutorials, SOP creation, KB organization, content quality review. Triggers: document, documentation, architecture-note, runbook, changelog, howto, readme, kb, sop, technical writing.
145
+ - **explorer-agent**: Codebase exploration and discovery agent. Use for mapping project structure, finding dependencies, understanding architecture, and research. Does NOT write code - only reads and analyzes.
146
+ - **fact-checker**: Claim verification expert. Use for verifying facts, source validation, RAG result accuracy checking. Triggers: fact check, verify, accuracy, claim, source validation.
147
+ - **frontend-specialist**: Senior Frontend Architect for React, Next.js, Vue, and modern web systems. Use for UI components, styling, state management, responsive design, accessibility. Triggers: component, react, vue, ui, ux, css, tailwind, responsive, nextjs.
148
+ - **game-developer**: Game development across all platforms (PC, Web, Mobile, VR/AR). Use for Unity, Godot, Unreal, Phaser, Three.js. Covers game mechanics, multiplayer, optimization, 2D/3D graphics.
149
+ - **incident-responder**: Production incident response expert. Use for P1-P4 incidents, outages, emergency fixes, and postmortem documentation. Triggers: incident, outage, production down, emergency, P1, alert, monitoring.
150
+ - **infrastructure-architect**: System design expert. Use for architectural decisions, architecture notes, trade-off analysis, technology selection. Triggers: architecture, design, decision, trade-off, scalability, infrastructure planning.
151
+ - **infrastructure-validator**: Deployment validation expert. Use for deployment verification, health checks, testing, rollback procedures. Triggers: validate, deploy, deployment, health check, smoke test, rollback.
152
+ - **llm-ops-engineer**: LLM operations expert. Use for LLM caching, fallback strategies, cost optimization, observability, and reliability. Triggers: llm, language model, openai, ollama, caching, fallback, token, cost.
153
+ - **mcp-expert**: MCP integration expert. Use for configuring MCP clients, integrations, troubleshooting MCP connections. Triggers: mcp config, mcp integration, mcp connection, claude desktop, mcp client.
154
+ - **mcp-server-architect**: MCP server design and implementation expert. Use for creating MCP servers, JSON-RPC transport, tool definitions, protocol compliance. Triggers: mcp, model context protocol, json-rpc, sse, stdio, mcp server.
155
+ - **mcp-testing-engineer**: MCP protocol testing expert. Use for MCP server testing, protocol compliance, transport validation, integration testing. Triggers: mcp test, protocol compliance, mcp validation, transport testing.
156
+ - **meta-architect**: Self-Optimization agent. Analyzes system performance and mistakes to update agent definitions and instructions. The only agent allowed to modify .claude/agents/*.
157
+ - **ml-engineer**: Machine learning systems specialist. Use for model training, data pipelines, MLOps, and model deployment. Triggers: ml, machine learning, model training, mlops, tensorflow, pytorch, scikit-learn.
158
+ - **mobile-developer**: Expert in React Native, Flutter, and native mobile development. Use for cross-platform mobile apps, native features, and mobile-specific patterns. Triggers: mobile, react native, flutter, ios, android, app store, expo, swift, kotlin.
159
+ - **night-watchman**: Autonomous maintenance agent. Use for automated dependency updates, dead code removal, refactoring, and project hygiene tasks. Typically scheduled to run off-hours.
160
+ - **nlp-engineer**: Natural Language Processing specialist. Use for text processing, NER, text classification, information extraction, and language model fine-tuning. Triggers: nlp, ner, tokenization, text classification, sentiment, spacy, transformers.
161
+ - **orchestrator**: Multi-agent coordination and task orchestration. Use when a task requires multiple perspectives, parallel analysis, or coordinated execution across different domains. Invoke for complex tasks benefiting from security, backend, frontend, testing, and DevOps expertise combined.
162
+ - **performance-optimizer**: Performance optimization expert. Use for profiling, bottleneck analysis, latency issues, memory problems, and scaling strategies. Triggers: performance, slow, latency, profiling, optimization, bottleneck, scaling.
163
+ - **predictive-analyst**: Precognition agent. Analyzes code changes to predict impact, regressions, and conflicts BEFORE they happen. Uses dependency graphs and historical data.
164
+ - **product-manager**: Product management and value maximization expert. Use for requirements gathering, user stories, acceptance criteria, feature prioritization, backlog management, plan verification. Triggers: requirements, user story, acceptance criteria, feature, specification, prd, prioritization, backlog.
165
+ - **project-planner**: Smart project planning agent. Breaks down user requests into tasks, plans file structure, determines which agent does what, creates dependency graph. Use when starting new projects or planning major features.
166
+ - **prompt-engineer**: LLM prompt design and optimization specialist. Trigger words: prompt, LLM, chain-of-thought, few-shot, system prompt, prompt engineering, token optimization
167
+ - **qa-automation-engineer**: Test automation and QA specialist. Use for E2E testing, API testing, performance testing, and CI/CD test integration. Triggers: e2e, playwright, cypress, selenium, api test, performance test, automation.
168
+ - **rag-engineer**: RAG systems expert. Use for document indexing, semantic search, hybrid retrieval, CRAG, multi-hop reasoning, and answer generation. Triggers: rag, search, retrieval, indexing, embedding, vector, chunking, reranking.
169
+ - **research-synthesizer**: Multi-source research coordination and synthesis specialist. Trigger words: synthesize, aggregate, report, executive summary, gap analysis, conflict resolution, findings, research, investigate, multi-source, cross-reference, research planning
170
+ - **search-specialist**: Information retrieval and search optimization specialist. Trigger words: search, query, semantic search, information retrieval, relevance, ranking, search optimization
171
+ - **security-architect**: Proactive security design expert. Use for Threat Modeling, architecture security reviews, and designing secure systems (AuthN/AuthZ, Crypto).
172
+ - **security-auditor**: Security expert. Use for OWASP Top 10, CVE analysis, security audits, penetration testing, vulnerability assessment, hardening. Triggers: security, owasp, cve, vulnerability, audit, hardening, penetration, pentest, injection test, api security.
173
+ - **seo-specialist**: Search engine optimization specialist. Trigger words: SEO, search engine, meta tags, structured data, Core Web Vitals, sitemap, robots.txt, schema.org
174
+ - **system-governor**: The Guardian of the Constitution. Validates all evolutionary changes and enforces immutable rules. Has VETO power.
175
+ - **tech-lead**: Technical authority for code quality, architecture patterns, and stack decisions. Use for code reviews, technological disputes, and standards enforcement.
176
+ - **technical-researcher**: Deep technical investigation specialist. Trigger words: technical research, feasibility study, root cause analysis, API investigation, compatibility research, comparison matrix
177
+ - **test-engineer**: Testing expert. Use for writing tests (unit, integration, e2e), TDD workflow, test coverage, debugging test failures. Triggers: test, pytest, unittest, coverage, tdd, testing, mock, fixture.
178
+
179
+ ---
180
+
181
+ ## kb/best-practices/README.md
182
+
183
+ ---
184
+ title: "Best Practices"
185
+ service: ai-toolkit
186
+ category: best-practices
187
+ tags: [best-practices, guidelines]
188
+ last_updated: "2026-03-25"
189
+ ---
190
+
191
+ # Best Practices
192
+
193
+ Guidelines and recommendations. Guides will be added here as they are created.
194
+
195
+ ---
196
+
197
+ ## kb/howto/README.md
198
+
199
+ ---
200
+ title: "How-To Guides"
201
+ service: ai-toolkit
202
+ category: howto
203
+ tags: [howto, guides]
204
+ last_updated: "2026-03-25"
205
+ ---
206
+
207
+ # How-To Guides
208
+
209
+ Step-by-step guides for common tasks. Guides will be added here as they are created.
210
+
211
+ ---
212
+
213
+ ## kb/procedures/maintenance-sop.md
214
+
215
+ ---
216
+ title: "SOP: Claude Toolkit Maintenance"
217
+ category: procedures
218
+ service: ai-toolkit
219
+ tags: [sop, maintenance, agents, skills, install]
220
+ version: "1.0.0"
221
+ created: "2026-03-23"
222
+ last_updated: "2026-04-02"
223
+ description: "Standard operating procedures for installing, maintaining, and evolving the ai-toolkit."
224
+ ---
225
+
226
+ # SOP: Claude Toolkit Maintenance
227
+
228
+ ## Init Repository (New Project)
229
+
230
+ Use this when starting a new project that should use the toolkit.
231
+
232
+ **Prerequisites:** toolkit installed globally (`ai-toolkit install` already done once).
233
+
234
+ ```bash
235
+ cd /path/to/new-project
236
+ ai-toolkit install --local
237
+ ```
238
+
239
+ This creates/updates:
240
+ - `CLAUDE.md` — project-specific rules template (only if missing)
241
+ - `.claude/settings.local.json` — MCP servers, env vars, permissions (only if missing, initialized with MCP defaults)
242
+ - `.claude/constitution.md` — toolkit constitution **injected** via markers (preserves user content)
243
+ - `.github/copilot-instructions.md` — GitHub Copilot rules (marker-injected)
244
+ - `.clinerules` — Cline rules (marker-injected)
245
+ - `.roomodes` — Roo Code custom modes (generated)
246
+ - `.aider.conf.yml` — Aider configuration (generated)
247
+ - `.git/hooks/pre-commit` — Safety fallback for quality gates (generated)
248
+
249
+ **Note:** Hooks are global-only — merged into `~/.claude/settings.json` by `ai-toolkit install`. Project-local `--local` does not install hooks; any legacy `.claude/hooks.json` is removed automatically.
250
+
251
+ Then edit `CLAUDE.md`:
252
+ ```markdown
253
+ # My Project
254
+
255
+ ## Overview
256
+ What this project does.
257
+
258
+ ## Tech Stack
259
+ - Language: TypeScript
260
+ - Framework: Next.js
261
+ - Database: PostgreSQL
262
+
263
+ ## Commands
264
+ # Dev: npm run dev
265
+ # Test: npm test
266
+ # Build: npm run build
267
+ ```
268
+
269
+ ---
270
+
271
+ ## Install Toolkit Globally
272
+
273
+ Run once per machine. Installs into `~/.claude/` — available in all projects.
274
+
275
+ ```bash
276
+ npm install -g @softspark/ai-toolkit # once per machine
277
+ ai-toolkit install # sets up ~/.claude/
278
+ ```
279
+
280
+ What `install` and `update` do (merge-friendly — user content never overwritten):
281
+
282
+ | Component | Strategy | User collision |
283
+ |-----------|----------|---------------|
284
+ | `agents/*.md` | Per-file symlinks into `~/.claude/agents/` | User file with same name preserved (toolkit skipped) |
285
+ | `skills/*/` | Per-directory symlinks into `~/.claude/skills/` | User dir with same name preserved |
286
+ | `settings.json` hooks | JSON merge via `merge-hooks.py` | User hooks + settings preserved, toolkit entries tagged `_source: ai-toolkit` |
287
+ | `constitution.md` | Marker injection via `inject_section_cli.py` | User content outside `<!-- TOOLKIT:* -->` markers untouched |
288
+ | `ARCHITECTURE.md` | Marker injection via `inject_section_cli.py` | Same as above |
289
+ | `CLAUDE.md` | Marker injection of `app/rules/*.md` via `inject_rule_cli.py` | User content outside markers untouched |
290
+
291
+ Re-running updates only toolkit content. Old whole-directory symlinks are auto-upgraded to per-file on next run.
292
+
293
+ ---
294
+
295
+ ## Update Toolkit
296
+
297
+ After a new npm release:
298
+
299
+ ```bash
300
+ npm install -g @softspark/ai-toolkit@latest
301
+ ai-toolkit update
302
+ ```
303
+
304
+ `update` is a semantic alias for `install` — use it for all re-apply flows. Supports the same flags:
305
+
306
+ ```bash
307
+ ai-toolkit update --only agents,hooks # re-apply only specific components
308
+ ai-toolkit update --local # also refresh project-local Copilot + Cline + Roo + Aider
309
+ ai-toolkit update --list # dry-run: show what would change
310
+ ```
311
+
312
+ ---
313
+
314
+ ## Register a Rule from Another Repo
315
+
316
+ Third-party repos (jira-mcp, rag-mcp, etc.) can register their own rules globally:
317
+
318
+ ```bash
319
+ ai-toolkit add-rule ./my-project-rules.md
320
+ # → copies to ~/.ai-toolkit/rules/my-project-rules.md
321
+
322
+ ai-toolkit update
323
+ # → injects the rule into ~/.claude/CLAUDE.md, ~/.cursor/rules, Windsurf, Gemini
324
+ ```
325
+
326
+ To unregister (removes from registry **and** strips the block from CLAUDE.md):
327
+
328
+ ```bash
329
+ ai-toolkit remove-rule my-project-rules
330
+ ```
331
+
332
+ Rule names derive from the filename (`my-project-rules.md` → marker `TOOLKIT:my-project-rules`).
333
+
334
+ ---
335
+
336
+ ## Adding a New Agent
337
+
338
+ 1. Create `app/agents/<agent-name>.md` with YAML frontmatter:
339
+ ```yaml
340
+ ---
341
+ name: agent-name
342
+ description: "When to use this agent. Triggers: keyword1, keyword2."
343
+ tools: Read, Write, Edit, Bash
344
+ model: opus
345
+ skills: skill-1, skill-2
346
+ ---
347
+ ```
348
+ 2. Write agent instructions below frontmatter
349
+ 3. Update `kb/reference/agents-catalog.md`
350
+ 4. Update `app/ARCHITECTURE.md` counts
351
+ 5. Run `scripts/validate.py`
352
+ 6. Regenerate: `scripts/generate_agents_md.py > AGENTS.md`
353
+
354
+ ## Adding a New Skill
355
+
356
+ 1. Create `app/skills/<skill-name>/SKILL.md` with frontmatter:
357
+ ```yaml
358
+ ---
359
+ name: skill-name
360
+ description: "Third-person description. Max 1024 chars."
361
+ effort: medium
362
+ disable-model-invocation: true # task skill
363
+ user-invocable: false # knowledge skill
364
+ ---
365
+ ```
366
+ 2. Update `kb/reference/skills-catalog.md` and `app/ARCHITECTURE.md`
367
+ 3. Run `scripts/validate.py`
368
+
369
+ ## Adding a New Hook
370
+
371
+ Preferred path:
372
+
373
+ ```bash
374
+ /hook-creator [event or hook description]
375
+ ```
376
+
377
+ Manual path:
378
+
379
+ 1. Create `app/hooks/<hook-name>.sh`
380
+ 2. Register the hook under `app/hooks.json`
381
+ 3. Run `scripts/validate.py`
382
+ 4. Run `scripts/doctor.py`
383
+ 5. Update `kb/reference/hooks-catalog.md`, `README.md`, and any affected architecture docs
384
+
385
+ Use `PreToolUse` for blocking validations, `PostToolUse` for non-blocking feedback, `UserPromptSubmit` for prompt governance, and `PreCompact` / `SessionEnd` for context preservation and handoff.
386
+
387
+ ## Managing Plugins
388
+
389
+ ```bash
390
+ ai-toolkit plugin list # show available packs
391
+ ai-toolkit plugin install <name> # install a single pack
392
+ ai-toolkit plugin install --all # install all 11 packs
393
+ ai-toolkit plugin update <name> # update a pack (preserves data)
394
+ ai-toolkit plugin update --all # update all installed packs
395
+ ai-toolkit plugin clean <name> # prune data older than 90 days
396
+ ai-toolkit plugin clean <name> --days 30 # custom retention
397
+ ai-toolkit plugin remove <name> # remove a pack
398
+ ai-toolkit plugin status # show installed packs with data stats
399
+ ```
400
+
401
+ Install copies hooks/scripts, verifies agents+skills are linked, merges hooks into `settings.json`, and runs init scripts. Update removes and reinstalls from current source (data preserved). Clean prunes old plugin data. Remove reverses install but leaves data intact. Core agents/skills are never removed.
402
+
403
+ Memory-pack auto-prunes observations older than 90 days on every session end (configurable via `MEMORY_RETENTION_DAYS`).
404
+
405
+ State tracked in `~/.ai-toolkit/plugins.json`.
406
+
407
+ ## Adding a KB Document
408
+
409
+ Follow the `documentation-standards` knowledge skill (`app/skills/documentation-standards/SKILL.md`) for full spec. Quick checklist:
410
+
411
+ 1. **Choose category directory:** `kb/reference/`, `kb/howto/`, `kb/procedures/`, `kb/troubleshooting/`, or `kb/best-practices/`
412
+ 2. **Create file:** kebab-case name, no dates in filename
413
+ 3. **Add frontmatter** with all 7 required fields: `title`, `category`, `service`, `tags`, `created`, `last_updated`, `description`
414
+ 4. **Write in English**
415
+ 5. **Validate:** `scripts/validate.py` (checks all `kb/**/*.md` frontmatter)
416
+
417
+ **Documents without valid frontmatter will fail `validate.py` and block CI.**
418
+
419
+ ## Adding Scripts to Skills
420
+
421
+ 1. Create `app/skills/<skill-name>/scripts/<script>.py` (stdlib only, JSON output)
422
+ 2. `chmod +x` the script
423
+ 3. Reference: `` python3 ${CLAUDE_SKILL_DIR}/scripts/script.py . ``
424
+
425
+ ## Quality Checks
426
+
427
+ ```bash
428
+ scripts/validate.py # agents, skills, hooks, core files, metadata counts
429
+ scripts/doctor.py # install health, hooks, benchmark freshness, artifact drift diagnostics
430
+ scripts/benchmark_ecosystem.py --offline # ecosystem benchmark snapshot
431
+ scripts/benchmark_ecosystem.py --dashboard-json --out benchmarks/ecosystem-dashboard.json
432
+ scripts/harvest_ecosystem.py --offline # refresh machine-readable ecosystem harvest
433
+ scripts/evaluate_skills.py # skill classification report
434
+ npm test # bats test suite (all workstreams)
435
+ ```
436
+
437
+ Or via CLI:
438
+
439
+ ```bash
440
+ ai-toolkit validate # integrity check
441
+ ai-toolkit doctor # install health diagnostics
442
+ ai-toolkit benchmark-ecosystem --offline # benchmark snapshot
443
+ ```
444
+
445
+ ## Modifying Components
446
+
447
+ Changes propagate instantly to all machines via symlinks. After any change:
448
+
449
+ ```bash
450
+ scripts/validate.py # must pass before commit
451
+ npm test # must pass before commit
452
+ ```
453
+
454
+ If you added/removed agents or skills, also regenerate derived artifacts:
455
+
456
+ ```bash
457
+ npm run generate:all # regenerates AGENTS.md, llms.txt, all platform configs
458
+ ```
459
+
460
+ ## Release Checklist
461
+
462
+ Follow this sequence before every `npm publish` / `git tag`:
463
+
464
+ ### 1. Bump version
465
+
466
+ ```bash
467
+ # Edit package.json version field (semver: X.Y.Z)
468
+ # Add entry to CHANGELOG.md
469
+ ```
470
+
471
+ ### 2. Regenerate all artifacts
472
+
473
+ ```bash
474
+ npm run generate:all
475
+ ```
476
+
477
+ ### 3. Validate and test
478
+
479
+ ```bash
480
+ npm run validate # scripts/validate.py — agents, skills, counts
481
+ npm test # full bats suite including metadata contracts and CLI tests
482
+ ```
483
+
484
+ ### 4. Verify counts are in sync
485
+
486
+ The metadata contract tests (`tests/test_metadata_contracts.bats`) catch drift
487
+ automatically. If they fail, fix the stale numbers before continuing.
488
+
489
+ ### 5. Commit and tag
490
+
491
+ ```bash
492
+ git add -A
493
+ git commit -m "chore: release vX.Y.Z"
494
+ git tag vX.Y.Z
495
+ git push origin main --tags
496
+ ```
497
+
498
+ The publish workflow (`.github/workflows/publish.yml`) picks up the tag, runs full
499
+ validation + tests, regenerates AGENTS.md + llms.txt, and publishes to npm.
500
+
501
+ ## Model Tiers
502
+
503
+ | Agent Type | Model | Examples |
504
+ |-----------|-------|---------|
505
+ | Complex reasoning | opus | orchestrator, backend-specialist, security-auditor |
506
+ | Pattern-following | sonnet | documenter, explorer-agent, data-analyst |
507
+
508
+ ## Uninstall
509
+
510
+ ```bash
511
+ ai-toolkit uninstall # strips toolkit components from ~/.claude/
512
+ ```
513
+
514
+ What `uninstall` does:
515
+ - Removes per-file agent symlinks (user agents preserved)
516
+ - Removes per-directory skill symlinks (user skills preserved)
517
+ - Strips toolkit hook entries from `settings.json` (user hooks + settings preserved)
518
+ - Strips toolkit markers from `constitution.md` and `ARCHITECTURE.md` (user content preserved; empty files removed)
519
+ - `~/.claude/CLAUDE.md` preserved (contains your custom rules + toolkit rule markers)
520
+ - Empty `agents/` and `skills/` directories cleaned up
521
+
522
+ ---
523
+
524
+ ## kb/reference/agents-catalog.md
525
+
526
+ ---
527
+ title: "AI Toolkit - Agents Catalog"
528
+ category: reference
529
+ service: ai-toolkit
530
+ tags: [agents, catalog, roles, ai-development]
531
+ version: "2.0.0"
532
+ created: "2026-03-23"
533
+ last_updated: "2026-03-25"
534
+ description: "Complete catalog of 47 specialized agents with roles, models, and use cases."
535
+ ---
536
+
537
+ # Agents Catalog (47 agents)
538
+
539
+ ## By Category
540
+
541
+ ### Orchestration & Planning (4)
542
+
543
+ | Agent | Model | Use Case |
544
+ |-------|-------|----------|
545
+ | **orchestrator** | opus | Multi-agent coordination, 3+ agents per task |
546
+ | **project-planner** | opus | Task breakdown, dependency graphs, file structure |
547
+ | **product-manager** | opus | Requirements, user stories, acceptance criteria, backlog prioritization |
548
+ | **tech-lead** | opus | Code quality authority, architecture patterns |
549
+
550
+ ### Development (5)
551
+
552
+ | Agent | Model | Use Case |
553
+ |-------|-------|----------|
554
+ | **backend-specialist** | opus | Node.js, Python, PHP, FastAPI, APIs |
555
+ | **frontend-specialist** | opus | React, Next.js, Vue, Nuxt, Tailwind |
556
+ | **mobile-developer** | opus | React Native, Flutter, native iOS/Android |
557
+ | **game-developer** | opus | Unity, Godot, Unreal, Phaser, Three.js |
558
+ | **database-architect** | opus | Schema design, migrations, query optimization, operations |
559
+
560
+ ### AI/ML (7)
561
+
562
+ | Agent | Model | Use Case |
563
+ |-------|-------|----------|
564
+ | **ai-engineer** | opus | LLM integration, vector databases, RAG, agent orchestration |
565
+ | **ml-engineer** | opus | Model training, MLOps, TensorFlow, PyTorch |
566
+ | **nlp-engineer** | opus | NLP pipelines, NER, text classification, transformers |
567
+ | **data-scientist** | opus | Statistics, visualization, EDA, hypothesis testing |
568
+ | **data-analyst** | sonnet | SQL, analytics, reporting, dashboards |
569
+ | **prompt-engineer** | opus | Prompt design, chain-of-thought, few-shot, optimization |
570
+ | **rag-engineer** | opus | RAG pipelines, document indexing, retrieval optimization |
571
+
572
+ ### Quality & Security (6)
573
+
574
+ | Agent | Model | Use Case |
575
+ |-------|-------|----------|
576
+ | **code-reviewer** | opus | Code review, standards, quality audit |
577
+ | **test-engineer** | opus | Test strategy, TDD, unit/integration/E2E tests |
578
+ | **qa-automation-engineer** | opus | Playwright, Cypress, API testing, performance testing |
579
+ | **security-auditor** | opus | OWASP, CVE analysis, pen testing, vulnerability assessment |
580
+ | **security-architect** | opus | Threat modeling, secure design, AuthN/AuthZ |
581
+ | **system-governor** | opus | Constitution guardian, validates changes, VETO power |
582
+
583
+ ### Infrastructure & DevOps (6)
584
+
585
+ | Agent | Model | Use Case |
586
+ |-------|-------|----------|
587
+ | **devops-implementer** | opus | Terraform, Ansible, Docker, Kubernetes, CI/CD |
588
+ | **infrastructure-architect** | opus | System design, architecture notes, trade-off analysis |
589
+ | **infrastructure-validator** | sonnet | Deployment verification, health checks, rollback |
590
+ | **incident-responder** | sonnet | P1-P4 incidents, emergency fixes, postmortem |
591
+ | **performance-optimizer** | opus | Profiling, bottleneck analysis, latency, scaling |
592
+ | **llm-ops-engineer** | opus | LLM caching, fallback, cost optimization, observability |
593
+
594
+ ### Research & Documentation (6)
595
+
596
+ | Agent | Model | Use Case |
597
+ |-------|-------|----------|
598
+ | **explorer-agent** | sonnet | Codebase discovery (READ-ONLY, never writes) |
599
+ | **research-synthesizer** | opus | Research coordination, synthesis, report generation |
600
+ | **technical-researcher** | opus | Deep technical investigation, feasibility studies |
601
+ | **search-specialist** | sonnet | Search optimization, relevance ranking |
602
+ | **fact-checker** | sonnet | Claim verification, source validation |
603
+ | **documenter** | sonnet | Documentation, KB management, SOPs, API docs, tutorials |
604
+
605
+ ### MCP (3)
606
+
607
+ | Agent | Model | Use Case |
608
+ |-------|-------|----------|
609
+ | **mcp-expert** | opus | MCP protocol expertise, client configuration |
610
+ | **mcp-server-architect** | opus | MCP server design, JSON-RPC, tool definitions |
611
+ | **mcp-testing-engineer** | sonnet | MCP protocol compliance, transport testing |
612
+
613
+ ### Management & Evolution (4)
614
+
615
+ | Agent | Model | Use Case |
616
+ |-------|-------|----------|
617
+ | **chief-of-staff** | sonnet | Executive summaries, daily briefings, noise reduction |
618
+ | **meta-architect** | opus | Self-optimization, agent definition updates |
619
+ | **predictive-analyst** | sonnet | Impact prediction, regression forecasting |
620
+ | **business-intelligence** | sonnet | Opportunity discovery, KPI gaps, value creation |
621
+
622
+ ### Autonomous (2)
623
+
624
+ | Agent | Model | Use Case |
625
+ |-------|-------|----------|
626
+ | **night-watchman** | sonnet | Autonomous maintenance: dependency updates, dead code |
627
+ | **chaos-monkey** | opus | Resilience testing: fault injection, failure verification |
628
+
629
+ ### Specialist (4)
630
+
631
+ | Agent | Model | Use Case |
632
+ |-------|-------|----------|
633
+ | **debugger** | opus | Root cause analysis, stack traces, intermittent failures |
634
+ | **code-archaeologist** | sonnet | Legacy code investigation, technical debt |
635
+ | **command-expert** | sonnet | CLI commands, bash scripting, build scripts |
636
+ | **seo-specialist** | sonnet | SEO optimization, meta tags, Core Web Vitals |
637
+
638
+ ## Agent Selection Matrix
639
+
640
+ | Task Type | Primary | Supporting | Validation |
641
+ |-----------|---------|------------|------------|
642
+ | New Feature | backend/frontend-specialist | test-engineer | code-reviewer |
643
+ | Bug Fix | debugger | backend/frontend | test-engineer |
644
+ | Performance | performance-optimizer | database-architect | infrastructure-validator |
645
+ | Security | security-auditor | security-architect | code-reviewer |
646
+ | Architecture | infrastructure-architect | devops-implementer | security-auditor |
647
+ | Documentation | documenter | explorer-agent | tech-lead |
648
+ | AI/ML | ai-engineer | ml-engineer | rag-engineer |
649
+ | Research | research-synthesizer | technical-researcher | fact-checker |
650
+
651
+ ---
652
+
653
+ ## kb/reference/anti-pattern-registry-format.md
654
+
655
+ ---
656
+ title: "Anti-Pattern Registry Format"
657
+ category: reference
658
+ service: ai-toolkit
659
+ description: "Structured JSON format for anti-patterns with severity, auto-fixability, and conflict rules. Used by domain skills with reasoning engines."
660
+ tags: [anti-patterns, skills, reasoning-engine, format]
661
+ created: 2026-04-01
662
+ last_updated: 2026-04-01
663
+ ---
664
+
665
+ # Anti-Pattern Registry Format
666
+
667
+ ## Overview
668
+
669
+ The anti-pattern registry is a structured JSON format used by domain skills that
670
+ employ reasoning engines. It provides a machine-readable catalog of known
671
+ anti-patterns with severity levels, auto-fix capabilities, and conflict rules.
672
+
673
+ ## When to Use
674
+
675
+ Use structured JSON registries (this format) when:
676
+
677
+ - The skill catalogs **more than 50 items** across **more than 3 compatibility
678
+ dimensions** (e.g., domain, severity, language, framework).
679
+ - Items have relationships (conflicts, prerequisites, alternatives) that must be
680
+ queryable at runtime.
681
+ - The reasoning engine (`search.py`) needs to filter, score, and exclude
682
+ conflicting entries programmatically.
683
+
684
+ Use Markdown tables when:
685
+
686
+ - Fewer than 50 items with 3 or fewer dimensions.
687
+ - No inter-item relationships.
688
+ - Human readability is the only consumer.
689
+
690
+ ## JSON Schema
691
+
692
+ Each entry in the registry follows this schema:
693
+
694
+ ```json
695
+ {
696
+ "id": "string (required)",
697
+ "name": "string (required)",
698
+ "domain": "string (required)",
699
+ "description": "string (required)",
700
+ "pattern": "string (optional)",
701
+ "severity": "string (required)",
702
+ "auto_fixable": "boolean (required)",
703
+ "conflicts_with": ["string (optional)"],
704
+ "remediation": "string (required)",
705
+ "tags": ["string (optional)"]
706
+ }
707
+ ```
708
+
709
+ ### Field Definitions
710
+
711
+ #### `id` (required)
712
+
713
+ Unique identifier in kebab-case. Must be globally unique across all registry
714
+ files within the same assets directory.
715
+
716
+ ```
717
+ "id": "n-plus-one-query"
718
+ ```
719
+
720
+ #### `name` (required)
721
+
722
+ Human-readable display name. Used in reports and dashboards.
723
+
724
+ ```
725
+ "name": "N+1 Query Problem"
726
+ ```
727
+
728
+ #### `domain` (required)
729
+
730
+ The skill domain this anti-pattern belongs to. Used for filtering when a
731
+ reasoning engine serves multiple domains.
732
+
733
+ Valid domains include: `security`, `database`, `api`, `architecture`,
734
+ `performance`, `testing`, `general`. Skills may define additional domains as
735
+ needed.
736
+
737
+ ```
738
+ "domain": "database"
739
+ ```
740
+
741
+ #### `description` (required)
742
+
743
+ Clear explanation of what this anti-pattern is and why it is problematic. Should
744
+ be actionable -- a developer reading this should understand the risk.
745
+
746
+ ```
747
+ "description": "Executing one query per item in a loop instead of a single batch query. Causes O(n) database round-trips where O(1) is possible."
748
+ ```
749
+
750
+ #### `pattern` (optional)
751
+
752
+ A regex pattern for automated detection in source code. When present, tooling
753
+ can scan codebases for occurrences. Omit if the anti-pattern is architectural
754
+ or cannot be detected via regex.
755
+
756
+ ```
757
+ "pattern": "for\\s+.*\\sin\\s+.*:\\s*\\n\\s+.*\\.objects\\.get"
758
+ ```
759
+
760
+ #### `severity` (required)
761
+
762
+ Impact level. Must be one of:
763
+
764
+ | Value | Meaning |
765
+ |-------|---------|
766
+ | `critical` | Causes security vulnerabilities, data loss, or production outages. Must fix before merge. |
767
+ | `important` | Degrades performance, maintainability, or reliability significantly. Should fix in current sprint. |
768
+ | `suggestion` | Improvement opportunity. Fix when convenient or during refactoring. |
769
+
770
+ ```
771
+ "severity": "important"
772
+ ```
773
+
774
+ #### `auto_fixable` (required)
775
+
776
+ Boolean indicating whether tooling can automatically remediate this
777
+ anti-pattern. When `true`, the reasoning engine or a companion script can
778
+ generate a fix.
779
+
780
+ ```
781
+ "auto_fixable": true
782
+ ```
783
+
784
+ #### `conflicts_with` (optional)
785
+
786
+ List of anti-pattern IDs that conflict with this entry. The reasoning engine
787
+ uses this for mutual exclusion -- if one pattern is selected/detected, the
788
+ conflicting ones are filtered out of results.
789
+
790
+ This prevents contradictory advice (e.g., "use eager loading" and "use lazy
791
+ loading" simultaneously).
792
+
793
+ ```
794
+ "conflicts_with": ["eager-load-everything"]
795
+ ```
796
+
797
+ #### `remediation` (required)
798
+
799
+ Concrete instructions for fixing the anti-pattern. Should include a code
800
+ example or reference to a known-good pattern when possible.
801
+
802
+ ```
803
+ "remediation": "Replace loop queries with select_related() or prefetch_related() for Django, or use JOIN/eager loading in your ORM."
804
+ ```
805
+
806
+ #### `tags` (optional)
807
+
808
+ Freeform tags for cross-cutting search. Useful for filtering by technology,
809
+ language, or concern that does not map to a single domain.
810
+
811
+ ```
812
+ "tags": ["orm", "django", "sqlalchemy", "performance"]
813
+ ```
814
+
815
+ ## Complete Example
816
+
817
+ ```json
818
+ [
819
+ {
820
+ "id": "n-plus-one-query",
821
+ "name": "N+1 Query Problem",
822
+ "domain": "database",
823
+ "description": "Executing one query per item in a loop instead of a single batch query. Causes O(n) database round-trips where O(1) is possible.",
824
+ "pattern": "for\\s+.*\\sin\\s+.*:\\s*\\n\\s+.*\\.objects\\.get",
825
+ "severity": "important",
826
+ "auto_fixable": false,
827
+ "conflicts_with": [],
828
+ "remediation": "Replace loop queries with select_related() or prefetch_related() for Django, or use JOIN/eager loading in your ORM.",
829
+ "tags": ["orm", "django", "sqlalchemy", "performance"]
830
+ },
831
+ {
832
+ "id": "hardcoded-secrets",
833
+ "name": "Hardcoded Secrets",
834
+ "domain": "security",
835
+ "description": "API keys, passwords, or tokens embedded directly in source code. Exposed in version control history even after removal.",
836
+ "pattern": "(api_key|secret|password|token)\\s*=\\s*[\"'][^\"']+[\"']",
837
+ "severity": "critical",
838
+ "auto_fixable": true,
839
+ "conflicts_with": [],
840
+ "remediation": "Move secrets to environment variables or a secrets manager (AWS SSM, Vault, dotenv for local). Reference via os.environ or settings module.",
841
+ "tags": ["secrets", "env", "vault", "ci"]
842
+ }
843
+ ]
844
+ ```
845
+
846
+ ## File Organization
847
+
848
+ Registry files live in the `assets/` directory alongside the reasoning engine:
849
+
850
+ ```
851
+ templates/reasoning-engine/
852
+ search.py # Reasoning engine
853
+ assets/
854
+ example.json # Template/example entries
855
+ security.json # Security anti-patterns
856
+ database.json # Database anti-patterns
857
+ api.json # API anti-patterns
858
+ ```
859
+
860
+ Each file is a JSON array. The reasoning engine loads and merges all `*.json`
861
+ files from `assets/` at startup. Keep files organized by domain to avoid merge
862
+ conflicts and improve discoverability.
863
+
864
+ ## Integration with Reasoning Engine
865
+
866
+ The `search.py` reasoning engine uses registry entries as follows:
867
+
868
+ 1. **Load**: All JSON files in `assets/` are loaded and merged into a flat list.
869
+ 2. **Match**: User query is tokenized and scored against all fields.
870
+ 3. **Filter**: `conflicts_with` entries are excluded based on already-selected
871
+ items via `filter_anti_patterns()`.
872
+ 4. **Return**: Top results are returned as JSON to stdout.
873
+
874
+ Skills that use this pattern should document the `--domain` flag to scope
875
+ searches to their specific domain.
876
+
877
+ ---
878
+
879
+ ## kb/reference/architecture-overview.md
880
+
881
+ ---
882
+ title: "AI Toolkit - Architecture Overview"
883
+ category: reference
884
+ service: ai-toolkit
885
+ tags: [architecture, overview, design, structure]
886
+ version: "1.0.0"
887
+ created: "2026-03-23"
888
+ last_updated: "2026-04-02"
889
+ description: "Architecture of ai-toolkit: directory layout, global install model, skill tiers, and integration with projects."
890
+ ---
891
+
892
+ # AI Toolkit Architecture
893
+
894
+ ## Purpose
895
+
896
+ Shared, project-agnostic AI development toolkit for Claude Code (and compatible assistants like Cursor, Windsurf, Copilot, Gemini, Cline, Roo Code, and Aider). Provides 47 specialized agents, 85 skills (slash commands + knowledge), expanded lifecycle hooks, and experimental opt-in plugin packs that teams can adopt separately from the default global install.
897
+
898
+ ## Design Principles
899
+
900
+ 1. **Global install** — one `~/.claude/` install works for all projects; no per-project setup beyond `init`
901
+ 2. **Merge-friendly** — per-file symlinks, JSON merge, marker injection; user content never overwritten
902
+ 3. **Composable** — agents reference skills; skills invoke agents; hooks validate all work
903
+ 4. **Multi-language** — hooks and skills support Python, TypeScript, PHP, Dart, Go
904
+ 5. **Cost-optimized** — simpler agents run on `sonnet`, complex reasoning on `opus`
905
+
906
+ ## Directory Structure
907
+
908
+ ```
909
+ ai-toolkit/
910
+ bin/
911
+ ai-toolkit.js # CLI entry point (install, init, add-rule, ...)
912
+ app/ # All toolkit components
913
+ agents/ # 47 agent definitions (.md + YAML frontmatter)
914
+ skills/ # 85 skills: task, hybrid, knowledge
915
+ rules/ # Rules auto-injected into ~/.claude/CLAUDE.md
916
+ hooks/ # Hook scripts (copied to ~/.ai-toolkit/hooks/)
917
+ hooks.json # Hook definitions (merged into ~/.claude/settings.json)
918
+ constitution.md # Immutable safety rules, 5 articles (marker-injected)
919
+ ARCHITECTURE.md # System architecture reference (marker-injected)
920
+ CLAUDE.md.template # Template for project CLAUDE.md (used by init)
921
+ settings.local.json.template
922
+ .claude-plugin/
923
+ plugin.json # Official plugin manifest
924
+ plugins/ # Experimental opt-in plugin packs + optional modules
925
+ scripts/ # All scripts
926
+ install.py # Global installer → ~/.claude/ (--local for project-local setup)
927
+ uninstall.py # Removes toolkit components from ~/.claude/
928
+ inject_rule_cli.py # Injects a rule into CLAUDE.md (delegates to inject_section_cli.py)
929
+ inject_section_cli.py # Marker-based content injection (canonical implementation)
930
+ _common.py # Shared helper for generators (frontmatter, agents/skills emission)
931
+ merge-hooks.py # JSON merge for hooks into settings.json (inject/strip modes)
932
+ validate.py # Toolkit integrity check
933
+ evaluate_skills.py # Skill quality report
934
+ generate_agents_md.py # Regenerates AGENTS.md
935
+ generate_cursor_rules.py # Generates .cursorrules (sources _common.py)
936
+ generate_windsurf.py # Generates .windsurfrules (sources _common.py)
937
+ generate_copilot.py # Generates .github/copilot-instructions.md (sources _common.py)
938
+ generate_gemini.py # Generates GEMINI.md (sources _common.py)
939
+ generate_cline.py # Generates .clinerules (sources _common.py)
940
+ generate_roo_modes.py # Generates .roomodes
941
+ generate_aider_conf.py # Generates .aider.conf.yml
942
+ generate_llms_txt.py # Generates llms.txt
943
+ install_git_hooks.py # Installs fallback pre-commit hook
944
+ plugin.py # Plugin pack management (install, remove, list, status)
945
+ benchmark_ecosystem.py # Generates ecosystem benchmark snapshot
946
+ harvest_ecosystem.py # Writes machine-readable ecosystem harvest JSON
947
+ tests/ # Bats test suite
948
+ benchmarks/ # Benchmark tasks + results
949
+ kb/ # Knowledge base
950
+ reference/ # Catalogs, architecture, usage guides
951
+ procedures/ # SOPs (install, maintenance)
952
+ reference/ # architecture, operating models, and usage guides
953
+ ```
954
+
955
+ ## Install Model
956
+
957
+ All components use merge-friendly strategies — user content is never overwritten.
958
+
959
+ ```
960
+ Machine (global) Project (local)
961
+ ────────────────────────────────────────── ──────────────────────────────────────
962
+ ~/.claude/ ~/.ai-toolkit/
963
+ agents/*.md → per-file symlinks rules/ ← registered rules
964
+ skills/*/ → per-dir symlinks hooks/ ← hook scripts (copied)
965
+ settings.json ← hooks merged here
966
+ constitution.md ← marker injection my-project/
967
+ ARCHITECTURE.md ← marker injection CLAUDE.md ← project rules
968
+ CLAUDE.md ← marker injection (rules) .claude/
969
+ settings.local.json ← MCP, perms
970
+ constitution.md ← marker injection
971
+ ```
972
+
973
+ | Component | Strategy | Collision handling |
974
+ |-----------|----------|-------------------|
975
+ | `agents/*.md` | Per-file symlinks | User file with same name wins (toolkit skipped) |
976
+ | `skills/*/` | Per-directory symlinks | User dir with same name wins (toolkit skipped) |
977
+ | `settings.json` hooks | JSON merge via `merge-hooks.py` | User hooks + settings preserved, toolkit entries tagged with `_source` |
978
+ | `constitution.md` | Marker injection via `inject_section_cli.py` | User content outside `<!-- TOOLKIT:* -->` markers untouched |
979
+ | `ARCHITECTURE.md` | Marker injection via `inject_section_cli.py` | Same as above |
980
+ | `CLAUDE.md` | Marker injection via `inject_rule_cli.py` | Same as above |
981
+
982
+ **`ai-toolkit install`** — run once per machine, merges toolkit into `~/.claude/`. Auto-upgrades old whole-directory symlinks.
983
+
984
+ **`ai-toolkit update`** — re-apply after `npm install -g @softspark/ai-toolkit@latest` or after `add-rule` / `remove-rule`. Same as `install` but semantically correct for update flows.
985
+
986
+ **`ai-toolkit install --local`** (or `update --local`) — run per project, creates `CLAUDE.md` template + `.claude/settings.local.json` (only if missing, initialized with MCP defaults), and injects `constitution.md` + Copilot + Cline + Roo Code + Aider configs into local `.claude/` (preserves existing user content). Installs `--local` git hooks as a fallback for quality gates. Hooks are global-only — not merged into project settings.
987
+
988
+ ## CLI Commands
989
+
990
+ | Command | Target | What it does |
991
+ |---------|--------|-------------|
992
+ | `install` | `~/.claude/` | First-time: per-file symlinks + JSON merge + marker injection + rules |
993
+ | `install --local` | `./` | Also set up project-local: `CLAUDE.md` + `settings.local.json` + constitution + Copilot + Cline + Roo + Aider + Git Hooks (hooks stay global-only) |
994
+ | `update` | `~/.claude/` | Re-apply after npm update or after add-rule/remove-rule |
995
+ | `update --local` | `./` | Re-apply + refresh project-local configs |
996
+ | `uninstall` | `~/.claude/` | Strips toolkit components (preserves user content) |
997
+ | `add-rule <file>` | `~/.ai-toolkit/rules/` | Register rule — auto-applied on every `update` |
998
+ | `remove-rule <name>` | `~/.ai-toolkit/rules/` + `~/.claude/CLAUDE.md` | Unregister rule and remove its block |
999
+ | `validate` | toolkit | Integrity check |
1000
+ | `doctor` | toolkit | Install health, hooks, benchmark freshness, and artifact drift diagnostics |
1001
+ | `benchmark-ecosystem` | toolkit | Benchmark snapshot for official Claude Code and external ecosystem repos |
1002
+ | `evaluate` | toolkit | Skill quality report |
1003
+ | `cursor-rules` | `./` | Generates `.cursorrules` |
1004
+ | `windsurf-rules` | `./` | Generates `.windsurfrules` |
1005
+ | `copilot-instructions` | `./` | Generates `.github/copilot-instructions.md` |
1006
+ | `gemini-md` | `./` | Generates `GEMINI.md` |
1007
+ | `cline-rules` | `./` | Generates `.clinerules` |
1008
+ | `roo-modes` | `./` | Generates `.roomodes` |
1009
+ | `aider-conf` | `./` | Generates `.aider.conf.yml` |
1010
+ | `agents-md` | toolkit | Regenerates `AGENTS.md` |
1011
+ | `llms-txt` | `./` | Generates `llms.txt` |
1012
+ | `generate-all` | `./` | Generates all platform configs at once |
1013
+
1014
+ ## Skill Tiers
1015
+
1016
+ Three tiers determine how to approach a task:
1017
+
1018
+ | Tier | Skills | When to use |
1019
+ |------|--------|-------------|
1020
+ | **1 — Quick single-agent** | `/debug`, `/review`, `/refactor`, `/analyze`, `/docs`, `/plan`, `/explain` | One concern, one file area, fast |
1021
+ | **2 — Multi-agent workflow** | `/workflow <type>` | Cross-cutting task with a known pattern |
1022
+ | **3 — Custom parallelism** | `/orchestrate`, `/swarm` | No predefined workflow matches |
1023
+
1024
+ ### `/workflow` types (15)
1025
+
1026
+ | Type | Use case |
1027
+ |------|----------|
1028
+ | `feature-development` | New feature, full stack |
1029
+ | `backend-feature` | Backend only: API + logic + tests |
1030
+ | `frontend-feature` | UI component + state + tests |
1031
+ | `api-design` | New API endpoint design → implement → document |
1032
+ | `database-evolution` | Schema change + migration + code update |
1033
+ | `test-coverage` | Boost test coverage for a module |
1034
+ | `security-audit` | Multi-vector security assessment |
1035
+ | `codebase-onboarding` | Understand unfamiliar codebase (read-only) |
1036
+ | `spike` | Time-boxed technical research → architecture note |
1037
+ | `debugging` | Bug spanning multiple layers |
1038
+ | `incident-response` | Production down |
1039
+ | `performance-optimization` | Degradation >50% |
1040
+ | `infrastructure-change` | Docker, CI/CD, infra |
1041
+ | `application-deploy` | Deploy |
1042
+ | `proactive-troubleshooting` | Warning / trend |
1043
+
1044
+ ## Skill Classification
1045
+
1046
+ | Type | Field | Invocation | Count |
1047
+ |------|-------|-----------|-------|
1048
+ | Task | `disable-model-invocation: true` | User via `/skill` only | 27 |
1049
+ | Hybrid | (neither) | User via `/skill` + agent knowledge | 27 |
1050
+ | Knowledge | `user-invocable: false` | Claude auto-loads | 31 |
1051
+
1052
+ ## Multi-Agent Execution
1053
+
1054
+ Skills that spawn real parallel agents use:
1055
+ - `agent: <name>` — delegates to a specialized agent persona
1056
+ - `context: fork` — runs in isolated forked context
1057
+ - `Agent` tool — spawns subagents in parallel within the agent's response
1058
+
1059
+ `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` must be set for Agent Teams (tmux-based) support.
1060
+
1061
+ ## Component Relationships
1062
+
1063
+ ```
1064
+ Skills (/review, /deploy, /debug, ...)
1065
+
1066
+
1067
+ Agents (code-reviewer, debugger, devops-implementer, ...)
1068
+
1069
+ ├── load: knowledge skills (clean-code, typescript-patterns, ...)
1070
+
1071
+ ├── validated by: hooks in settings.json (SessionStart, PreToolUse, UserPromptSubmit, PostToolUse, Stop, TaskCompleted, TeammateIdle, SubagentStart, SubagentStop, PreCompact, SessionEnd)
1072
+
1073
+ └── constrained by: constitution.md (5 safety articles)
1074
+ ```
1075
+
1076
+ ## Quality Hooks
1077
+
1078
+ | Hook | Trigger | Script | Action |
1079
+ |------|---------|--------|--------|
1080
+ | SessionStart | Session start + compact | `session-start.sh` | MANDATORY rules reminder + session context + instincts |
1081
+ | Notification | Claude waiting for input | *(inline)* | macOS desktop notification |
1082
+ | PreToolUse | Before Bash | `guard-destructive.sh` | Block destructive commands |
1083
+ | PreToolUse | Before file ops (Bash, Read, Edit, Write, MultiEdit, Glob, Grep, NotebookEdit, mcp\_filesystem) | `guard-path.sh` | Block wrong-user path hallucination |
1084
+ | UserPromptSubmit | Before user prompt execution | `user-prompt-submit.sh` | Prompt governance reminder |
1085
+ | PostToolUse | After edit/write tools | `post-tool-use.sh` | Lightweight validation reminders |
1086
+ | Stop | After response | `quality-check.sh` | Multi-language lint |
1087
+ | Stop | After response | `save-session.sh` | Persist session context |
1088
+ | TaskCompleted | Agent Teams: task done | `quality-gate.sh` | Block completion on errors |
1089
+ | TeammateIdle | Agent Teams: idle | *(inline)* | Completeness reminder |
1090
+ | SubagentStart | Subagent spawn | `subagent-start.sh` | Scope reminder for subagents |
1091
+ | SubagentStop | Subagent completion | `subagent-stop.sh` | Handoff checklist for subagents |
1092
+ | PreCompact | Before compaction | `pre-compact.sh` | Save context before compaction |
1093
+ | SessionEnd | Session end | `session-end.sh` | Persist handoff note for the next session |
1094
+
1095
+ Scripts at `~/.ai-toolkit/hooks/`. See [hooks-catalog.md](hooks-catalog.md) for details.
1096
+
1097
+ ## Constitution (5 Articles)
1098
+
1099
+ | Article | Key Rule |
1100
+ |---------|----------|
1101
+ | I Safety First | No data loss, no blind execution, max 3 loop iterations |
1102
+ | II Hierarchy of Truth | KB is source of truth, research protocol mandatory |
1103
+ | III Operational Integrity | Green tests = Done, logs are evidence |
1104
+ | IV Self-Preservation | Constitution is read-only, kill switch via system-governor |
1105
+ | V Resource Governance | No destructive commands without confirmation |
1106
+
1107
+ ## Agent Model Tiers
1108
+
1109
+ | Model | Purpose | Count |
1110
+ |-------|---------|-------|
1111
+ | opus | Complex reasoning, code generation, security | 32 |
1112
+ | sonnet | Documentation, analysis, pattern-following | 15 |
1113
+
1114
+ ---
1115
+
1116
+ ## kb/reference/benchmark-config.md
1117
+
1118
+ ---
1119
+ title: "AI Toolkit - Config Benchmark"
1120
+ category: reference
1121
+ service: ai-toolkit
1122
+ tags: [benchmark, config, comparison, coverage]
1123
+ version: "1.0.0"
1124
+ created: "2026-03-29"
1125
+ last_updated: "2026-03-29"
1126
+ description: "Compare your installed ai-toolkit config vs toolkit defaults vs ecosystem competition."
1127
+ ---
1128
+
1129
+ # Config Benchmark
1130
+
1131
+ ## Usage
1132
+
1133
+ ```bash
1134
+ ai-toolkit benchmark --my-config
1135
+ ```
1136
+
1137
+ ## What It Shows
1138
+
1139
+ 1. **Your Configuration** — counts of installed agents, skills, hooks in `~/.claude/`
1140
+ 2. **Toolkit Totals** — counts of available assets in the toolkit package
1141
+ 3. **Coverage** — percentage of toolkit assets you have installed
1142
+ 4. **Missing Components** — up to 10 agents and skills not yet installed
1143
+ 5. **Ecosystem Comparison** — your config vs public Claude Code ecosystem repos
1144
+
1145
+ ## Output Example
1146
+
1147
+ ```
1148
+ AI Toolkit Config Benchmark
1149
+ ========================
1150
+
1151
+ ## Your Configuration (~/.claude/)
1152
+ Agents: 47
1153
+ Skills: 80
1154
+ Hooks: 12
1155
+
1156
+ ## Toolkit Totals
1157
+ Agents: 47
1158
+ Skills: 80
1159
+ Hooks: 12
1160
+
1161
+ ## Coverage
1162
+ Agents: 100% (47 / 47)
1163
+ Skills: 100% (80 / 80)
1164
+ Hooks: 100% (12 / 12)
1165
+
1166
+ ## Ecosystem Comparison
1167
+ Repo Agents Skills Hooks
1168
+ --------------------------------------------------------------
1169
+ Your config 47 80 12
1170
+ --------------------------------------------------------------
1171
+ anthropics/claude-code 15 10 5
1172
+ affaan-m/everything-claude-code 152 397 2
1173
+ ```
1174
+
1175
+ ## Data Sources
1176
+
1177
+ - User config: `~/.claude/agents/`, `~/.claude/skills/`, `~/.ai-toolkit/hooks/`
1178
+ - Toolkit: `app/agents/`, `app/skills/`, `app/hooks/`
1179
+ - Ecosystem: `benchmarks/ecosystem-dashboard.json`
1180
+
1181
+ ---
1182
+
1183
+ ## kb/reference/ci-integration.md
1184
+
1185
+ ---
1186
+ title: "AI Toolkit - CI Integration"
1187
+ category: reference
1188
+ service: ai-toolkit
1189
+ tags: [ci, github-actions, automation, validation]
1190
+ version: "1.0.0"
1191
+ created: "2026-03-29"
1192
+ last_updated: "2026-03-29"
1193
+ description: "Reusable GitHub Action for ai-toolkit validation in CI pipelines."
1194
+ ---
1195
+
1196
+ # CI Integration
1197
+
1198
+ ## GitHub Action
1199
+
1200
+ Validate your toolkit setup in CI using the reusable composite action.
1201
+
1202
+ ### Basic Usage
1203
+
1204
+ ```yaml
1205
+ # .github/workflows/validate-toolkit.yml
1206
+ name: Validate AI Toolkit
1207
+ on: [push, pull_request]
1208
+ jobs:
1209
+ validate:
1210
+ runs-on: ubuntu-latest
1211
+ steps:
1212
+ - uses: actions/checkout@v4
1213
+ - uses: softspark/ai-toolkit@v1
1214
+ with:
1215
+ command: validate
1216
+ ```
1217
+
1218
+ ### Inputs
1219
+
1220
+ | Input | Default | Description |
1221
+ |-------|---------|-------------|
1222
+ | `toolkit-version` | `latest` | npm version of @softspark/ai-toolkit |
1223
+ | `node-version` | `20` | Node.js version |
1224
+ | `command` | `validate` | Command to run (`validate` or `doctor`) |
1225
+
1226
+ ### Outputs
1227
+
1228
+ | Output | Description |
1229
+ |--------|-------------|
1230
+ | `status` | `pass` or `fail` |
1231
+
1232
+ ## Alternative: npx
1233
+
1234
+ For simpler setups without the action:
1235
+
1236
+ ```yaml
1237
+ - uses: actions/setup-node@v4
1238
+ with:
1239
+ node-version: 20
1240
+ - run: npx @softspark/ai-toolkit validate
1241
+ ```
1242
+
1243
+ ## What Gets Validated
1244
+
1245
+ - Agent frontmatter (name, description, tools, model)
1246
+ - Skill frontmatter (name, description, format, references)
1247
+ - Hook event names against whitelist
1248
+ - Plugin pack manifests (JSON validity, asset references)
1249
+ - Metadata contracts (README badges vs actual counts)
1250
+ - Core file presence (LICENSE, CHANGELOG, SECURITY)
1251
+
1252
+ ---
1253
+
1254
+ ## kb/reference/claude-ecosystem-benchmark-snapshot.md
1255
+
1256
+ ---
1257
+ title: "Claude Ecosystem Benchmark Snapshot"
1258
+ category: reference
1259
+ service: ai-toolkit
1260
+ tags: [benchmark, ecosystem, claude-code, competitive-analysis, roadmap]
1261
+ version: "1.0.0"
1262
+ created: "2026-03-28"
1263
+ last_updated: "2026-04-01"
1264
+ description: "Repeatable benchmark snapshot of official Claude Code and selected external repositories used to guide ai-toolkit expansion decisions."
1265
+ ---
1266
+
1267
+ # Claude Ecosystem Benchmark Snapshot
1268
+
1269
+ ## Purpose
1270
+
1271
+ This document records the external repositories that `ai-toolkit` uses as benchmark inputs for ecosystem expansion work. It complements the planning documents by turning the benchmark set into a stable, repeatable reference.
1272
+
1273
+ ## Source Set
1274
+
1275
+ - `anthropics/claude-code`
1276
+ - `affaan-m/everything-claude-code`
1277
+ - `ChrisWiles/claude-code-showcase`
1278
+ - `disler/claude-code-hooks-mastery`
1279
+ - `codeaholicguy/ai-devkit`
1280
+ - `alirezarezvani/claude-code-skill-factory`
1281
+
1282
+ ## Snapshot (2026-03-28)
1283
+
1284
+ | Repository | Category | Why it matters |
1285
+ |------------|----------|----------------|
1286
+ | `anthropics/claude-code` | official | Canonical plugin layout, command development, hook development, feature workflows |
1287
+ | `affaan-m/everything-claude-code` | ecosystem-scale | Scale benchmark for commands, agents, and packaging patterns |
1288
+ | `ChrisWiles/claude-code-showcase` | practical-showcase | Strong examples of edit-time automation and branch safety hooks |
1289
+ | `disler/claude-code-hooks-mastery` | hooks-reference | Strong reference for lifecycle breadth and operational hook patterns |
1290
+ | `codeaholicguy/ai-devkit` | cross-tool | Cross-tool toolkit positioning benchmark |
1291
+ | `alirezarezvani/claude-code-skill-factory` | meta-tooling | Creator workflow and factory-style inspiration |
1292
+
1293
+ ## Operational Use
1294
+
1295
+ Use the benchmark script for a repeatable snapshot:
1296
+
1297
+ ```bash
1298
+ python3 scripts/benchmark_ecosystem.py --offline
1299
+ python3 scripts/benchmark_ecosystem.py --format json
1300
+ python3 scripts/benchmark_ecosystem.py --dashboard-json
1301
+ python3 scripts/harvest_ecosystem.py --offline
1302
+ python3 scripts/benchmark_ecosystem.py --out /tmp/claude-ecosystem-benchmark.md
1303
+ ```
1304
+
1305
+ The script prefers live GitHub metadata when available and falls back to the embedded snapshot when offline.
1306
+
1307
+ Machine-readable artifacts:
1308
+
1309
+ - `benchmarks/ecosystem-dashboard.json` — curated dashboard summary with freshness and comparison matrix
1310
+ - `benchmarks/ecosystem-harvest.json` — latest harvested benchmark JSON for roadmap / changelog reuse
1311
+
1312
+ ## Adoption Matrix
1313
+
1314
+ | Pattern | Current ai-toolkit State | Benchmark Signal | Priority |
1315
+ |---------|--------------------------|------------------|----------|
1316
+ | Plugin manifest | Present | Strong in official Claude Code | High |
1317
+ | Hook creator workflow | Present | Reinforced by official plugin-dev assets | High |
1318
+ | Command creator workflow | Present | Reinforced by command-development patterns | High |
1319
+ | Agent creator workflow | Present | Reinforced by agent-development patterns | High |
1320
+ | Lifecycle breadth (`PreCompact`) | Present | Validated by hooks-focused repos | High |
1321
+ | Lifecycle breadth (`PostToolUse`) | Present | Strong benchmark signal | High |
1322
+ | Lifecycle breadth (`UserPromptSubmit`) | Present | Prompt-governance benchmark signal | High |
1323
+ | Lifecycle breadth (`SubagentStart` / `SubagentStop`) | Present | Strong subagent instrumentation signal | Medium |
1324
+ | Lifecycle breadth (`SessionEnd`) | Present | Needed for handoff / cleanup patterns | Medium |
1325
+ | Ecosystem benchmark script | Present | Needed for repeatable comparison | High |
1326
+ | Harvesting script + dashboard JSON | Present | Repeatable evidence for roadmap and release notes | High |
1327
+ | Domain plugin packs | Present (experimental) | Validates modular packaging direction | Medium |
1328
+ | Policy packs | Not yet implemented | Strong but still optional | Later |
1329
+
1330
+ ## Notes
1331
+
1332
+ - This snapshot is intentionally small and curated.
1333
+ - The goal is decision quality, not ecosystem collection for its own sake.
1334
+ - Large benchmark repositories are references, not implementation blueprints.
1335
+
1336
+
1337
+ ---
1338
+
1339
+ ## kb/reference/claude-ecosystem-expansion-foundations.md
1340
+
1341
+ ---
1342
+ title: "Claude Ecosystem Expansion Foundations"
1343
+ category: reference
1344
+ service: ai-toolkit
1345
+ tags: [benchmark, claude-code, ecosystem, hooks, plugins, architecture]
1346
+ version: "1.0.0"
1347
+ created: "2026-03-27"
1348
+ last_updated: "2026-04-01"
1349
+ description: "Reference summary of the ecosystem signals and implementation foundations adopted in ai-toolkit."
1350
+ ---
1351
+
1352
+ # Claude Ecosystem Expansion Foundations
1353
+
1354
+ ## Purpose
1355
+
1356
+ This document captures the architectural foundations adopted in `ai-toolkit` after reviewing:
1357
+
1358
+ 1. the current toolkit repository,
1359
+ 2. official Claude Code patterns,
1360
+ 3. selected external benchmark repositories.
1361
+
1362
+ The outcome is a toolkit that is now positioned as a more modular, Claude-native, benchmark-backed system with stronger lifecycle automation and extension tooling.
1363
+
1364
+ ## Implemented Foundations
1365
+
1366
+ ### 1. Plugin-oriented structure
1367
+
1368
+ `ai-toolkit` now treats plugin packaging as a first-class capability.
1369
+
1370
+ Implemented artifacts:
1371
+ - `app/.claude-plugin/plugin.json`
1372
+ - `app/plugins/`
1373
+ - `app/skills/plugin-creator/SKILL.md`
1374
+ - `kb/reference/plugin-pack-conventions.md`
1375
+
1376
+ ### 2. Broader lifecycle coverage
1377
+
1378
+ The toolkit now covers prompt, edit, subagent, compaction, and session-end phases.
1379
+
1380
+ Implemented events:
1381
+ - `SessionStart`
1382
+ - `Notification`
1383
+ - `PreToolUse`
1384
+ - `UserPromptSubmit`
1385
+ - `PostToolUse`
1386
+ - `Stop`
1387
+ - `TaskCompleted`
1388
+ - `TeammateIdle`
1389
+ - `SubagentStart`
1390
+ - `SubagentStop`
1391
+ - `PreCompact`
1392
+ - `SessionEnd`
1393
+
1394
+ ### 3. Creator workflows
1395
+
1396
+ The toolkit now includes first-class creator workflows for extension work:
1397
+ - `hook-creator`
1398
+ - `command-creator`
1399
+ - `agent-creator`
1400
+ - `plugin-creator`
1401
+
1402
+ ### 4. Benchmark-backed maintenance
1403
+
1404
+ External ecosystem research is operationalized through repeatable scripts and machine-readable artifacts.
1405
+
1406
+ Implemented artifacts:
1407
+ - `scripts/benchmark_ecosystem.py`
1408
+ - `scripts/harvest_ecosystem.py`
1409
+ - `benchmarks/ecosystem-dashboard.json`
1410
+ - `benchmarks/ecosystem-harvest.json`
1411
+ - `kb/reference/claude-ecosystem-benchmark-snapshot.md`
1412
+
1413
+ ## Benchmark Inputs
1414
+
1415
+ The reference benchmark set is intentionally curated:
1416
+ - `anthropics/claude-code`
1417
+ - `affaan-m/everything-claude-code`
1418
+ - `ChrisWiles/claude-code-showcase`
1419
+ - `disler/claude-code-hooks-mastery`
1420
+ - `codeaholicguy/ai-devkit`
1421
+ - `alirezarezvani/claude-code-skill-factory`
1422
+
1423
+ ## Adopted Outcomes
1424
+
1425
+ | Area | Adopted in ai-toolkit |
1426
+ |------|------------------------|
1427
+ | Plugin manifests | Yes |
1428
+ | Domain plugin packs | Yes (experimental) |
1429
+ | Hook creator workflow | Yes |
1430
+ | Command creator workflow | Yes |
1431
+ | Agent creator workflow | Yes |
1432
+ | Plugin creator workflow | Yes |
1433
+ | Post-edit feedback hooks | Yes |
1434
+ | Prompt governance hook | Yes |
1435
+ | Subagent lifecycle hooks | Yes |
1436
+ | Session-end handoff | Yes |
1437
+ | Benchmark dashboard JSON | Yes |
1438
+ | Harvesting workflow | Yes |
1439
+
1440
+ ## Current Position
1441
+
1442
+ `ai-toolkit` is now documented and implemented as a complete, production-ready toolkit baseline rather than a staged roadmap. Future changes should be treated as normal product evolution, not backlog catch-up.
1443
+
1444
+ ---
1445
+
1446
+ ## kb/reference/commands-catalog.md
1447
+
1448
+ ---
1449
+ title: "AI Toolkit - Commands Catalog (DEPRECATED)"
1450
+ category: reference
1451
+ service: ai-toolkit
1452
+ tags: [commands, deprecated]
1453
+ version: "1.0.0"
1454
+ created: "2026-03-23"
1455
+ last_updated: "2026-03-28"
1456
+ description: "DEPRECATED: All slash commands are implemented as skills. See skills-catalog.md for the current catalog."
1457
+ ---
1458
+
1459
+ # Commands Catalog (DEPRECATED)
1460
+
1461
+ All slash commands have been migrated to skills.
1462
+
1463
+ See **[Skills Catalog](skills-catalog.md)** for the complete list of 85 skills, including:
1464
+ - **27 Task Skills** — formerly standalone commands and creator workflows (e.g., `/commit`, `/test`, `/deploy`, `/hook-creator`, `/plugin-creator`)
1465
+ - **27 Hybrid Skills** — slash commands that also provide agent knowledge (e.g., `/review`, `/debug`, `/plan`, `/tdd`, `/write-a-prd`)
1466
+ - **31 Knowledge Skills** — domain patterns auto-loaded by agents
1467
+
1468
+ Slash command syntax (`/command`) continues to work. The underlying implementation moved from `app/commands/` to `app/skills/`.
1469
+
1470
+ ---
1471
+
1472
+ ## kb/reference/distribution-model.md
1473
+
1474
+ ---
1475
+ title: "Distribution Model"
1476
+ category: reference
1477
+ service: ai-toolkit
1478
+ tags: [architecture, distribution, symlinks, npm, install]
1479
+ version: "1.0.0"
1480
+ created: "2026-03-23"
1481
+ last_updated: "2026-03-28"
1482
+ description: "Reference description of how ai-toolkit is delivered and propagated on a developer machine."
1483
+ ---
1484
+
1485
+ # Distribution Model
1486
+
1487
+ ## Summary
1488
+
1489
+ `ai-toolkit` uses a split delivery model:
1490
+
1491
+ - **npm package** for delivery to the machine,
1492
+ - **filesystem symlinks and merged files** for propagation into Claude Code directories.
1493
+
1494
+ ```text
1495
+ npm install -g @softspark/ai-toolkit → delivers toolkit files
1496
+ ai-toolkit install → links / merges into ~/.claude/
1497
+ ```
1498
+
1499
+ ## Why this model exists
1500
+
1501
+ The toolkit must be reusable across many projects while remaining easy to update from one place.
1502
+
1503
+ This model gives:
1504
+ - standard installation and versioning,
1505
+ - instant propagation for symlinked assets,
1506
+ - predictable update flow for merged / copied assets,
1507
+ - one source of truth per machine.
1508
+
1509
+ ## Adopted Strategies
1510
+
1511
+ | Layer | Mechanism | Result |
1512
+ |------|-----------|--------|
1513
+ | Delivery | npm package | standard install / update UX |
1514
+ | Agents | per-file symlinks | zero-overhead propagation |
1515
+ | Skills | per-directory symlinks | zero-overhead propagation |
1516
+ | Hooks | copied scripts + merged JSON | safe runtime integration |
1517
+ | Docs / rules | marker injection | user content preserved |
1518
+
1519
+ ## Trade-offs
1520
+
1521
+ ### Positive
1522
+ - easy installation
1523
+ - clear update path
1524
+ - global reuse across projects
1525
+ - low propagation overhead
1526
+
1527
+ ### Negative
1528
+ - symlink targets depend on a valid global install location
1529
+ - merged / copied assets require `ai-toolkit update` after source changes
1530
+ - all projects on a machine share the same installed toolkit version
1531
+
1532
+ ## Related Documents
1533
+
1534
+ - `kb/reference/global-install-model.md`
1535
+ - `kb/reference/merge-friendly-install-model.md`
1536
+ - `kb/reference/architecture-overview.md`
1537
+
1538
+ ---
1539
+
1540
+ ## kb/reference/global-install-model.md
1541
+
1542
+ ---
1543
+ title: "Global Install Model"
1544
+ category: reference
1545
+ service: ai-toolkit
1546
+ tags: [install, global, claude, local-setup]
1547
+ version: "1.0.0"
1548
+ created: "2026-03-26"
1549
+ last_updated: "2026-03-28"
1550
+ description: "Reference description of the global install target, local project setup, and command responsibilities in ai-toolkit."
1551
+ ---
1552
+
1553
+ # Global Install Model
1554
+
1555
+ ## Summary
1556
+
1557
+ `ai-toolkit` installs globally into `~/.claude/` by default.
1558
+
1559
+ That means one machine-level install provides agents, skills, hooks, and rules to every project without committing toolkit boilerplate into each repository.
1560
+
1561
+ ## Command Responsibilities
1562
+
1563
+ | Command | Target | Purpose |
1564
+ |---------|--------|---------|
1565
+ | `ai-toolkit install` | `~/.claude/` | first-time machine setup |
1566
+ | `ai-toolkit update` | `~/.claude/` | re-apply after package or rule changes |
1567
+ | `ai-toolkit install --local` | current project | create local `CLAUDE.md`, `.claude/settings.local.json`, and inject constitution + Copilot + Cline + Roo Code + Aider configs. Installs git hooks fallback. |
1568
+ | `ai-toolkit update --local` | current project | refresh those local project files |
1569
+ | `ai-toolkit add-rule` | `~/.ai-toolkit/rules/` | register a global rule |
1570
+ | `ai-toolkit remove-rule` | `~/.ai-toolkit/rules/` | unregister a global rule |
1571
+
1572
+ ## Why global install is the default
1573
+
1574
+ - less setup friction,
1575
+ - no repeated per-project install step,
1576
+ - easier machine-level upgrades,
1577
+ - correct alignment with Claude Code user-level paths.
1578
+
1579
+ ## What remains project-local
1580
+
1581
+ These files still stay local to a repository:
1582
+ - `CLAUDE.md`
1583
+ - `.claude/settings.local.json`
1584
+ - `.claude/constitution.md`
1585
+ - `.github/copilot-instructions.md`
1586
+ - `.clinerules`
1587
+ - `.roomodes`
1588
+ - `.aider.conf.yml`
1589
+ - `.git/hooks/pre-commit` (fallback)
1590
+ - project-specific documentation or safety overlays
1591
+
1592
+ Hooks do **not** live in project-local settings. They are merged only into global `~/.claude/settings.json`.
1593
+
1594
+ ## Related Documents
1595
+
1596
+ - `kb/reference/distribution-model.md`
1597
+ - `kb/reference/merge-friendly-install-model.md`
1598
+
1599
+ ---
1600
+
1601
+ ## kb/reference/hierarchical-override-pattern.md
1602
+
1603
+ ---
1604
+ title: "Hierarchical Override Pattern"
1605
+ category: reference
1606
+ service: ai-toolkit
1607
+ description: "Convention for SKILL.md + reference/*.md relationship with explicit override semantics."
1608
+ tags: [skills, architecture, patterns, override]
1609
+ created: 2026-04-01
1610
+ last_updated: 2026-04-01
1611
+ ---
1612
+
1613
+ # Hierarchical Override Pattern
1614
+
1615
+ ## Overview
1616
+
1617
+ Skills in ai-toolkit follow a two-level content hierarchy: a master `SKILL.md`
1618
+ file that defines global defaults and the main instruction flow, and optional
1619
+ `reference/*.md` files that extend and specialize without contradicting the
1620
+ master.
1621
+
1622
+ This document defines the conventions, override semantics, and splitting
1623
+ criteria for this pattern.
1624
+
1625
+ ## Architecture
1626
+
1627
+ ```
1628
+ app/skills/<skill-name>/
1629
+ SKILL.md # Master: global defaults, main flow
1630
+ reference/
1631
+ domain-a.md # Extension: adds detail for domain A
1632
+ domain-b.md # Extension: adds detail for domain B
1633
+ visual-companion.md # Extension: visual/UI-specific guidance
1634
+ ```
1635
+
1636
+ ## Roles
1637
+
1638
+ ### SKILL.md (Master)
1639
+
1640
+ The `SKILL.md` file is the single source of truth for a skill. It defines:
1641
+
1642
+ - **Purpose and scope** of the skill.
1643
+ - **Global defaults** that apply unless overridden by context.
1644
+ - **Main instruction flow** -- the step-by-step process the agent follows.
1645
+ - **Cross-references** to reference files (explicit `see reference/X.md` links).
1646
+ - **Invocation metadata** (frontmatter: `disable-model-invocation`, etc.).
1647
+
1648
+ The master file is always loaded. It is the entry point for the agent.
1649
+
1650
+ ### reference/*.md (Extensions)
1651
+
1652
+ Reference files extend the master by providing:
1653
+
1654
+ - **Domain-specific detail** that would bloat the master.
1655
+ - **Lookup tables** (e.g., language-specific patterns, framework configs).
1656
+ - **Specialized workflows** that apply in narrow contexts.
1657
+ - **Examples and templates** too long for inline inclusion.
1658
+
1659
+ Reference files are loaded on demand -- only when the agent determines the
1660
+ context requires them, or when the master explicitly references them.
1661
+
1662
+ ## Override Semantics
1663
+
1664
+ The relationship between master and reference files follows strict rules:
1665
+
1666
+ ### Rule 1: Reference files ADD, never REPLACE
1667
+
1668
+ A reference file must not contradict the master. It adds specificity within the
1669
+ boundaries the master defines.
1670
+
1671
+ ```
1672
+ SKILL.md says: "Use type hints on all public APIs"
1673
+ reference/go.md: "Use Go's built-in type system; exported functions are public APIs"
1674
+ ```
1675
+
1676
+ This is valid -- it specializes the general rule for Go without contradicting it.
1677
+
1678
+ ```
1679
+ SKILL.md says: "Always validate input at the API boundary"
1680
+ reference/perf.md: "Skip validation for internal microservice calls"
1681
+ ```
1682
+
1683
+ This is INVALID -- it contradicts the master. If an exception is needed, it must
1684
+ be documented in the master itself with explicit conditions.
1685
+
1686
+ ### Rule 2: Master defines the contract, references fill in the details
1687
+
1688
+ Think of it as interface vs. implementation:
1689
+
1690
+ | Layer | Defines | Example |
1691
+ |-------|---------|---------|
1692
+ | Master | "Validate all inputs" | General principle |
1693
+ | Reference | "In Python, use Pydantic v2 BaseModel with Field validators" | Concrete implementation |
1694
+
1695
+ ### Rule 3: Conflicts are resolved by the master
1696
+
1697
+ If a reference file and the master appear to conflict, the master wins. This
1698
+ should be treated as a bug in the reference file and corrected.
1699
+
1700
+ ### Rule 4: References may cross-reference each other
1701
+
1702
+ Reference files can link to other reference files, but the dependency graph
1703
+ should remain shallow (max 2 levels deep). Deep chains make maintenance
1704
+ difficult.
1705
+
1706
+ ## When to Split
1707
+
1708
+ Split content from `SKILL.md` into `reference/*.md` when:
1709
+
1710
+ | Criterion | Threshold |
1711
+ |-----------|-----------|
1712
+ | **Total line count** | Master exceeds 300 lines |
1713
+ | **Distinct sub-domains** | Content covers 3+ distinct domains (languages, frameworks, concerns) |
1714
+ | **Lookup tables** | Tables with 20+ rows that serve as reference material |
1715
+ | **Reuse potential** | Content could be useful to multiple skills |
1716
+ | **Update frequency** | A section changes much more frequently than the rest |
1717
+
1718
+ Do NOT split when:
1719
+
1720
+ - The master is under 300 lines and covers a single domain.
1721
+ - The "reference" content is only a few paragraphs.
1722
+ - Splitting would force the agent to always load multiple files for basic
1723
+ operation.
1724
+
1725
+ ## Examples from Existing Skills
1726
+
1727
+ ### write-a-prd
1728
+
1729
+ ```
1730
+ app/skills/write-a-prd/
1731
+ SKILL.md # Main PRD creation flow
1732
+ reference/visual-companion.md # Visual/UI-specific PRD guidance
1733
+ ```
1734
+
1735
+ - `SKILL.md` defines the interview-driven PRD process, output format, and
1736
+ quality criteria.
1737
+ - `reference/visual-companion.md` extends with guidance for PRDs that involve
1738
+ visual interfaces -- design system references, wireframe conventions,
1739
+ accessibility requirements.
1740
+ - The master references it: `"For visual products, see reference/visual-companion.md"`
1741
+
1742
+ ### clean-code
1743
+
1744
+ ```
1745
+ app/skills/clean-code/
1746
+ SKILL.md # Universal clean code principles
1747
+ reference/python.md # Python-specific patterns
1748
+ reference/typescript.md # TypeScript-specific patterns
1749
+ reference/php.md # PHP-specific patterns
1750
+ reference/go.md # Go-specific patterns
1751
+ reference/dart.md # Dart/Flutter-specific patterns
1752
+ ```
1753
+
1754
+ - `SKILL.md` defines language-agnostic principles (naming, SRP, DRY).
1755
+ - Each `reference/<lang>.md` provides language-specific idioms, linting config,
1756
+ and type system patterns.
1757
+ - The master links to them: `"For Python patterns, see reference/python.md"`
1758
+
1759
+ ### testing-patterns
1760
+
1761
+ ```
1762
+ app/skills/testing-patterns/
1763
+ SKILL.md # Universal testing principles (AAA, org, targets)
1764
+ reference/python-pytest.md # pytest specifics
1765
+ reference/typescript-vitest.md # Vitest/Jest specifics
1766
+ reference/php-phpunit.md # PHPUnit specifics
1767
+ reference/go-testing.md # Go testing specifics
1768
+ reference/flutter-testing.md # Flutter/Dart testing specifics
1769
+ ```
1770
+
1771
+ Same pattern: master defines the universal structure, references specialize per
1772
+ ecosystem.
1773
+
1774
+ ## Authoring Guidelines
1775
+
1776
+ 1. **Master first.** Always write the `SKILL.md` completely before splitting.
1777
+ Premature splitting leads to fragmented, hard-to-follow skills.
1778
+
1779
+ 2. **Explicit cross-references.** Every reference file must be linked from the
1780
+ master with a clear sentence explaining when to consult it.
1781
+
1782
+ 3. **Self-contained references.** A reference file should be useful on its own
1783
+ for someone who has already read the master. Do not assume the reader will
1784
+ re-read the master alongside it.
1785
+
1786
+ 4. **Consistent frontmatter.** Reference files do not need frontmatter unless
1787
+ they are independently searchable. If they are, use the same YAML format as
1788
+ the master.
1789
+
1790
+ 5. **Naming convention.** Use kebab-case filenames that describe the domain:
1791
+ `python.md`, `visual-companion.md`, `database-patterns.md`. Avoid generic
1792
+ names like `extra.md` or `notes.md`.
1793
+
1794
+ ## Anti-Patterns
1795
+
1796
+ | Anti-Pattern | Problem | Fix |
1797
+ |--------------|---------|-----|
1798
+ | Reference contradicts master | Agent gets conflicting instructions | Move exception to master with conditions |
1799
+ | Master too thin | Agent lacks context without loading all references | Keep core flow in master, only split detail |
1800
+ | Circular references | Infinite loading, confused agent | Keep dependency graph acyclic and shallow |
1801
+ | Unnamed splits | `misc.md`, `extra.md` -- no signal about content | Use descriptive domain-based names |
1802
+ | Over-splitting | 10+ reference files for a simple skill | Consolidate until the 300-line / 3-domain threshold justifies splitting |
1803
+
1804
+ ---
1805
+
1806
+ ## kb/reference/hooks-catalog.md
1807
+
1808
+ ---
1809
+ title: "Hooks Catalog"
1810
+ category: reference
1811
+ service: ai-toolkit
1812
+ tags: [hooks, quality, safety, enforcement, settings.json]
1813
+ version: "1.0.0"
1814
+ created: "2026-03-27"
1815
+ last_updated: "2026-04-02"
1816
+ description: "Complete reference of all ai-toolkit hooks: events, scripts, installation, and runtime behavior."
1817
+ ---
1818
+
1819
+ # Hooks Catalog
1820
+
1821
+ ## Overview
1822
+
1823
+ ai-toolkit provides 15 global hook entries across 12 lifecycle events that enforce quality, safety, and workflow rules across all Claude Code sessions. Hooks are merged into `~/.claude/settings.json` on install, with logic in standalone scripts at `~/.ai-toolkit/hooks/`.
1824
+
1825
+ ## Installation
1826
+
1827
+ ```bash
1828
+ ai-toolkit install # copies scripts to ~/.ai-toolkit/hooks/, merges into settings.json
1829
+ ai-toolkit update # re-copies scripts, re-merges (idempotent)
1830
+ ```
1831
+
1832
+ **File locations:**
1833
+ - Scripts: `~/.ai-toolkit/hooks/*.sh`
1834
+ - Config: `~/.claude/settings.json` → `hooks` key
1835
+ - Source: `ai-toolkit/app/hooks/*.sh` + `app/hooks.json`
1836
+
1837
+ ## Hook Events
1838
+
1839
+ ### SessionStart — `session-start.sh`
1840
+
1841
+ | Field | Value |
1842
+ |-------|-------|
1843
+ | Event | `SessionStart` |
1844
+ | Matcher | `startup\|compact` |
1845
+ | Script | `~/.ai-toolkit/hooks/session-start.sh` |
1846
+ | Fires | Session start + after context compaction |
1847
+
1848
+ **Actions:**
1849
+ 1. Injects MANDATORY reminder to follow CLAUDE.md rules
1850
+ 2. Injects REMINDER about tests and documentation
1851
+ 3. Loads session context from `.claude/session-context.md` (if exists)
1852
+ 4. Loads active instincts from `.claude/instincts/*.md` (if any)
1853
+
1854
+ ### Notification — inline
1855
+
1856
+ | Field | Value |
1857
+ |-------|-------|
1858
+ | Event | `Notification` |
1859
+ | Matcher | *(all)* |
1860
+ | Fires | Claude Code waiting for user input |
1861
+
1862
+ **Action:** macOS desktop notification via `osascript`.
1863
+
1864
+ ### PreToolUse (Bash) — `guard-destructive.sh`
1865
+
1866
+ | Field | Value |
1867
+ |-------|-------|
1868
+ | Event | `PreToolUse` |
1869
+ | Matcher | `Bash` |
1870
+ | Script | `~/.ai-toolkit/hooks/guard-destructive.sh` |
1871
+ | Fires | Before any Bash command |
1872
+
1873
+ **Action:** Blocks (exit 2) commands matching destructive patterns:
1874
+ - `rm -rf`, `sudo rm`
1875
+ - `DROP TABLE`, `DROP DATABASE`, `TRUNCATE`
1876
+ - `format /`, `dd if=`
1877
+ - `git push --force`
1878
+ - `chmod -R 777`
1879
+
1880
+ ### PreToolUse (file ops) — `guard-path.sh`
1881
+
1882
+ | Field | Value |
1883
+ |-------|-------|
1884
+ | Event | `PreToolUse` |
1885
+ | Matcher | `Bash\|Read\|Edit\|Write\|MultiEdit\|Glob\|Grep\|NotebookEdit\|mcp__filesystem__.*` |
1886
+ | Script | `~/.ai-toolkit/hooks/guard-path.sh` |
1887
+ | Fires | Before any file access tool (including Bash, MCP filesystem) |
1888
+
1889
+ **Action:** Blocks (exit 2) when a path contains `/Users/<wrong>` or `/home/<wrong>` that doesn't match the actual `$HOME`. Prevents Claude from hallucinating or confusing similar usernames (common with non-ASCII names like Polish names).
1890
+
1891
+ **Feedback to Claude:** Tells it to use `~`, `$HOME`, or run `echo $HOME` instead of guessing.
1892
+
1893
+ ### UserPromptSubmit — `user-prompt-submit.sh`
1894
+
1895
+ | Field | Value |
1896
+ |-------|-------|
1897
+ | Event | `UserPromptSubmit` |
1898
+ | Matcher | *(all)* |
1899
+ | Script | `~/.ai-toolkit/hooks/user-prompt-submit.sh` |
1900
+ | Fires | Before Claude starts working on a submitted prompt |
1901
+
1902
+ **Action:** Adds a lightweight governance reminder: plan mode for architectural work, evidence-first debugging, KB-first research, and validation expectations.
1903
+
1904
+ Skipped when `TOOLKIT_HOOK_PROFILE=minimal`.
1905
+
1906
+ ### UserPromptSubmit (usage tracking) — `track-usage.sh`
1907
+
1908
+ | Field | Value |
1909
+ |-------|-------|
1910
+ | Event | `UserPromptSubmit` |
1911
+ | Matcher | *(all)* |
1912
+ | Script | `~/.ai-toolkit/hooks/track-usage.sh` |
1913
+ | Fires | Before Claude starts working on a submitted prompt |
1914
+
1915
+ **Action:** Records skill invocations (slash commands like `/commit`, `/review`) to `~/.ai-toolkit/stats.json` for local usage analytics. Non-slash prompts are ignored.
1916
+
1917
+ ### PostToolUse (edit feedback) — `post-tool-use.sh`
1918
+
1919
+ | Field | Value |
1920
+ |-------|-------|
1921
+ | Event | `PostToolUse` |
1922
+ | Matcher | `Edit\|MultiEdit\|Write` |
1923
+ | Script | `~/.ai-toolkit/hooks/post-tool-use.sh` |
1924
+ | Fires | After file edit/write tool operations |
1925
+
1926
+ **Action:** Adds a lightweight reminder to run relevant validation, tests, and documentation updates after edits.
1927
+
1928
+ Skipped when `TOOLKIT_HOOK_PROFILE=minimal`.
1929
+
1930
+ ### Stop (quality check) — `quality-check.sh`
1931
+
1932
+ | Field | Value |
1933
+ |-------|-------|
1934
+ | Event | `Stop` |
1935
+ | Matcher | *(all)* |
1936
+ | Script | `~/.ai-toolkit/hooks/quality-check.sh` |
1937
+ | Fires | After every Claude response |
1938
+
1939
+ **Action:** Runs language-appropriate linter:
1940
+ - Python: `ruff check .`
1941
+ - TypeScript: `npx tsc --noEmit`
1942
+ - PHP: `vendor/bin/phpstan analyse`
1943
+ - Dart: `dart analyze`
1944
+ - Go: `go vet ./...`
1945
+
1946
+ Skipped when `TOOLKIT_HOOK_PROFILE=minimal`.
1947
+
1948
+ ### Stop (session save) — `save-session.sh`
1949
+
1950
+ | Field | Value |
1951
+ |-------|-------|
1952
+ | Event | `Stop` |
1953
+ | Matcher | *(all)* |
1954
+ | Script | `~/.ai-toolkit/hooks/save-session.sh` |
1955
+ | Fires | After every Claude response |
1956
+
1957
+ **Action:** Writes session context to `.claude/session-context.md` for cross-session persistence.
1958
+
1959
+ Skipped when `TOOLKIT_HOOK_PROFILE=minimal`.
1960
+
1961
+ ### TaskCompleted — `quality-gate.sh`
1962
+
1963
+ | Field | Value |
1964
+ |-------|-------|
1965
+ | Event | `TaskCompleted` |
1966
+ | Matcher | *(all)* |
1967
+ | Script | `~/.ai-toolkit/hooks/quality-gate.sh` |
1968
+ | Fires | When an Agent Teams task is marked complete |
1969
+
1970
+ **Action:** Runs lint/typecheck. **Blocks completion (exit 2)** if errors found. Strict profile also runs `mypy --strict`.
1971
+
1972
+ Skipped when `TOOLKIT_HOOK_PROFILE=minimal`.
1973
+
1974
+ ### SubagentStart — `subagent-start.sh`
1975
+
1976
+ | Field | Value |
1977
+ |-------|-------|
1978
+ | Event | `SubagentStart` |
1979
+ | Matcher | *(all)* |
1980
+ | Script | `~/.ai-toolkit/hooks/subagent-start.sh` |
1981
+ | Fires | When a subagent is spawned |
1982
+
1983
+ **Action:** Reminds subagents to stay narrow in scope, gather evidence first, and return explicit validation notes.
1984
+
1985
+ Skipped when `TOOLKIT_HOOK_PROFILE=minimal`.
1986
+
1987
+ ### SubagentStop — `subagent-stop.sh`
1988
+
1989
+ | Field | Value |
1990
+ |-------|-------|
1991
+ | Event | `SubagentStop` |
1992
+ | Matcher | *(all)* |
1993
+ | Script | `~/.ai-toolkit/hooks/subagent-stop.sh` |
1994
+ | Fires | When a subagent completes |
1995
+
1996
+ **Action:** Enforces a concise handoff checklist: findings, files touched, tests run, risks, and docs follow-up.
1997
+
1998
+ Skipped when `TOOLKIT_HOOK_PROFILE=minimal`.
1999
+
2000
+ ### PreCompact — `pre-compact.sh`
2001
+
2002
+ | Field | Value |
2003
+ |-------|-------|
2004
+ | Event | `PreCompact` |
2005
+ | Matcher | *(all)* |
2006
+ | Script | `~/.ai-toolkit/hooks/pre-compact.sh` |
2007
+ | Fires | Before context compaction |
2008
+
2009
+ **Actions:**
2010
+ 1. Injects reminder to re-read CLAUDE.md files after compaction
2011
+ 2. Preserves session context from `.claude/session-context.md` (if exists)
2012
+ 3. Preserves active instincts from `.claude/instincts/*.md` (if any)
2013
+
2014
+ Skipped when `TOOLKIT_HOOK_PROFILE=minimal`.
2015
+
2016
+ ### SessionEnd — `session-end.sh`
2017
+
2018
+ | Field | Value |
2019
+ |-------|-------|
2020
+ | Event | `SessionEnd` |
2021
+ | Matcher | *(all)* |
2022
+ | Script | `~/.ai-toolkit/hooks/session-end.sh` |
2023
+ | Fires | When a Claude session ends |
2024
+
2025
+ **Action:** Writes `.claude/session-end.md` with a lightweight handoff note for the next session and reminds the next session to review preserved context.
2026
+
2027
+ Skipped when `TOOLKIT_HOOK_PROFILE=minimal`.
2028
+
2029
+ ### TeammateIdle — inline
2030
+
2031
+ | Field | Value |
2032
+ |-------|-------|
2033
+ | Event | `TeammateIdle` |
2034
+ | Matcher | *(all)* |
2035
+ | Fires | Agent Teams teammate going idle |
2036
+
2037
+ **Action:** Reminds teammate to verify: files modified, tests written, docs updated.
2038
+
2039
+ ## Runtime Profiles
2040
+
2041
+ Set in `.claude/settings.local.json`:
2042
+
2043
+ ```json
2044
+ { "env": { "TOOLKIT_HOOK_PROFILE": "standard" } }
2045
+ ```
2046
+
2047
+ | Profile | Behavior |
2048
+ |---------|----------|
2049
+ | `minimal` | Only destructive guard + SessionStart |
2050
+ | `standard` | All hooks (default) |
2051
+ | `strict` | Standard + mypy --strict on task completion |
2052
+
2053
+ ## Architecture
2054
+
2055
+ ```
2056
+ ~/.ai-toolkit/
2057
+ ├── rules/ # Registered rules (add-rule.sh)
2058
+ └── hooks/ # Hook scripts (copied on install)
2059
+ ├── _profile-check.sh # Shared: profile skip logic (sourced by hooks)
2060
+ ├── session-start.sh
2061
+ ├── guard-destructive.sh
2062
+ ├── guard-path.sh
2063
+ ├── user-prompt-submit.sh
2064
+ ├── post-tool-use.sh
2065
+ ├── quality-check.sh
2066
+ ├── quality-gate.sh
2067
+ ├── save-session.sh
2068
+ ├── subagent-start.sh
2069
+ ├── subagent-stop.sh
2070
+ ├── track-usage.sh
2071
+ ├── pre-compact.sh
2072
+ └── session-end.sh
2073
+
2074
+ ~/.claude/settings.json
2075
+ └── hooks: # Hook definitions referencing ~/.ai-toolkit/hooks/
2076
+ ├── SessionStart → session-start.sh
2077
+ ├── Notification → osascript (inline)
2078
+ ├── PreToolUse → guard-destructive.sh, guard-path.sh
2079
+ ├── UserPromptSubmit → user-prompt-submit.sh, track-usage.sh
2080
+ ├── PostToolUse → post-tool-use.sh
2081
+ ├── Stop → quality-check.sh, save-session.sh
2082
+ ├── TaskCompleted → quality-gate.sh
2083
+ ├── TeammateIdle → echo (inline)
2084
+ ├── SubagentStart → subagent-start.sh
2085
+ ├── SubagentStop → subagent-stop.sh
2086
+ ├── PreCompact → pre-compact.sh
2087
+ └── SessionEnd → session-end.sh
2088
+ ```
2089
+
2090
+ **Key design decisions:**
2091
+ - Scripts **copied** (not symlinked) — user can customize without breaking git
2092
+ - Hooks in `settings.json` (not `hooks.json`) — Claude Code only reads settings files
2093
+ - `_source: "ai-toolkit"` tag on every entry — allows idempotent merge/strip
2094
+ - Hooks are **global only** — `--local` does not install hooks into project settings
2095
+
2096
+ ## Troubleshooting
2097
+
2098
+ **Hooks not loading:**
2099
+ 1. Run `/hooks` in Claude Code — lists all active hooks
2100
+ 2. Check `claude --debug hooks` — shows matcher resolution
2101
+ 3. Verify JSON: `python3 -c "import json; json.load(open('$HOME/.claude/settings.json'))"`
2102
+
2103
+ **Hook script not found:**
2104
+ ```bash
2105
+ ls ~/.ai-toolkit/hooks/ # should list 12 .sh files (plus _profile-check.sh helper)
2106
+ ai-toolkit update # re-copies scripts
2107
+ ```
2108
+
2109
+ **Legacy cleanup:**
2110
+ ```bash
2111
+ rm ~/.claude/hooks.json # old format, no longer used
2112
+ rm -rf ~/.claude/hooks # old symlink, no longer used
2113
+ ```
2114
+
2115
+ ---
2116
+
2117
+ ## kb/reference/integrations.md
2118
+
2119
+ ---
2120
+ title: "AI Toolkit - External Integrations"
2121
+ category: reference
2122
+ service: ai-toolkit
2123
+ tags: [integrations, rules, add-rule]
2124
+ version: "1.0.5"
2125
+ created: "2026-03-26"
2126
+ last_updated: "2026-03-26"
2127
+ description: "How external repos inject rules into ~/.claude/CLAUDE.md via ai-toolkit"
2128
+ ---
2129
+
2130
+ # External Integrations
2131
+
2132
+ Repos that register rules with ai-toolkit so they are automatically injected into `~/.claude/CLAUDE.md` on every `update`.
2133
+
2134
+ ---
2135
+
2136
+ ## How to Register Rules
2137
+
2138
+ Use `add-rule` to register a rule file globally. Every subsequent `ai-toolkit update` picks it up automatically.
2139
+
2140
+ ```bash
2141
+ cd /path/to/your-repo
2142
+ ai-toolkit add-rule ./jira-rules.md
2143
+ ai-toolkit update # inject now
2144
+ ```
2145
+
2146
+ After registration, `ai-toolkit update` will always re-inject the rule. Registry location: `~/.ai-toolkit/rules/`.
2147
+
2148
+ To unregister a rule (removes from `~/.ai-toolkit/rules/` and strips the block from `CLAUDE.md`):
2149
+
2150
+ ```bash
2151
+ ai-toolkit remove-rule jira-rules
2152
+ ```
2153
+
2154
+ ---
2155
+
2156
+ ## How It Works
2157
+
2158
+ Both mechanisms use marker-based idempotent injection. Rule name = filename without `.md`.
2159
+
2160
+ ```
2161
+ <!-- TOOLKIT:jira-rules START -->
2162
+
2163
+ ...rule content...
2164
+
2165
+ <!-- TOOLKIT:jira-rules END -->
2166
+ ```
2167
+
2168
+ Content outside markers is never touched. Re-running updates only the marked block.
2169
+
2170
+ ---
2171
+
2172
+ ## Adding a New Integration
2173
+
2174
+ 1. Create `<name>-rules.md` in your repo with Claude-relevant conventions
2175
+ 2. Register it: `ai-toolkit add-rule ./<name>-rules.md`
2176
+ 3. Verify it appears in: `~/.ai-toolkit/rules/<name>-rules.md`
2177
+ 4. On next `install` it will be listed in: `Rules injected: ... <name>-rules`
2178
+ 5. Add an entry below documenting the integration
2179
+
2180
+ ---
2181
+
2182
+ ## Known Integrations
2183
+
2184
+ ### rag-mcp
2185
+
2186
+ **Rule file:** `rag-mcp.md`
2187
+ **Marker:** `TOOLKIT:rag-mcp`
2188
+
2189
+ Teaches Claude Code the RAG-MCP search protocol: always call `smart_query()` before answering, `kb_id` vs `file_path` distinction, available MCP tools.
2190
+
2191
+ ```bash
2192
+ cd /path/to/rag-mcp
2193
+ ai-toolkit add-rule ./rag-mcp-rules.md
2194
+ ```
2195
+
2196
+ ### jira-mcp
2197
+
2198
+ **Rule file:** `jira-rules.md`
2199
+ **Marker:** `TOOLKIT:jira-rules`
2200
+
2201
+ Teaches Claude Code the Jira MCP tool set: `sync_tasks`, `read_cached_tasks`, `update_task_status`, `log_task_time`, and key rules (sync first, hours only, check transitions).
2202
+
2203
+ ```bash
2204
+ cd /path/to/jira-mcp
2205
+ ai-toolkit add-rule ./jira-rules.md
2206
+ ```
2207
+
2208
+ ---
2209
+
2210
+ ## kb/reference/language-packs.md
2211
+
2212
+ ---
2213
+ title: "AI Toolkit - Language Plugin Packs"
2214
+ category: reference
2215
+ service: ai-toolkit
2216
+ tags: [plugins, languages, rust, java, csharp, kotlin, swift, ruby]
2217
+ version: "1.0.0"
2218
+ created: "2026-03-29"
2219
+ last_updated: "2026-03-29"
2220
+ description: "6 language-specific plugin packs providing knowledge skills for Rust, Java, C#, Kotlin, Swift, and Ruby."
2221
+ ---
2222
+
2223
+ # Language Plugin Packs
2224
+
2225
+ ## Overview
2226
+
2227
+ Language packs are domain-scoped plugin packs that provide knowledge skills for specific programming languages. Each pack contains a single knowledge skill with idiomatic patterns, error handling, testing conventions, common frameworks, and performance tips.
2228
+
2229
+ ## Available Packs
2230
+
2231
+ | Pack | Skill | Language | Key Topics |
2232
+ |------|-------|----------|------------|
2233
+ | `rust-pack` | `rust-patterns` | Rust | Ownership, borrowing, Cargo, tokio, serde |
2234
+ | `java-pack` | `java-patterns` | Java | Records, sealed classes, Spring Boot, JUnit 5 |
2235
+ | `csharp-pack` | `csharp-patterns` | C# / .NET | Nullable refs, async/await, ASP.NET Core, EF Core |
2236
+ | `kotlin-pack` | `kotlin-patterns` | Kotlin | Coroutines, DSLs, sealed classes, Ktor, MockK |
2237
+ | `swift-pack` | `swift-patterns` | Swift / iOS | Protocol-oriented, SwiftUI, async/await, SPM |
2238
+ | `ruby-pack` | `ruby-patterns` | Ruby | Blocks, Rails conventions, RSpec, ActiveRecord |
2239
+
2240
+ ## Skill Content Sections
2241
+
2242
+ Each language skill follows a consistent structure:
2243
+
2244
+ 1. **Project Structure** — standard directory layout and build tool configuration
2245
+ 2. **Idioms / Code Style** — language-specific patterns and conventions
2246
+ 3. **Error Handling** — error types, patterns, and best practices
2247
+ 4. **Testing Patterns** — test frameworks, assertion libraries, mocking
2248
+ 5. **Common Libraries / Frameworks** — ecosystem essentials
2249
+ 6. **Performance Tips** — optimization techniques and profiling
2250
+ 7. **Build / Package Management** — dependency management and CI
2251
+
2252
+ ## How Knowledge Skills Work
2253
+
2254
+ These skills have `user-invocable: false` in their frontmatter, meaning they are NOT slash commands. Instead, Claude loads them contextually when the conversation topic matches the skill's description trigger.
2255
+
2256
+ For example, when a user asks "How do I handle errors in Rust?", Claude automatically loads `rust-patterns` to provide idiomatic Rust error handling guidance.
2257
+
2258
+ ## Requesting New Language Packs
2259
+
2260
+ File an issue with the `language-pack` label. Include:
2261
+ - Language name
2262
+ - Key topics to cover
2263
+ - Popular frameworks/libraries to include
2264
+
2265
+ ---
2266
+
2267
+ ## kb/reference/merge-friendly-install-model.md
2268
+
2269
+ ---
2270
+ title: "Merge-Friendly Install Model"
2271
+ category: reference
2272
+ service: ai-toolkit
2273
+ tags: [install, merge, hooks, injection, symlinks]
2274
+ version: "1.0.0"
2275
+ created: "2026-03-27"
2276
+ last_updated: "2026-03-28"
2277
+ description: "Reference description of how ai-toolkit preserves user content while installing toolkit components."
2278
+ ---
2279
+
2280
+ # Merge-Friendly Install Model
2281
+
2282
+ ## Summary
2283
+
2284
+ `ai-toolkit` preserves user content while injecting toolkit behavior.
2285
+
2286
+ Instead of replacing entire directories or files, the installer uses merge-friendly strategies tailored to each component type.
2287
+
2288
+ ## Component Strategies
2289
+
2290
+ | Component | Strategy | User content behavior |
2291
+ |-----------|----------|-----------------------|
2292
+ | `agents/*.md` | per-file symlinks | preserved; user file wins on name conflict |
2293
+ | `skills/*/` | per-directory symlinks | preserved; user directory wins on name conflict |
2294
+ | `settings.json` hooks | JSON merge with `_source: ai-toolkit` | preserved; toolkit entries removable |
2295
+ | `constitution.md` | marker injection | preserved outside markers |
2296
+ | `ARCHITECTURE.md` | marker injection | preserved outside markers |
2297
+ | `CLAUDE.md` | marker injection | preserved outside markers |
2298
+
2299
+ ## Why this model exists
2300
+
2301
+ This avoids two common failure modes:
2302
+ 1. users losing custom agents / skills due to whole-directory symlinks,
2303
+ 2. users losing custom hooks or docs due to full-file replacement.
2304
+
2305
+ ## Operational Consequences
2306
+
2307
+ ### Positive
2308
+ - reversible installs and uninstalls,
2309
+ - backward-compatible upgrades,
2310
+ - safe coexistence of toolkit and user customizations,
2311
+ - idempotent update flow.
2312
+
2313
+ ### Trade-offs
2314
+ - merged / copied artifacts require `ai-toolkit update` to refresh,
2315
+ - hook merge logic depends on valid JSON and the `_source` tagging convention,
2316
+ - install behavior is more complex than a simple copy or symlink-only model.
2317
+
2318
+ ## Local Project Setup
2319
+
2320
+ Project-local setup uses the same preservation approach for files that should remain repository-specific, especially `CLAUDE.md` and `.claude/settings.local.json`.
2321
+
2322
+ ## Related Documents
2323
+
2324
+ - `kb/reference/distribution-model.md`
2325
+ - `kb/reference/global-install-model.md`
2326
+ - `kb/reference/hooks-catalog.md`
2327
+
2328
+ ---
2329
+
2330
+ ## kb/reference/plugin-pack-conventions.md
2331
+
2332
+ ---
2333
+ title: "Plugin Pack Conventions"
2334
+ category: reference
2335
+ service: ai-toolkit
2336
+ tags: [plugins, plugin-packs, conventions, manifests, hooks, policy-packs]
2337
+ version: "1.0.0"
2338
+ created: "2026-03-28"
2339
+ last_updated: "2026-04-02"
2340
+ description: "Conventions for experimental ai-toolkit plugin packs, policy packs, hook packs, and plugin-creator scaffolding."
2341
+ ---
2342
+
2343
+ # Plugin Pack Conventions
2344
+
2345
+ ## Purpose
2346
+
2347
+ `ai-toolkit` now includes experimental plugin packs under `app/plugins/` to formalize a Claude Code-compatible plugin direction without changing the default global install surface.
2348
+
2349
+ ## Pack Types
2350
+
2351
+ | Type | Purpose | Example |
2352
+ |------|---------|---------|
2353
+ | `plugin-pack` | Curated bundle of existing assets by domain | `security-pack`, `research-pack` |
2354
+ | `policy-pack` | Rules / compliance / governance overlays | future enterprise policy add-ons |
2355
+ | `hook-pack` | Optional hook modules or observability bundles | status line, output style |
2356
+
2357
+ ## Directory Contract
2358
+
2359
+ ```text
2360
+ app/plugins/<pack-name>/
2361
+ ├── plugin.json
2362
+ ├── README.md
2363
+ ├── hooks/ # optional, executable if present
2364
+ ├── rules/ # optional
2365
+ ├── skills/ # optional
2366
+ ├── agents/ # optional
2367
+ └── templates/ # optional
2368
+ ```
2369
+
2370
+ ## Manifest Contract
2371
+
2372
+ Required keys:
2373
+ - `name`
2374
+ - `description`
2375
+ - `version`
2376
+ - `domain`
2377
+ - `type`
2378
+ - `status`
2379
+ - `requires`
2380
+ - `includes`
2381
+
2382
+ `includes` should declare arrays for:
2383
+ - `agents`
2384
+ - `skills`
2385
+ - `rules`
2386
+ - `hooks`
2387
+
2388
+ ## Naming Rules
2389
+
2390
+ - Pack directory and `name` should use lowercase-hyphen format
2391
+ - Prefer `*-pack` suffix for curated bundles
2392
+ - Hook module filenames should be kebab-case and executable
2393
+ - Experimental packs should declare `"status": "experimental"`
2394
+
2395
+ ## Adoption Rules
2396
+
2397
+ 1. Packs are opt-in and must not be auto-installed by `ai-toolkit install`
2398
+ 2. Reuse core agents/skills before duplicating definitions
2399
+ 3. Optional hooks must be documented as opt-in and non-default
2400
+ 4. Policy packs should be additive and marker-injected where possible
2401
+ 5. Keep manifests small and reviewable; use README for narrative guidance
2402
+
2403
+ ## CLI Management
2404
+
2405
+ ```bash
2406
+ ai-toolkit plugin list # show all 11 packs with install status
2407
+ ai-toolkit plugin install <name> # install a single pack
2408
+ ai-toolkit plugin install --all # install all 11 packs
2409
+ ai-toolkit plugin update <name> # update a pack (remove + reinstall, preserves data)
2410
+ ai-toolkit plugin update --all # update all installed packs
2411
+ ai-toolkit plugin clean <name> # prune data older than 90 days (default)
2412
+ ai-toolkit plugin clean <name> --days 30 # prune data older than 30 days
2413
+ ai-toolkit plugin remove <name> # remove a pack
2414
+ ai-toolkit plugin remove --all # remove all installed packs
2415
+ ai-toolkit plugin status # show installed packs with data stats
2416
+ ```
2417
+
2418
+ ### What `plugin install` Does
2419
+
2420
+ 1. **Verifies** referenced agents/skills exist in `~/.claude/` (links them from core if missing)
2421
+ 2. **Copies** plugin-specific hooks to `~/.ai-toolkit/hooks/plugin-<pack>-<hook>.sh`
2422
+ 3. **Copies** plugin-specific scripts to `~/.ai-toolkit/plugin-scripts/<pack>/`
2423
+ 4. **Runs** init scripts if present (e.g. `init_db.py` for memory-pack — safe to re-run, preserves data)
2424
+ 5. **Merges** plugin hooks into `~/.claude/settings.json` (tagged with `_source: ai-toolkit-plugin-<name>`)
2425
+ 6. **Records** installed state to `~/.ai-toolkit/plugins.json`
2426
+
2427
+ ### What `plugin update` Does
2428
+
2429
+ 1. **Removes** existing plugin hooks, scripts, and settings.json entries (same as `remove`)
2430
+ 2. **Reinstalls** from the current source (same as `install`)
2431
+ 3. **Preserves plugin data** (e.g. memory-pack SQLite database is never deleted)
2432
+ 4. `--all` updates only currently installed packs (not all available)
2433
+
2434
+ ### What `plugin clean` Does
2435
+
2436
+ 1. **Prunes** old plugin data based on `--days N` (default 90)
2437
+ 2. For memory-pack: deletes observations older than N days, removes orphan sessions, runs VACUUM
2438
+ 3. Shows before/after counts and DB size
2439
+
2440
+ ### What `plugin remove` Does
2441
+
2442
+ 1. **Removes** plugin hooks from `~/.ai-toolkit/hooks/`
2443
+ 2. **Removes** plugin scripts from `~/.ai-toolkit/plugin-scripts/`
2444
+ 3. **Strips** plugin hook entries from `settings.json` (by `_source` tag)
2445
+ 4. **Updates** `plugins.json` state
2446
+ 5. **Leaves** core agents/skills untouched (they belong to the base install)
2447
+ 6. **Leaves** plugin data intact (e.g. `memory.db` — use `clean` to prune)
2448
+
2449
+ ### Data Retention (memory-pack)
2450
+
2451
+ - **Auto-retention**: `session-summary.sh` hook auto-prunes observations older than 90 days on every session end (configurable via `MEMORY_RETENTION_DAYS` env var)
2452
+ - **Manual clean**: `ai-toolkit plugin clean memory-pack --days 30`
2453
+ - **Status**: `ai-toolkit plugin status` shows DB size, observation count, date range
2454
+
2455
+ ## Current Experimental Packs
2456
+
2457
+ | Pack | Domain | Agents | Skills | Hooks | Description |
2458
+ |------|--------|--------|--------|-------|-------------|
2459
+ | `security-pack` | security | 3 | 3 | 2 | Security auditing, threat modeling, OWASP |
2460
+ | `research-pack` | research | 4 | 4 | 1 | Multi-source research, synthesis, fact-checking |
2461
+ | `frontend-pack` | frontend | 3 | 3 | 1 | React/Vue/CSS, SEO, design engineering |
2462
+ | `enterprise-pack` | enterprise | 3 | 3 | 3 | Executive briefings, infra architecture, status |
2463
+ | `memory-pack` | memory | 0 | 1 | 2 | SQLite persistent memory with FTS5 search |
2464
+ | `rust-pack` | rust | 0 | 1 | 0 | Rust patterns |
2465
+ | `java-pack` | java | 0 | 1 | 0 | Java patterns |
2466
+ | `csharp-pack` | csharp | 0 | 1 | 0 | C# patterns |
2467
+ | `kotlin-pack` | kotlin | 0 | 1 | 0 | Kotlin patterns |
2468
+ | `swift-pack` | swift | 0 | 1 | 0 | Swift patterns |
2469
+ | `ruby-pack` | ruby | 0 | 1 | 0 | Ruby patterns |
2470
+
2471
+ ## Optional Hook Modules
2472
+
2473
+ `enterprise-pack` provides two optional hook modules:
2474
+ - `hooks/status-line.sh` — status line overlay
2475
+ - `hooks/output-style.sh` — enterprise reporting style
2476
+
2477
+ `memory-pack` provides two hooks:
2478
+ - `hooks/observation-capture.sh` — captures tool actions to SQLite (PostToolUse)
2479
+ - `hooks/session-summary.sh` — summarizes session on Stop
2480
+
2481
+ These are intentionally excluded from the default install until explicitly enabled via `ai-toolkit plugin install`.
2482
+
2483
+
2484
+ ---
2485
+
2486
+ ## kb/reference/quick-wins-implementation-summary.md
2487
+
2488
+ ---
2489
+ title: "Quick Wins Implementation Summary"
2490
+ category: reference
2491
+ service: ai-toolkit
2492
+ tags: [implementation, hooks, cli, benchmark, validation]
2493
+ version: "1.0.0"
2494
+ created: "2026-03-28"
2495
+ last_updated: "2026-04-01"
2496
+ description: "Reference summary of the quick-win execution slice that became part of the baseline toolkit implementation."
2497
+ ---
2498
+
2499
+ # Quick Wins Implementation Summary
2500
+
2501
+ ## Purpose
2502
+
2503
+ This document records the implementation slice that hardened the toolkit around creator workflows, diagnostics, lifecycle hooks, benchmark tooling, and validation.
2504
+
2505
+ ## Delivered Runtime Features
2506
+
2507
+ ### Creator workflows
2508
+ - `app/skills/hook-creator/SKILL.md`
2509
+ - `app/skills/command-creator/SKILL.md`
2510
+ - `app/skills/agent-creator/SKILL.md`
2511
+ - `app/skills/plugin-creator/SKILL.md`
2512
+
2513
+ ### CLI and diagnostics
2514
+ - `ai-toolkit doctor`
2515
+ - `ai-toolkit benchmark-ecosystem`
2516
+ - `scripts/harvest_ecosystem.py`
2517
+
2518
+ ### Hook coverage
2519
+ - `PreCompact`
2520
+ - `PostToolUse`
2521
+ - `UserPromptSubmit`
2522
+ - `SubagentStart`
2523
+ - `SubagentStop`
2524
+ - `SessionEnd`
2525
+
2526
+ ### Validation and benchmarks
2527
+ - benchmark dashboard JSON
2528
+ - benchmark harvest JSON
2529
+ - plugin-pack validation
2530
+ - benchmark freshness checks in `doctor`
2531
+ - expanded lifecycle and asset checks in `validate.py`
2532
+
2533
+ ## Delivered Documentation
2534
+
2535
+ Updated baseline docs:
2536
+ - `README.md`
2537
+ - `app/ARCHITECTURE.md`
2538
+ - `kb/reference/architecture-overview.md`
2539
+ - `kb/reference/hooks-catalog.md`
2540
+ - `kb/reference/skills-catalog.md`
2541
+ - `kb/reference/plugin-pack-conventions.md`
2542
+ - `kb/reference/claude-ecosystem-benchmark-snapshot.md`
2543
+ - `kb/procedures/maintenance-sop.md`
2544
+
2545
+ ## Validation Evidence
2546
+
2547
+ The implementation is backed by:
2548
+ - `scripts/validate.py`
2549
+ - CLI tests
2550
+ - install tests
2551
+ - generator tests
2552
+ - metadata contract tests
2553
+ - validator negative tests
2554
+
2555
+ ## Final Outcome
2556
+
2557
+ The quick-win slice is no longer a pending execution plan. Its outputs are part of the default toolkit baseline and should be treated as shipped product behavior.
2558
+
2559
+ ---
2560
+
2561
+ ## kb/reference/skill-templates.md
2562
+
2563
+ ---
2564
+ title: "AI Toolkit - Skill Templates"
2565
+ category: reference
2566
+ service: ai-toolkit
2567
+ tags: [templates, scaffolding, create, skills]
2568
+ version: "1.0.0"
2569
+ created: "2026-03-29"
2570
+ last_updated: "2026-04-01"
2571
+ description: "5 skill templates for scaffolding new skills: linter, reviewer, generator, workflow, knowledge."
2572
+ ---
2573
+
2574
+ # Skill Templates
2575
+
2576
+ ## Overview
2577
+
2578
+ `ai-toolkit create skill` scaffolds new skills from predefined templates. Each template produces a valid SKILL.md that passes `validate.py`.
2579
+
2580
+ ## Usage
2581
+
2582
+ ```bash
2583
+ ai-toolkit create skill my-skill --template=linter
2584
+ ai-toolkit create skill my-checker --template=reviewer --description="Review security headers"
2585
+ ```
2586
+
2587
+ ## Available Templates
2588
+
2589
+ | Template | Skill Type | Key Frontmatter | Use When |
2590
+ |----------|-----------|-----------------|----------|
2591
+ | `linter` | Task | `disable-model-invocation: true`, `allowed-tools: Bash, Read` | Automated checks, validators |
2592
+ | `reviewer` | Hybrid | `context: fork`, `agent: code-reviewer` | Code review with agent delegation |
2593
+ | `generator` | Task | `allowed-tools: Read, Write, Bash, Glob` | File generation, scaffolding |
2594
+ | `workflow` | Hybrid | `context: fork`, `agent: orchestrator`, `model: opus` | Multi-phase orchestration |
2595
+ | `knowledge` | Knowledge | `user-invocable: false` | Auto-loaded domain patterns |
2596
+
2597
+ ## Template Variables
2598
+
2599
+ | Variable | Replaced With | Example |
2600
+ |----------|--------------|---------|
2601
+ | `{{NAME}}` | Skill name argument | `my-linter` |
2602
+ | `{{DESCRIPTION}}` | `--description` value or default | `Provides my-linter functionality` |
2603
+
2604
+ ## Template Location
2605
+
2606
+ Templates are stored in `app/templates/skill/{type}/SKILL.md.template`.
2607
+
2608
+ ## After Scaffolding
2609
+
2610
+ 1. Edit the generated `app/skills/{name}/SKILL.md`
2611
+ 2. Add `reference/` or `templates/` subdirectories if needed
2612
+ 3. Run `ai-toolkit validate` to verify
2613
+
2614
+ ---
2615
+
2616
+ ## kb/reference/skills-catalog.md
2617
+
2618
+ ---
2619
+ title: "AI Toolkit - Skills Catalog"
2620
+ category: reference
2621
+ service: ai-toolkit
2622
+ tags: [skills, domain-knowledge, catalog, task-skills, hybrid-skills]
2623
+ version: "1.0.0"
2624
+ created: "2026-03-23"
2625
+ last_updated: "2026-04-01"
2626
+ description: "Complete catalog of 85 skills: 27 task, 27 hybrid, 31 knowledge. Includes effort levels, skill-scoped hooks, executable scripts, and creator workflows."
2627
+ ---
2628
+
2629
+ # Skills Catalog (85 skills)
2630
+
2631
+ All functionality is unified under skills. Task and hybrid skills are user-invocable as slash commands. Knowledge skills provide domain patterns auto-loaded by agents.
2632
+
2633
+ ## Skill Tiers
2634
+
2635
+ | Tier | Skills | When |
2636
+ |------|--------|------|
2637
+ | **1 — Quick single-agent** | `/debug`, `/review`, `/refactor`, `/analyze`, `/docs`, `/plan`, `/explain` | One concern, fast |
2638
+ | **2 — Multi-agent workflow** | `/workflow <type>` | Cross-cutting task with known pattern |
2639
+ | **3 — Custom parallelism** | `/orchestrate`, `/swarm` | No predefined workflow matches |
2640
+
2641
+ ## Task Skills (27)
2642
+
2643
+ Task skills execute a specific action. Invoked via slash commands. `disable-model-invocation: true`.
2644
+
2645
+ | Skill | Slash Command | Effort | Description |
2646
+ |-------|---------------|--------|-------------|
2647
+ | **commit** | `/commit` | medium | Create well-structured git commits (Conventional Commits) |
2648
+ | **pr** | `/pr` | medium | Create GitHub pull request with template and checks |
2649
+ | **test** | `/test` | medium | Run tests (auto-detect: pytest, vitest, jest, phpunit, flutter, go, cargo) |
2650
+ | **build** | `/build` | low | Build the current project (auto-detects project type) |
2651
+ | **lint** | `/lint` | low | Run linting and type checking (ruff/mypy, eslint/tsc, phpstan, dart analyze) |
2652
+ | **fix** | `/fix` | low | Autonomously fix failing tests or lint errors (iterative loop) |
2653
+ | **deploy** | `/deploy` | medium | Deploy to target environment with pre-deployment checks |
2654
+ | **rollback** | `/rollback` | medium | Safe rollback (git, database migrations, deployments) |
2655
+ | **migrate** | `/migrate` | medium | Database migration workflow (auto-detect: Alembic, Prisma, Laravel, Django) |
2656
+ | **ci** | `/ci` | medium | Generate/manage CI/CD pipeline configuration (GitHub Actions, GitLab CI) |
2657
+ | **panic** | `/panic` | low | EMERGENCY: Immediately halt all autonomous agent operations |
2658
+ | **index** | `/index` | low | Reindex knowledge base to vector store with change detection |
2659
+ | **onboard** | `/onboard` | medium | Guided project setup with the toolkit |
2660
+ | **night-watch** | `/night-watch` | medium | Trigger Night Watchman autonomous maintenance cycle |
2661
+ | **evolve** | `/evolve` | medium | Trigger Meta-Architect self-optimization cycle |
2662
+ | **chaos** | `/chaos` | medium | Trigger Chaos Engineering experiment |
2663
+ | **predict** | `/predict` | medium | Predict impact and risks of code changes |
2664
+ | **biz-scan** | `/biz-scan` | medium | Scan project for business value opportunities and metric gaps |
2665
+ | **briefing** | `/briefing` | medium | Generate daily executive summary of system status |
2666
+ | **evaluate** | `/evaluate` | medium | Evaluate RAG quality using LLM-as-a-Judge methodology |
2667
+ | **skill-creator** | `/skill-creator` | high | Create new skills following Agent Skills standard |
2668
+ | **hook-creator** | `/hook-creator` | high | Create new Claude Code hooks with conventions and validation |
2669
+ | **command-creator** | `/command-creator` | high | Create new slash commands with frontmatter and workflow guidance |
2670
+ | **agent-creator** | `/agent-creator` | high | Create new specialized agents with trigger and tool selection guidance |
2671
+ | **plugin-creator** | `/plugin-creator` | high | Create experimental opt-in plugin packs with manifests, conventions, and optional modules |
2672
+ | **health** | `/health` | medium | Check health of project services (auto-detect) |
2673
+ | **prd-to-issues** | `/prd-to-issues` | medium | Break PRD into GitHub issues with vertical slices and HITL/AFK tagging |
2674
+
2675
+ ## Hybrid Skills (27)
2676
+
2677
+ Hybrid skills combine slash-command invocation with domain knowledge that agents reference.
2678
+
2679
+ | Skill | Slash Command | Effort | Description |
2680
+ |-------|---------------|--------|-------------|
2681
+ | **explore** | `/explore` | medium | Explore and understand codebase structure and tech stack |
2682
+ | **debug** | `/debug` | medium | Systematic debugging with logs, health checks, diagnostics (Tier 1 — single agent) |
2683
+ | **review** | `/review` | high | Review code changes: quality, security, performance (Tier 1 — single agent) |
2684
+ | **plan** | `/plan` | high | Create structured plan with task breakdown and agent assignments |
2685
+ | **refactor** | `/refactor` | high | Plan and execute code refactoring with safety checks (Tier 1 — single agent) |
2686
+ | **analyze** | `/analyze` | medium | Analyze code quality, complexity, and patterns |
2687
+ | **docs** | `/docs` | high | Generate/update docs: README, API docs, architecture notes, changelogs (Tier 1 — single agent) |
2688
+ | **search** | `/search` | medium | Search knowledge base (MCP tools with local fallback) |
2689
+ | **explain** | `/explain` | medium | Explain architecture of a file/module using Mermaid diagrams |
2690
+ | **orchestrate** | `/orchestrate` | max | Custom multi-agent parallelism — Tier 3, spawns agents via Agent tool |
2691
+ | **swarm** | `/swarm` | max | Massive parallelism: map-reduce, consensus, relay — Tier 3 |
2692
+ | **workflow** | `/workflow` | max | 15 predefined multi-agent workflow types — Tier 2 |
2693
+ | **instinct-review** | `/instinct-review` | low | Review, curate, and manage learned instincts from past sessions |
2694
+ | **teams** | `/teams` | max | Launch pre-configured Agent Teams compositions for common workflows |
2695
+ | **write-a-prd** | `/write-a-prd` | high | Create PRD through interactive interview, codebase exploration, and module design |
2696
+ | **prd-to-plan** | `/prd-to-plan` | high | Convert PRD into phased implementation plan using tracer-bullet vertical slices |
2697
+ | **tdd** | `/tdd` | high | Test-driven development with red-green-refactor loop and vertical slices |
2698
+ | **design-an-interface** | `/design-an-interface` | high | Generate 3+ radically different interface designs using parallel sub-agents |
2699
+ | **grill-me** | `/grill-me` | medium | Stress-test a plan through relentless Socratic questioning |
2700
+ | **ubiquitous-language** | `/ubiquitous-language` | medium | Extract DDD-style ubiquitous language glossary from conversation |
2701
+ | **refactor-plan** | `/refactor-plan` | high | Create detailed refactor plan with tiny commits via user interview |
2702
+ | **qa-session** | `/qa-session` | high | Interactive QA session — report bugs conversationally, file GitHub issues |
2703
+ | **triage-issue** | `/triage-issue` | high | Triage bug with deep codebase exploration and TDD fix plan |
2704
+ | **architecture-audit** | `/architecture-audit` | high | Discover shallow modules and propose module-deepening refactors |
2705
+ | **subagent-development** | `/subagent-development` | high | Execute plans with 2-stage review (spec + quality) per task |
2706
+ | **repeat** | `/repeat` | medium | Autonomous loop with safety controls (Ralph Wiggum pattern) |
2707
+ | **mem-search** | `/mem-search` | medium | Search past coding sessions via natural language (memory-pack) |
2708
+
2709
+ ### `/workflow` types
2710
+
2711
+ | Type | Agents | Use case |
2712
+ |------|--------|----------|
2713
+ | `feature-development` | 8 | Full stack feature: plan → backend + frontend + DB + tests + security + docs |
2714
+ | `backend-feature` | 5 | Backend only: API + logic + DB + tests + security |
2715
+ | `frontend-feature` | 4 | UI: component + state + tests + docs |
2716
+ | `api-design` | 7 | API contract → implement → test → benchmark → document |
2717
+ | `database-evolution` | 7 | Schema change + migration + ORM update + tests + perf + security |
2718
+ | `test-coverage` | 4 | Boost coverage: map gaps → unit tests + fixtures → review |
2719
+ | `security-audit` | 7 | Multi-vector: OWASP + code + infra + DB → prioritize → report |
2720
+ | `codebase-onboarding` | 6 | Read-only: structure + architecture + DB + tests + security → guide |
2721
+ | `spike` | 7 | Research → feasibility → security + perf → architecture note |
2722
+ | `debugging` | 5 | Diagnose → fix → test → document |
2723
+ | `incident-response` | 3 | Triage → fix → postmortem |
2724
+ | `performance-optimization` | 4 | Profile → optimize → benchmark → document |
2725
+ | `infrastructure-change` | 5 | Design + implement + security + tests + runbook |
2726
+ | `application-deploy` | 3 | Deploy → smoke test → release notes |
2727
+ | `proactive-troubleshooting` | 4 | Investigate → check perf → preventive fix → docs |
2728
+
2729
+ ## Knowledge Skills - Development (9)
2730
+
2731
+ | Skill | Directory | Domain |
2732
+ |-------|-----------|--------|
2733
+ | **app-builder** | `skills/app-builder/` | Full-stack application architecture |
2734
+ | **api-patterns** | `skills/api-patterns/` | REST/GraphQL design, versioning, error handling |
2735
+ | **database-patterns** | `skills/database-patterns/` | Schema design, indexing, query optimization |
2736
+ | **flutter-patterns** | `skills/flutter-patterns/` | Flutter/Dart architecture, state management |
2737
+ | **ecommerce-patterns** | `skills/ecommerce-patterns/` | E-commerce: catalog, cart, checkout, payments |
2738
+ | **clean-code** | `skills/clean-code/` | Multi-language code quality: Python, TS, PHP, Go, Dart |
2739
+ | **typescript-patterns** | `skills/typescript-patterns/` | TypeScript/JavaScript patterns for frontend and backend |
2740
+ | **design-engineering** | `skills/design-engineering/` | UI polish, animation craft, easing, transforms, accessibility |
2741
+ | **documentation-standards** | `skills/documentation-standards/` | KB document conventions, frontmatter validation, category taxonomy |
2742
+
2743
+ ## Knowledge Skills - Infrastructure (6)
2744
+
2745
+ | Skill | Directory | Domain |
2746
+ |-------|-----------|--------|
2747
+ | **docker-devops** | `skills/docker-devops/` | Docker, deployment, infrastructure |
2748
+ | **security-patterns** | `skills/security-patterns/` | OWASP, auth, encryption, vulnerability prevention |
2749
+ | **ci-cd-patterns** | `skills/ci-cd-patterns/` | GitHub Actions, GitLab CI, Docker builds, Kubernetes |
2750
+ | **observability-patterns** | `skills/observability-patterns/` | Logging, metrics, tracing, monitoring, SLOs |
2751
+ | **testing-patterns** | `skills/testing-patterns/` | Multi-language TDD: pytest, vitest, phpunit, go test, flutter |
2752
+ | **migration-patterns** | `skills/migration-patterns/` | Database migrations, API versioning, zero-downtime |
2753
+
2754
+ ## Knowledge Skills - AI/RAG (2)
2755
+
2756
+ | Skill | Directory | Domain |
2757
+ |-------|-----------|--------|
2758
+ | **rag-patterns** | `skills/rag-patterns/` | RAG pipelines, chunking, reranking, evaluation |
2759
+ | **mcp-patterns** | `skills/mcp-patterns/` | MCP protocol, server/client design, tools |
2760
+
2761
+ ## Knowledge Skills - Process (7)
2762
+
2763
+ | Skill | Directory | Domain |
2764
+ |-------|-----------|--------|
2765
+ | **plan-writing** | `skills/plan-writing/` | Implementation plans, success criteria, pre-mortem |
2766
+ | **debugging-tactics** | `skills/debugging-tactics/` | Iron Law 4-phase debugging: root cause → pattern → hypothesis → fix |
2767
+ | **git-mastery** | `skills/git-mastery/` | Git workflows, branching, conflict resolution |
2768
+ | **architecture-decision** | `skills/architecture-decision/` | Architecture notes, trade-off analysis, alternatives |
2769
+ | **performance-profiling** | `skills/performance-profiling/` | Profiling, bottleneck analysis, optimization |
2770
+ | **research-mastery** | `skills/research-mastery/` | Multi-source research, synthesis, fact-checking |
2771
+ | **verification-before-completion** | `skills/verification-before-completion/` | Iron Law: evidence-before-claims, no completion without fresh verification |
2772
+
2773
+ ## Knowledge Skills - Orchestration (1)
2774
+
2775
+ | Skill | Directory | Domain |
2776
+ |-------|-----------|--------|
2777
+ | **hive-mind** | `skills/hive-mind/` | Multi-agent aggregation, consensus, swarm patterns |
2778
+
2779
+ ## Advanced Features
2780
+
2781
+ ### Effort Levels
2782
+ - **low**: Mechanical operations (lint, build, fix, panic, index)
2783
+ - **medium**: Standard operations (most skills)
2784
+ - **high**: Complex reasoning (review, plan, refactor, docs, skill-creator)
2785
+ - **max**: Multi-agent orchestration (orchestrate, swarm, workflow)
2786
+
2787
+ ### Skill-Scoped Hooks
2788
+ 5 skills have lifecycle hooks:
2789
+ - **commit**: PreToolUse — lint reminder before committing
2790
+ - **test**: PostToolUse — coverage threshold reminder
2791
+ - **deploy**: PostToolUse — health check reminder
2792
+ - **migrate**: PreToolUse — backup reminder before migrations
2793
+ - **rollback**: PostToolUse — verification reminder after rollback
2794
+
2795
+ ### Skill Frontmatter Conventions
2796
+ - `agent: <name>` — delegates to a specialized agent persona
2797
+ - `context: fork` — runs skill in isolated forked context
2798
+ - `allowed-tools: ...` — tools available to the agent when processing this skill
2799
+ - `depends-on: skill-a, skill-b` — declares dependencies on other skills (validated by `validate.py`)
2800
+
2801
+ ### Skill Dependencies (`depends-on`)
2802
+ Skills can declare dependencies on other skills (primarily knowledge skills) for documentation and validation:
2803
+ ```yaml
2804
+ depends-on: clean-code, api-patterns
2805
+ ```
2806
+ - CSV list of skill directory names
2807
+ - Validated by `validate.py` — each dep must exist as `app/skills/{dep}/SKILL.md`
2808
+ - Reported in `evaluate_skills.py` quality metrics
2809
+ - No runtime autoloading — Claude loads knowledge skills contextually based on topic matching
2810
+
2811
+ ### Executable Scripts (18 total, stdlib-only, JSON output)
2812
+
2813
+ | Skill | Script | Purpose |
2814
+ |-------|--------|---------|
2815
+ | **commit** | `scripts/pre-commit-check.py` | Staged files, secrets detection |
2816
+ | **test** | `scripts/detect-runner.py` | Auto-detect test framework |
2817
+ | **lint** | `scripts/detect-linters.py` | Detect available linters |
2818
+ | **build** | `scripts/detect-build.py` | Detect build system |
2819
+ | **deploy** | `scripts/pre_deploy_check.py` | Pre-deployment readiness |
2820
+ | **rollback** | `scripts/rollback_info.py` | Rollback context |
2821
+ | **migrate** | `scripts/migration-status.py` | Detect migration tool, status |
2822
+ | **ci** | `scripts/ci-detect.py` | Detect CI platform |
2823
+ | **fix** | `scripts/error-classifier.py` | Classify lint/test errors |
2824
+ | **pr** | `scripts/pr-summary.py` | Generate PR title/description |
2825
+ | **review** | `scripts/diff-analyzer.py` | Parse git diff, categorize files |
2826
+ | **debug** | `scripts/error-parser.py` | Parse stack traces |
2827
+ | **explore** | `scripts/visualize.py` | Interactive HTML codebase tree |
2828
+ | **explain** | `scripts/dependency-graph.py` | Import graph → Mermaid |
2829
+ | **docs** | `scripts/doc-inventory.py` | Inventory docs, measure coverage |
2830
+ | **refactor** | `scripts/refactor-scan.py` | Detect code smells |
2831
+ | **health** | `scripts/health_check.py` | JSON health report |
2832
+ | **analyze** | `scripts/complexity.py` | Code complexity metrics |
2833
+
2834
+ ---
2835
+
2836
+ ## kb/reference/skills-unification.md
2837
+
2838
+ ---
2839
+ title: "Skills Unification Model"
2840
+ category: reference
2841
+ service: ai-toolkit
2842
+ tags: [skills, commands, architecture, classification]
2843
+ version: "1.0.0"
2844
+ created: "2026-03-25"
2845
+ last_updated: "2026-03-28"
2846
+ description: "Reference explanation of why ai-toolkit standardizes on the Agent Skills format for slash-command behavior."
2847
+ ---
2848
+
2849
+ # Skills Unification Model
2850
+
2851
+ ## Summary
2852
+
2853
+ `ai-toolkit` standardizes on the Agent Skills directory format for all reusable slash-command behavior.
2854
+
2855
+ The toolkit no longer treats commands and skills as separate implementation models. Instead, it uses one consistent format:
2856
+
2857
+ - task skills,
2858
+ - hybrid skills,
2859
+ - knowledge skills.
2860
+
2861
+ ## Why this model is used
2862
+
2863
+ The Agent Skills format supports capabilities that plain command markdown files do not:
2864
+ - richer frontmatter,
2865
+ - progressive disclosure,
2866
+ - bundled scripts,
2867
+ - templates and reference files,
2868
+ - cross-tool compatibility.
2869
+
2870
+ ## Classification
2871
+
2872
+ | Type | Frontmatter signal | Purpose |
2873
+ |------|--------------------|---------|
2874
+ | Task skill | `disable-model-invocation: true` | explicit user-triggered actions |
2875
+ | Hybrid skill | default invocation | user-invocable + agent-usable workflows |
2876
+ | Knowledge skill | `user-invocable: false` | auto-loaded patterns and conventions |
2877
+
2878
+ ## Consequences
2879
+
2880
+ ### Positive
2881
+ - one mental model for reusable behavior,
2882
+ - easier validation,
2883
+ - simpler install logic,
2884
+ - better alignment with Claude Code ecosystem conventions.
2885
+
2886
+ ### Trade-offs
2887
+ - more directories than a flat commands model,
2888
+ - stronger need for naming and frontmatter conventions,
2889
+ - documentation and generators must stay synchronized with counts.
2890
+
2891
+ ## Related Documents
2892
+
2893
+ - `kb/reference/skills-catalog.md`
2894
+ - `kb/reference/architecture-overview.md`
2895
+
2896
+ ---
2897
+
2898
+ ## kb/reference/stats.md
2899
+
2900
+ ---
2901
+ title: "AI Toolkit - Usage Statistics"
2902
+ category: reference
2903
+ service: ai-toolkit
2904
+ tags: [stats, usage, tracking, analytics]
2905
+ version: "1.0.0"
2906
+ created: "2026-03-29"
2907
+ last_updated: "2026-03-29"
2908
+ description: "Local usage tracking for skill invocations. CLI command, JSON format, hook mechanism."
2909
+ ---
2910
+
2911
+ # Usage Statistics
2912
+
2913
+ ## Overview
2914
+
2915
+ `ai-toolkit stats` tracks how often each skill is invoked via slash commands. All data is local — stored in `~/.ai-toolkit/stats.json`. No telemetry, no network calls.
2916
+
2917
+ ## CLI Commands
2918
+
2919
+ ```bash
2920
+ ai-toolkit stats # Show usage table (sorted by count)
2921
+ ai-toolkit stats --reset # Clear all stats
2922
+ ai-toolkit stats --json # Output raw JSON
2923
+ ```
2924
+
2925
+ ## How It Works
2926
+
2927
+ A `UserPromptSubmit` hook (`track-usage.sh`) fires on every prompt. When the prompt starts with `/skill-name`, it increments the counter in `stats.json`.
2928
+
2929
+ ### Hook Details
2930
+ - **Event**: `UserPromptSubmit`
2931
+ - **Script**: `~/.ai-toolkit/hooks/track-usage.sh`
2932
+ - **Detection**: `grep -oE '^/[a-z][a-z0-9-]*'`
2933
+ - **Storage**: Atomic write via python3 `os.replace()`
2934
+ - **Overhead**: ~50ms (python3 startup + JSON read/write)
2935
+
2936
+ ## JSON Format
2937
+
2938
+ ```json
2939
+ {
2940
+ "commit": {
2941
+ "count": 42,
2942
+ "last_used": "2026-03-29 14:30:00"
2943
+ },
2944
+ "review": {
2945
+ "count": 15,
2946
+ "last_used": "2026-03-28 09:12:00"
2947
+ }
2948
+ }
2949
+ ```
2950
+
2951
+ ## Output Example
2952
+
2953
+ ```
2954
+ AI Toolkit Usage Stats
2955
+ ========================
2956
+
2957
+ Skill Count Last Used
2958
+ ------------------------------------------------------------
2959
+ commit 42 2026-03-29 14:30:00
2960
+ review 15 2026-03-28 09:12:00
2961
+ debug 8 2026-03-27 16:45:00
2962
+
2963
+ Total invocations: 65
2964
+ Unique skills: 3
2965
+
2966
+ File: ~/.ai-toolkit/stats.json
2967
+ Reset: ai-toolkit stats --reset
2968
+ ```
2969
+
2970
+ ---
2971
+
2972
+ ## kb/reference/sync.md
2973
+
2974
+ ---
2975
+ title: "AI Toolkit - Config Sync"
2976
+ category: reference
2977
+ service: ai-toolkit
2978
+ tags: [sync, gist, portability, config, backup]
2979
+ version: "1.0.0"
2980
+ created: "2026-03-29"
2981
+ last_updated: "2026-03-29"
2982
+ description: "Sync ai-toolkit config to/from GitHub Gist for cross-machine portability."
2983
+ ---
2984
+
2985
+ # Config Sync
2986
+
2987
+ ## Overview
2988
+
2989
+ `ai-toolkit sync` exports and imports your toolkit configuration (rules, stats) via GitHub Gist or local files. Zero infrastructure — uses `gh` CLI for Gist operations.
2990
+
2991
+ ## Commands
2992
+
2993
+ ```bash
2994
+ ai-toolkit sync --export # JSON snapshot to stdout
2995
+ ai-toolkit sync --push # Create/update secret Gist
2996
+ ai-toolkit sync --pull [gist-id] # Pull from Gist and apply
2997
+ ai-toolkit sync --import <file|url> # Import from file or URL
2998
+ ```
2999
+
3000
+ ## What Gets Synced
3001
+
3002
+ | Data | Included | Source |
3003
+ |------|----------|--------|
3004
+ | Custom rules | Yes | `~/.ai-toolkit/rules/*.md` |
3005
+ | Usage stats | Yes | `~/.ai-toolkit/stats.json` |
3006
+ | Toolkit version | Yes (metadata) | `package.json` |
3007
+ | Agents/skills | No | Installed via `npm` |
3008
+ | Hooks | No | Installed via `ai-toolkit install` |
3009
+
3010
+ ## Workflow
3011
+
3012
+ ### First machine (export)
3013
+ ```bash
3014
+ ai-toolkit sync --push
3015
+ # Creates secret Gist, saves ID to ~/.ai-toolkit/.gist-id
3016
+ ```
3017
+
3018
+ ### Second machine (import)
3019
+ ```bash
3020
+ ai-toolkit sync --pull abc123def456 # Use gist ID from first push
3021
+ # Subsequent pulls: ai-toolkit sync --pull (uses saved ID)
3022
+ ```
3023
+
3024
+ ## Requirements
3025
+
3026
+ - `--export` / `--import`: No external dependencies
3027
+ - `--push` / `--pull`: Requires [gh CLI](https://cli.github.com) + `gh auth login`
3028
+
3029
+ ## JSON Schema
3030
+
3031
+ ```json
3032
+ {
3033
+ "schema_version": 1,
3034
+ "exported_at": "2026-03-29T14:00:00+00:00",
3035
+ "toolkit_version": "1.0.0",
3036
+ "rules": {
3037
+ "rule-name": "# Rule content..."
3038
+ },
3039
+ "stats": {
3040
+ "commit": { "count": 42, "last_used": "..." }
3041
+ }
3042
+ }
3043
+ ```
3044
+
3045
+ ## Security
3046
+
3047
+ - Gists are created as **secret** (not discoverable, but accessible via URL)
3048
+ - Rules may contain project-specific instructions — review before sharing
3049
+ - No credentials or tokens are stored in the snapshot
3050
+
3051
+ ---
3052
+
3053
+ ## kb/troubleshooting/README.md
3054
+
3055
+ ---
3056
+ title: "Troubleshooting"
3057
+ service: ai-toolkit
3058
+ category: troubleshooting
3059
+ tags: [troubleshooting, debugging]
3060
+ last_updated: "2026-03-25"
3061
+ ---
3062
+
3063
+ # Troubleshooting
3064
+
3065
+ Problem resolution guides. Guides will be added here as they are created.
3066
+
3067
+ ---
3068
+