@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
@@ -0,0 +1,176 @@
1
+ #!/usr/bin/env python3
2
+ """Inventory documentation files and find gaps in coverage."""
3
+
4
+ import json
5
+ import os
6
+ import re
7
+ import sys
8
+ import time
9
+ from pathlib import Path
10
+
11
+ IGNORE_DIRS = {'.git', 'node_modules', '__pycache__', '.venv', 'venv', 'dist', 'build', '.next', 'vendor', '.cache'}
12
+
13
+ SOURCE_EXTS = {'.py', '.js', '.ts', '.tsx', '.jsx', '.go', '.php', '.dart'}
14
+
15
+ STANDARD_DOCS = ['README.md', 'CHANGELOG.md', 'CONTRIBUTING.md', 'LICENSE', 'LICENSE.md']
16
+
17
+ STALE_THRESHOLD_DAYS = 90
18
+
19
+
20
+ def find_files(root: str, extensions: set) -> list:
21
+ result = []
22
+ for dirpath, dirnames, filenames in os.walk(root):
23
+ dirnames[:] = [d for d in dirnames if d not in IGNORE_DIRS]
24
+ for fn in filenames:
25
+ if Path(fn).suffix in extensions or fn in extensions:
26
+ result.append(os.path.join(dirpath, fn))
27
+ return result
28
+
29
+
30
+ def find_doc_files(root: str) -> list:
31
+ docs = []
32
+ # Check standard docs in root
33
+ for doc in STANDARD_DOCS:
34
+ p = os.path.join(root, doc)
35
+ if os.path.isfile(p):
36
+ docs.append(os.path.relpath(p, root))
37
+ # Check docs/ directory
38
+ docs_dir = os.path.join(root, 'docs')
39
+ if os.path.isdir(docs_dir):
40
+ for dirpath, dirnames, filenames in os.walk(docs_dir):
41
+ dirnames[:] = [d for d in dirnames if d not in IGNORE_DIRS]
42
+ for fn in filenames:
43
+ if fn.endswith(('.md', '.rst', '.txt', '.adoc')):
44
+ docs.append(os.path.relpath(os.path.join(dirpath, fn), root))
45
+ return docs
46
+
47
+
48
+ def count_public_symbols(filepath: str) -> tuple:
49
+ """Returns (total_public, documented_count)."""
50
+ ext = Path(filepath).suffix
51
+ total, documented = 0, 0
52
+ try:
53
+ with open(filepath, 'r', errors='replace') as f:
54
+ lines = f.readlines()
55
+ except OSError:
56
+ return 0, 0
57
+
58
+ if ext == '.py':
59
+ for i, line in enumerate(lines):
60
+ m = re.match(r'^(def|class)\s+(\w+)', line)
61
+ if m and not m.group(2).startswith('_'):
62
+ total += 1
63
+ # Check for docstring on next non-empty line
64
+ for j in range(i + 1, min(i + 4, len(lines))):
65
+ stripped = lines[j].strip()
66
+ if stripped.startswith(('"""', "'''")):
67
+ documented += 1
68
+ break
69
+ if stripped and not stripped.startswith(('#', ')')):
70
+ break
71
+
72
+ elif ext in ('.js', '.ts', '.tsx', '.jsx'):
73
+ for i, line in enumerate(lines):
74
+ if re.search(r'export\s+(function|class|const|let|interface|type|enum)\s+', line):
75
+ total += 1
76
+ # Check for JSDoc before export
77
+ for j in range(max(0, i - 5), i):
78
+ if '/**' in lines[j]:
79
+ documented += 1
80
+ break
81
+
82
+ elif ext == '.go':
83
+ for i, line in enumerate(lines):
84
+ m = re.match(r'^func\s+(?:\([^)]*\)\s+)?([A-Z]\w*)', line)
85
+ if m:
86
+ total += 1
87
+ # Check for // comment on preceding line
88
+ if i > 0 and lines[i - 1].strip().startswith('//'):
89
+ documented += 1
90
+ m = re.match(r'^type\s+([A-Z]\w*)', line)
91
+ if m:
92
+ total += 1
93
+ if i > 0 and lines[i - 1].strip().startswith('//'):
94
+ documented += 1
95
+
96
+ elif ext == '.php':
97
+ for i, line in enumerate(lines):
98
+ m = re.match(r'\s*(?:public|protected)\s+function\s+(\w+)', line)
99
+ if m and not m.group(1).startswith('_'):
100
+ total += 1
101
+ for j in range(max(0, i - 5), i):
102
+ if '/**' in lines[j]:
103
+ documented += 1
104
+ break
105
+
106
+ elif ext == '.dart':
107
+ for i, line in enumerate(lines):
108
+ m = re.match(r'^(?:class|enum)\s+(\w+)', line)
109
+ if not m:
110
+ m = re.match(r'^(\w+\s+\w+)\s*\(', line)
111
+ if m:
112
+ total += 1
113
+ for j in range(max(0, i - 5), i):
114
+ if '///' in lines[j]:
115
+ documented += 1
116
+ break
117
+
118
+ return total, documented
119
+
120
+
121
+ def get_mtime(filepath: str) -> float:
122
+ try:
123
+ return os.path.getmtime(filepath)
124
+ except OSError:
125
+ return 0.0
126
+
127
+
128
+ def main():
129
+ root = os.path.abspath(sys.argv[1]) if len(sys.argv) > 1 else os.getcwd()
130
+ if not os.path.isdir(root):
131
+ print(json.dumps({"error": f"Not a directory: {root}"}))
132
+ sys.exit(1)
133
+
134
+ existing_docs = find_doc_files(root)
135
+ missing_docs = [d for d in STANDARD_DOCS if d not in existing_docs]
136
+
137
+ # Count public symbols across source files
138
+ source_files = find_files(root, SOURCE_EXTS)
139
+ total_public, total_documented = 0, 0
140
+ latest_code_mtime = 0.0
141
+
142
+ for sf in source_files:
143
+ pub, doc = count_public_symbols(sf)
144
+ total_public += pub
145
+ total_documented += doc
146
+ mt = get_mtime(sf)
147
+ if mt > latest_code_mtime:
148
+ latest_code_mtime = mt
149
+
150
+ coverage = round((total_documented / total_public * 100), 1) if total_public > 0 else 0.0
151
+
152
+ # Check for stale docs
153
+ stale_docs = []
154
+ threshold = STALE_THRESHOLD_DAYS * 86400
155
+ for doc in existing_docs:
156
+ doc_path = os.path.join(root, doc)
157
+ doc_mtime = get_mtime(doc_path)
158
+ if latest_code_mtime > 0 and doc_mtime > 0:
159
+ if (latest_code_mtime - doc_mtime) > threshold:
160
+ days_behind = int((latest_code_mtime - doc_mtime) / 86400)
161
+ stale_docs.append({"file": doc, "days_behind_code": days_behind})
162
+
163
+ result = {
164
+ "existing_docs": existing_docs,
165
+ "missing_docs": missing_docs,
166
+ "public_functions_total": total_public,
167
+ "documented_count": total_documented,
168
+ "doc_coverage_percent": coverage,
169
+ "stale_docs": stale_docs,
170
+ }
171
+
172
+ print(json.dumps(result, indent=2))
173
+
174
+
175
+ if __name__ == '__main__':
176
+ main()
@@ -0,0 +1,36 @@
1
+ # Architecture Note: [Title]
2
+
3
+ ## Status
4
+
5
+ [Draft | Accepted | Deprecated | Superseded]
6
+
7
+ ## Context
8
+
9
+ [What is the issue that we're seeing that is motivating this decision or change?]
10
+
11
+ ## Decision
12
+
13
+ [What is the change that we're proposing and/or doing?]
14
+
15
+ ## Consequences
16
+
17
+ ### Positive
18
+ - [Benefit 1]
19
+ - [Benefit 2]
20
+
21
+ ### Negative
22
+ - [Drawback 1]
23
+ - [Drawback 2]
24
+
25
+ ### Risks
26
+ - [Risk 1 and mitigation]
27
+
28
+ ## Alternatives Considered
29
+
30
+ ### Option A: [Name]
31
+ - Pros: [...]
32
+ - Cons: [...]
33
+
34
+ ### Option B: [Name]
35
+ - Pros: [...]
36
+ - Cons: [...]
@@ -0,0 +1,67 @@
1
+ # Project Name
2
+
3
+ Brief description of what this project does.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ # Install
9
+ [installation command]
10
+
11
+ # Run
12
+ [run command]
13
+ ```
14
+
15
+ ## Features
16
+
17
+ - Feature 1
18
+ - Feature 2
19
+ - Feature 3
20
+
21
+ ## Tech Stack
22
+
23
+ | Component | Technology |
24
+ |-----------|-----------|
25
+ | Language | [e.g., Python 3.12] |
26
+ | Framework | [e.g., FastAPI] |
27
+ | Database | [e.g., PostgreSQL] |
28
+ | Cache | [e.g., Redis] |
29
+
30
+ ## Development
31
+
32
+ ### Prerequisites
33
+ - [Requirement 1]
34
+ - [Requirement 2]
35
+
36
+ ### Setup
37
+ ```bash
38
+ [setup commands]
39
+ ```
40
+
41
+ ### Testing
42
+ ```bash
43
+ [test commands]
44
+ ```
45
+
46
+ ### Linting
47
+ ```bash
48
+ [lint commands]
49
+ ```
50
+
51
+ ## Project Structure
52
+ ```
53
+ src/
54
+ [key directories and their purpose]
55
+ ```
56
+
57
+ ## API Documentation
58
+
59
+ [Link or brief description]
60
+
61
+ ## Contributing
62
+
63
+ [Contributing guidelines or link]
64
+
65
+ ## License
66
+
67
+ [License type]
@@ -0,0 +1,191 @@
1
+ ---
2
+ name: documentation-standards
3
+ description: "Loaded when creating or updating KB documents, architecture notes, SOPs, or any file in kb/ directory"
4
+ effort: medium
5
+ user-invocable: false
6
+ ---
7
+
8
+ # Documentation Standards
9
+
10
+ Auto-loaded knowledge skill enforcing KB document conventions across all agents and skills.
11
+
12
+ ## Frontmatter Specification (MANDATORY)
13
+
14
+ Every document in `kb/` MUST start with YAML frontmatter:
15
+
16
+ ```yaml
17
+ ---
18
+ title: "Document Title" # REQUIRED — English, descriptive
19
+ category: reference # REQUIRED — one of 5 valid categories
20
+ service: ai-toolkit # REQUIRED — service identifier
21
+ tags: [tag1, tag2, tag3] # REQUIRED — minimum 1, recommended 3+
22
+ last_updated: "YYYY-MM-DD" # REQUIRED — ISO format
23
+ created: "YYYY-MM-DD" # REQUIRED — creation date
24
+ description: "One-line summary." # REQUIRED — for search indexing
25
+ version: "1.0.0" # optional — semver
26
+ ---
27
+ ```
28
+
29
+ **All 7 fields above are REQUIRED.** Documents without valid frontmatter **fail `validate.sh` and block CI**.
30
+
31
+ ## Category Taxonomy
32
+
33
+ | Category | Directory | Purpose | Examples |
34
+ |----------|-----------|---------|----------|
35
+ | `reference` | `kb/reference/` | Technical specifications, catalogs, architecture notes, API docs | `agents-catalog.md`, `architecture-overview.md` |
36
+ | `howto` | `kb/howto/` | Step-by-step task guides | `use-corrective-rag.md`, `configure-mcp-server.md` |
37
+ | `procedures` | `kb/procedures/` | SOPs, runbooks, operational processes | `maintenance-sop.md`, `incident-response.md` |
38
+ | `troubleshooting` | `kb/troubleshooting/` | Problem resolution, debugging guides | `database-connection-issues.md` |
39
+ | `best-practices` | `kb/best-practices/` | Guidelines, recommendations, standards | `security-checklist.md` |
40
+
41
+ **Rule:** The `category:` frontmatter field MUST match the directory the file lives in.
42
+
43
+ ## Naming Conventions
44
+
45
+ - **Filename:** kebab-case, descriptive, no dates (`merge-friendly-install-model.md`)
46
+ - **Title:** English, clear, matches filename semantics
47
+ - **No prefixes:** no `001-`, no `YYYY-MM-DD-` in filenames (dates go in frontmatter)
48
+ - **Max length:** keep filenames under 60 characters
49
+
50
+ ## Language Rule
51
+
52
+ **All KB content MUST be in English.** No exceptions for:
53
+ - Document titles
54
+ - Body content
55
+ - Code comments within docs
56
+ - Table headers and descriptions
57
+
58
+ ## Quality Standards
59
+
60
+ ### Required for every KB document:
61
+ - [ ] Valid YAML frontmatter with all 7 required fields
62
+ - [ ] Category matches directory
63
+ - [ ] Written in English
64
+ - [ ] Title is clear and descriptive
65
+ - [ ] Content is actionable (not just placeholders)
66
+
67
+ ### Required for procedural docs (howto, procedures):
68
+ - [ ] Prerequisites listed
69
+ - [ ] Steps are numbered
70
+ - [ ] Commands are copy-pasteable
71
+ - [ ] Verification section present
72
+
73
+ ### Required for troubleshooting docs:
74
+ - [ ] Symptoms described
75
+ - [ ] Root cause identified
76
+ - [ ] Resolution steps provided
77
+ - [ ] Prevention notes included
78
+
79
+ ## Templates
80
+
81
+ ### Reference Document
82
+ ```yaml
83
+ ---
84
+ title: "AI Toolkit - [Topic]"
85
+ category: reference
86
+ service: ai-toolkit
87
+ tags: [topic, subtopic]
88
+ version: "1.0.0"
89
+ created: "YYYY-MM-DD"
90
+ last_updated: "YYYY-MM-DD"
91
+ description: "Brief summary."
92
+ ---
93
+
94
+ # [Topic]
95
+
96
+ ## Overview
97
+ [What this document covers]
98
+
99
+ ## Details
100
+ [Technical content]
101
+
102
+ ## Related
103
+ - [Other relevant KB docs]
104
+ ```
105
+
106
+ ### How-To Guide
107
+ ```yaml
108
+ ---
109
+ title: "How to [Task]"
110
+ category: howto
111
+ service: ai-toolkit
112
+ tags: [howto, task-name]
113
+ created: "YYYY-MM-DD"
114
+ last_updated: "YYYY-MM-DD"
115
+ description: "Step-by-step guide for [task]."
116
+ ---
117
+
118
+ # How to [Task]
119
+
120
+ ## Prerequisites
121
+ - [Requirement]
122
+
123
+ ## Steps
124
+
125
+ ### 1. [Action]
126
+ [Instructions + commands]
127
+
128
+ ### 2. [Action]
129
+ [Instructions + commands]
130
+
131
+ ## Verification
132
+ [How to confirm success]
133
+
134
+ ## Troubleshooting
135
+ | Problem | Solution |
136
+ |---------|----------|
137
+ | [Error] | [Fix] |
138
+ ```
139
+
140
+ ### SOP / Procedure
141
+ ```yaml
142
+ ---
143
+ title: "SOP: [Process Name]"
144
+ category: procedures
145
+ service: ai-toolkit
146
+ tags: [sop, process-name]
147
+ created: "YYYY-MM-DD"
148
+ last_updated: "YYYY-MM-DD"
149
+ description: "Standard procedure for [process]."
150
+ ---
151
+
152
+ # SOP: [Process Name]
153
+
154
+ ## Purpose
155
+ [Why this procedure exists]
156
+
157
+ ## Prerequisites
158
+ - [Requirement]
159
+
160
+ ## Procedure
161
+ ### Step 1: [Action]
162
+ [Detailed instructions]
163
+
164
+ ## Verification
165
+ [How to verify success]
166
+
167
+ ## Rollback
168
+ [How to revert if needed]
169
+ ```
170
+
171
+ ## Validation
172
+
173
+ ```bash
174
+ # Validates ALL kb/**/*.md frontmatter (title, category, service, tags, created, last_updated, description)
175
+ scripts/validate.py
176
+
177
+ # Checks: required fields present, category is valid, tags non-empty
178
+ ```
179
+
180
+ Valid categories: `reference`, `howto`, `procedures`, `troubleshooting`, `best-practices`.
181
+
182
+ ## Anti-Patterns
183
+
184
+ | Anti-Pattern | Problem | Fix |
185
+ |-------------|---------|-----|
186
+ | No frontmatter | Blocks CI, not indexed | Add frontmatter with all required fields |
187
+ | Wrong category | Confuses search | Match `category:` to directory name |
188
+ | Non-English content | Inconsistent KB | Translate to English |
189
+ | Date in filename | Clutters, becomes stale | Use `created:` in frontmatter |
190
+ | Empty tags | Hurts search relevance | Add at least 1 meaningful tag |
191
+ | Placeholder content | Wastes reader time | Write real content or don't create the doc |
@@ -0,0 +1,209 @@
1
+ ---
2
+ name: ecommerce-patterns
3
+ description: "Loaded when user asks about e-commerce or shopping cart features"
4
+ effort: medium
5
+ user-invocable: false
6
+ ---
7
+
8
+ # E-commerce Patterns Skill
9
+
10
+ ## Platform Selection
11
+
12
+ | Scenario | Platform |
13
+ |----------|----------|
14
+ | Enterprise B2B | OroCommerce |
15
+ | Enterprise B2C | Magento 2 |
16
+ | Mid-market | Shopify Plus |
17
+ | Small business | WooCommerce, PrestaShop |
18
+ | Custom/Headless | Medusa, Saleor |
19
+
20
+ ---
21
+
22
+ ## Magento 2 Patterns
23
+
24
+ ### Module Structure
25
+ ```
26
+ app/code/Vendor/Module/
27
+ ├── Api/
28
+ │ └── Data/
29
+ │ └── EntityInterface.php
30
+ ├── Block/
31
+ ├── Controller/
32
+ │ └── Index/
33
+ │ └── Index.php
34
+ ├── etc/
35
+ │ ├── module.xml
36
+ │ ├── di.xml
37
+ │ ├── routes.xml
38
+ │ └── frontend/
39
+ ├── Model/
40
+ │ └── ResourceModel/
41
+ ├── Setup/
42
+ ├── view/
43
+ │ └── frontend/
44
+ │ ├── layout/
45
+ │ └── templates/
46
+ ├── registration.php
47
+ └── composer.json
48
+ ```
49
+
50
+ ### Dependency Injection
51
+ ```xml
52
+ <!-- etc/di.xml -->
53
+ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
54
+ <preference for="Vendor\Module\Api\ServiceInterface" type="Vendor\Module\Model\Service"/>
55
+ <type name="Vendor\Module\Model\Service">
56
+ <arguments>
57
+ <argument name="logger" xsi:type="object">Psr\Log\LoggerInterface</argument>
58
+ </arguments>
59
+ </type>
60
+ </config>
61
+ ```
62
+
63
+ ### GraphQL
64
+ ```graphql
65
+ type Query {
66
+ customProducts(
67
+ search: String
68
+ pageSize: Int = 20
69
+ currentPage: Int = 1
70
+ ): CustomProductOutput @resolver(class: "Vendor\\Module\\Model\\Resolver\\Products")
71
+ }
72
+ ```
73
+
74
+ ---
75
+
76
+ ## Cart & Checkout Patterns
77
+
78
+ ### Cart State Machine
79
+ ```
80
+ Empty → Has Items → Checkout Started → Payment → Order Placed
81
+ ↑ ↓
82
+ └──── Abandoned ←────┘
83
+ ```
84
+
85
+ ### Checkout Flow
86
+ ```
87
+ 1. Cart Review
88
+ 2. Shipping Address
89
+ 3. Shipping Method
90
+ 4. Payment Method
91
+ 5. Order Review
92
+ 6. Place Order
93
+ 7. Confirmation
94
+ ```
95
+
96
+ ### Price Calculation
97
+ ```
98
+ Base Price
99
+ - Catalog Discounts
100
+ = Adjusted Price
101
+ × Quantity
102
+ = Line Total
103
+ + Tax (if exclusive)
104
+ = Line Total with Tax
105
+ Σ All Lines
106
+ = Subtotal
107
+ + Shipping
108
+ - Cart Discounts
109
+ = Grand Total
110
+ ```
111
+
112
+ ---
113
+
114
+ ## Inventory Patterns
115
+
116
+ ### Stock Management
117
+ ```python
118
+ class InventoryService:
119
+ def reserve_stock(self, product_id: str, qty: int) -> bool:
120
+ """Reserve stock during checkout."""
121
+ with transaction.atomic():
122
+ stock = Stock.select_for_update().get(product_id=product_id)
123
+ if stock.available >= qty:
124
+ stock.reserved += qty
125
+ stock.available -= qty
126
+ stock.save()
127
+ return True
128
+ return False
129
+
130
+ def confirm_stock(self, reservation_id: str):
131
+ """Confirm reservation after order placed."""
132
+ reservation.status = 'confirmed'
133
+ reservation.save()
134
+
135
+ def release_stock(self, reservation_id: str):
136
+ """Release stock if order cancelled."""
137
+ # Return reserved qty to available
138
+ ```
139
+
140
+ ### Multi-Warehouse
141
+ ```sql
142
+ -- Stock per warehouse
143
+ SELECT
144
+ p.sku,
145
+ w.name as warehouse,
146
+ s.quantity,
147
+ s.reserved
148
+ FROM stock s
149
+ JOIN products p ON s.product_id = p.id
150
+ JOIN warehouses w ON s.warehouse_id = w.id
151
+ WHERE p.sku = 'SKU-123';
152
+ ```
153
+
154
+ ---
155
+
156
+ ## Search & Catalog
157
+
158
+ ### Product Indexing
159
+ ```
160
+ Product → Indexer → Search Index (Elasticsearch/OpenSearch)
161
+ → Price Index
162
+ → Category Index
163
+ → Stock Index
164
+ ```
165
+
166
+ ### Faceted Search
167
+ ```json
168
+ {
169
+ "aggs": {
170
+ "categories": {
171
+ "terms": { "field": "category_ids" }
172
+ },
173
+ "price_ranges": {
174
+ "range": {
175
+ "field": "price",
176
+ "ranges": [
177
+ { "to": 50 },
178
+ { "from": 50, "to": 100 },
179
+ { "from": 100 }
180
+ ]
181
+ }
182
+ },
183
+ "brands": {
184
+ "terms": { "field": "brand" }
185
+ }
186
+ }
187
+ }
188
+ ```
189
+
190
+ ---
191
+
192
+ ## Performance
193
+
194
+ ### Caching Layers
195
+ | Layer | Cache |
196
+ |-------|-------|
197
+ | Page | Varnish, CDN |
198
+ | Block | Redis |
199
+ | Query | MySQL Query Cache |
200
+ | Full Page | Redis FPC |
201
+
202
+ ### Optimization Checklist
203
+ - [ ] Enable production mode
204
+ - [ ] Enable full page cache
205
+ - [ ] Optimize images (WebP)
206
+ - [ ] Minify JS/CSS
207
+ - [ ] Enable flat tables
208
+ - [ ] Configure CDN
209
+ - [ ] Index optimization