@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,149 @@
1
+ ---
2
+ name: repeat
3
+ description: "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."
4
+ user-invocable: true
5
+ effort: medium
6
+ argument-hint: "[interval] [command or prompt] (e.g., /repeat 5m /test, defaults to 10m)"
7
+ allowed-tools: Read, Write, Edit, Grep, Glob, Bash, Agent
8
+ ---
9
+
10
+ # /repeat - Autonomous Recurring Execution
11
+
12
+ $ARGUMENTS
13
+
14
+ ## Argument Parsing
15
+
16
+ Parse the user input into three components:
17
+
18
+ 1. **Interval** — duration between iterations (default: `10m`)
19
+ - Accepts: `1m`, `5m`, `10m`, `30m`, `1h`
20
+ - Minimum: `1m` (enforced, reject anything lower)
21
+ 2. **Command or prompt** — the slash command or freeform prompt to execute each iteration
22
+ 3. **Flags**:
23
+ - `--iterations N` — maximum number of iterations (default: `5`)
24
+
25
+ Examples of parsed input:
26
+ - `/repeat 5m /test` -> interval=5m, command=/test, iterations=5
27
+ - `/repeat 10m "check deploy status"` -> interval=10m, command="check deploy status", iterations=5
28
+ - `/repeat --iterations 3 /review` -> interval=10m, command=/review, iterations=3
29
+ - `/repeat 2m --iterations 10 /lint` -> interval=2m, command=/lint, iterations=10
30
+
31
+ ## Safety Controls
32
+
33
+ These limits are constitutionally mandated (Article I, Section 4). Violating them is not permitted.
34
+
35
+ ### Max Iterations
36
+ - Default: **5** iterations
37
+ - Configurable via `--iterations N`
38
+ - Hard ceiling: the loop MUST terminate after N iterations regardless of outcome
39
+
40
+ ### Circuit Breaker
41
+ - Track consecutive failures (non-zero exit code, error output, exceptions)
42
+ - **3 consecutive failures** -> immediate hard stop
43
+ - Reset the failure counter on any successful iteration
44
+
45
+ ### Minimum Interval
46
+ - **Never** execute faster than 1 minute between iterations
47
+ - If user requests `<1m`, override to `1m` and warn
48
+
49
+ ### Exit Detection
50
+ After each iteration, inspect the output for completion signals:
51
+ - Exit code `0` combined with success markers
52
+ - Output contains: `DONE`, `COMPLETE`, `ALL PASS`, `ALL TESTS PASSED`, `SUCCESS`
53
+ - Case-insensitive matching
54
+ - If detected: stop the loop early and report success
55
+
56
+ ## Execution Protocol
57
+
58
+ ```
59
+ For iteration = 1 to max_iterations:
60
+ 1. Log iteration start (timestamp, iteration number)
61
+ 2. Execute the command or prompt
62
+ 3. Capture output and exit status
63
+ 4. Check exit detection:
64
+ - If completion marker found -> STOP, report success
65
+ 5. Check circuit breaker:
66
+ - If failure: increment consecutive_failures
67
+ - If success: reset consecutive_failures to 0
68
+ - If consecutive_failures >= 3 -> HARD STOP, report failure
69
+ 6. Log iteration result to stats
70
+ 7. If not last iteration: wait for interval duration
71
+ 8. Repeat
72
+
73
+ After loop ends:
74
+ - Print summary: total iterations, pass/fail counts, elapsed time
75
+ - Final status: COMPLETED | EARLY_SUCCESS | CIRCUIT_BREAKER | MAX_ITERATIONS
76
+ ```
77
+
78
+ ## Stats Logging
79
+
80
+ Each iteration MUST be logged to `~/.ai-toolkit/stats.json`:
81
+
82
+ ```json
83
+ {
84
+ "loop_runs": [
85
+ {
86
+ "id": "loop-<timestamp>",
87
+ "command": "/test",
88
+ "interval": "5m",
89
+ "max_iterations": 5,
90
+ "started_at": "2026-04-01T10:00:00Z",
91
+ "iterations": [
92
+ {
93
+ "number": 1,
94
+ "timestamp": "2026-04-01T10:00:00Z",
95
+ "result": "pass",
96
+ "exit_code": 0,
97
+ "summary": "All 42 tests passed"
98
+ },
99
+ {
100
+ "number": 2,
101
+ "timestamp": "2026-04-01T10:05:00Z",
102
+ "result": "fail",
103
+ "exit_code": 1,
104
+ "summary": "3 tests failed"
105
+ }
106
+ ],
107
+ "final_status": "EARLY_SUCCESS",
108
+ "ended_at": "2026-04-01T10:10:00Z"
109
+ }
110
+ ]
111
+ }
112
+ ```
113
+
114
+ Ensure the stats directory and file exist before writing. Append to existing data, never overwrite.
115
+
116
+ ## Usage Examples
117
+
118
+ ```bash
119
+ # Run tests every 5 minutes until all pass (max 5 iterations)
120
+ /repeat 5m /test
121
+
122
+ # Poll deployment status every 10 minutes
123
+ /repeat 10m "check deploy status"
124
+
125
+ # Run review max 3 times at default interval
126
+ /repeat --iterations 3 /review
127
+
128
+ # Lint every 2 minutes, up to 10 times
129
+ /repeat 2m --iterations 10 /lint
130
+
131
+ # Monitor CI pipeline every 5 minutes
132
+ /repeat 5m "check if CI pipeline passed for current branch"
133
+ ```
134
+
135
+ ## When to Use
136
+
137
+ - Polling deployment or CI/CD pipeline status
138
+ - Running tests repeatedly until green
139
+ - Monitoring an external process for completion
140
+ - Retrying a flaky operation with intervals
141
+ - Watching for a condition to become true
142
+
143
+ ## When NOT to Use
144
+
145
+ - Anything requiring human judgment between iterations
146
+ - Tasks where each iteration depends on user feedback
147
+ - Long-running computations that should be a single background job
148
+ - Destructive operations (deletes, drops, force pushes) -- never loop these
149
+ - Intervals shorter than 1 minute -- use a proper scheduler instead
@@ -0,0 +1,56 @@
1
+ ---
2
+ name: research-mastery
3
+ description: "Loaded when user asks to research, verify, or synthesize information"
4
+ effort: medium
5
+ user-invocable: false
6
+ ---
7
+
8
+ # Research Mastery Skill
9
+
10
+ You are not a guessing machine. You are an information retrieval engine.
11
+
12
+ ## 🔴 The Hierarchy of Truth (Strict Order)
13
+
14
+ You MUST search in this order. Do not skip steps.
15
+
16
+ ### 1. Local Knowledge (RAG-MCP)
17
+ **Source of Truth**: The project's Knowledge Base (`kb/`).
18
+ **Tool**: `smart_query(query)` (Standard) OR `crag_search(query)` (High Precision)
19
+ **Why**: This is YOUR project context. It overrides everything else.
20
+ **Protocol**:
21
+ 1. Try `smart_query("task context")`.
22
+ 2. **CRITIC (Self-Correction)**:
23
+ - "Did the docs answer the specific question?"
24
+ - **If NO**: Use `crag_search(query, relevance_threshold=0.7)`.
25
+ - **If STILL NO**:
26
+ 1. **LOG GAP**: Append query to `kb/gaps.log`
27
+ 2. Proceed to Step 2.
28
+
29
+ ### 2. Context7 (External MCPs)
30
+ **Source of Truth**: Connected MCP servers (e.g., databases, external APIs).
31
+ **Tool**: `use_mcp_tool(...)`
32
+ **Why**: Live data from the environment.
33
+
34
+ ### 3. External Search (Internet)
35
+ **Source of Truth**: The Web.
36
+ **Tool**: `search_web(query)`
37
+ **Why**: For documentation of public libraries not in KB.
38
+ **Rule**: ONLY if Step 1 & 2 yield nothing.
39
+
40
+ ### 4. Built-in Knowledge (LLM Training)
41
+ **Source of Truth**: Your training data.
42
+ **Why**: Fallback for general programming concepts.
43
+ **Rule**: Use only for generic syntax/logic, NEVER for project specifics.
44
+
45
+ ## 🛑 Validation Protocol
46
+ Before acting on information:
47
+ 1. **Cite the Source**: "According to `kb/architecture.md`..."
48
+ 2. **Verify Freshness**: Is the doc from 2023 or 2025?
49
+ 3. **Cross-Reference**: Does the code match the doc?
50
+
51
+ ## Example Workflow
52
+ Task: "Fix the login bug."
53
+ 1. `smart_query("login architecture")` -> Found `kb/auth/login_flow.md`.
54
+ 2. `smart_query("known login bugs")` -> Found nothing.
55
+ 3. Code analysis of `src/auth/Login.ts`.
56
+ 4. Fix implemented based on `login_flow.md`.
@@ -0,0 +1,141 @@
1
+ ---
2
+ name: review
3
+ description: "Review code for quality, security, and correctness"
4
+ user-invocable: true
5
+ effort: high
6
+ argument-hint: "[target: branch, pr, file path, or staged changes]"
7
+ agent: code-reviewer
8
+ context: fork
9
+ allowed-tools: Read, Grep, Glob, Bash
10
+ ---
11
+
12
+ # Code Review
13
+
14
+ $ARGUMENTS
15
+
16
+ Reviews code changes for quality and issues.
17
+
18
+ ## Changed files context
19
+
20
+ - Changes: !`git diff --stat main...HEAD 2>/dev/null || git diff --cached --stat 2>/dev/null || echo "no changes detected"`
21
+
22
+ ## Automated Diff Analysis
23
+
24
+ Before starting manual review, run the diff analyzer script to get a structured risk assessment:
25
+
26
+ ```bash
27
+ python3 "$(dirname "$0")/scripts/diff-analyzer.py" [base_branch]
28
+ # Default base branch: main
29
+ # Example: python3 scripts/diff-analyzer.py develop
30
+ ```
31
+
32
+ The script outputs JSON with:
33
+ - **files**: each changed file with additions, deletions, category (security/test/config/migration/infra/docs/logic), and risk level
34
+ - **risk_score**: overall assessment (high/medium/low)
35
+ - **hotspots**: top 5 files by additions
36
+ - **secrets_scan**: potential secret leaks detected in added lines
37
+ - **test_coverage_estimate**: whether test files accompany logic changes (good/partial/none)
38
+ - **parallel_review_recommended**: boolean flag
39
+
40
+ If the script reports `parallel_review_recommended: true`, use the Parallel Review (Agent Teams) mode below.
41
+
42
+ ---
43
+
44
+ ## Parallel Review (Agent Teams)
45
+
46
+ For significant PRs or large changesets, create a parallel review team:
47
+
48
+ ```
49
+ Create an agent team to review [target]:
50
+ - Teammate 1 (security-auditor): "Review for security vulnerabilities, auth issues,
51
+ injection risks, secret leaks. Report with severity ratings." Use Opus.
52
+ - Teammate 2 (performance-optimizer): "Check for N+1 queries, memory leaks,
53
+ unnecessary allocations, caching opportunities. Report with impact ratings." Use Opus.
54
+ - Teammate 3 (test-engineer): "Validate test coverage, edge cases, mock quality,
55
+ missing assertions. Report coverage gaps." Use Opus.
56
+ Each reviewer should report findings independently. Do NOT modify files.
57
+ ```
58
+
59
+ After all reviewers complete:
60
+ 1. Synthesize findings into unified Code Review Report
61
+ 2. Prioritize by severity (Critical > Major > Minor)
62
+ 3. Issue verdict: APPROVE / REQUEST_CHANGES / NEEDS_DISCUSSION
63
+
64
+ > **When to use**: PRs with >5 files changed, cross-module changes, security-sensitive code.
65
+ > **READ-ONLY**: No teammate should modify files during review.
66
+
67
+ ---
68
+
69
+ ## Sequential Review (Default)
70
+
71
+ 1. **Reads** changed files
72
+ 2. **Analyzes** for issues
73
+ 3. **Checks** best practices
74
+ 4. **Reports** findings
75
+
76
+ ## Review Scope
77
+
78
+ | Target | What's Reviewed |
79
+ |--------|-----------------|
80
+ | (none) | Staged changes |
81
+ | `branch` | Branch vs main |
82
+ | `pr` | Pull request changes |
83
+ | `file.ts` | Specific file |
84
+
85
+ ## Review Checklist
86
+
87
+ ### Code Quality
88
+ - [ ] Clear naming
89
+ - [ ] Proper error handling
90
+ - [ ] No code duplication
91
+ - [ ] Appropriate abstractions
92
+
93
+ ### Security
94
+ - [ ] No hardcoded secrets
95
+ - [ ] Input validation
96
+ - [ ] Proper auth checks
97
+ - [ ] SQL injection prevention
98
+
99
+ ### Performance
100
+ - [ ] No N+1 queries
101
+ - [ ] Appropriate caching
102
+ - [ ] No memory leaks
103
+ - [ ] Optimized loops
104
+
105
+ ### Testing
106
+ - [ ] Tests for new code
107
+ - [ ] Edge cases covered
108
+ - [ ] Mocks appropriate
109
+
110
+ ## Output Format
111
+
112
+ ```markdown
113
+ ## Code Review Report
114
+
115
+ ### Summary
116
+ - **Files Changed**: [count]
117
+ - **Lines Added**: [+count]
118
+ - **Lines Removed**: [-count]
119
+ - **Issues Found**: [count]
120
+
121
+ ### Findings
122
+
123
+ #### Critical
124
+ - **[file:line]**: [issue]
125
+ - [explanation]
126
+ - Suggested fix: [code]
127
+
128
+ #### Suggestions
129
+ - **[file:line]**: [suggestion]
130
+ - [explanation]
131
+
132
+ ### Positive Notes
133
+ - [What's good about the code]
134
+
135
+ ### Verdict
136
+ [APPROVE / REQUEST_CHANGES / NEEDS_DISCUSSION]
137
+ ```
138
+
139
+ ## READ-ONLY
140
+
141
+ This skill only analyzes. It does NOT modify any files.
@@ -0,0 +1,170 @@
1
+ #!/usr/bin/env python3
2
+ """Analyze a git diff for risk assessment, file categorization, and secrets detection.
3
+
4
+ Compares the current branch against a base branch (default ``main``),
5
+ categorises each changed file (security, test, config, migration,
6
+ infra, docs, logic), scans added lines for potential secrets, computes
7
+ a composite risk score, and outputs a JSON report suitable for
8
+ pre-review triage.
9
+
10
+ Usage::
11
+
12
+ python3 diff-analyzer.py [base_branch]
13
+ # Default base branch: main
14
+ """
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import re
19
+ import subprocess
20
+ import sys
21
+ from typing import Any
22
+
23
+
24
+ CATEGORY_PATTERNS: dict[str, str] = {
25
+ "security": r"(auth|login|password|token|secret|crypto|session|permission|role|access)",
26
+ "test": r"(test_|_test\.|spec\.|\.test\.|__tests__|tests/)",
27
+ "config": r"(\.(yml|yaml|json|toml|env|ini|cfg)$|config|settings|\.lock$)",
28
+ "migration": r"(migration|alembic|schema|migrate)",
29
+ "infra": r"(docker|kubernetes|k8s|terraform|ansible|ci|deploy|\.github)",
30
+ "docs": r"(readme|changelog|docs/|\.md$|license)",
31
+ }
32
+
33
+ SECRET_PATTERNS: list[str] = [
34
+ r'(?i)(api[_-]?key|secret[_-]?key|password|token|bearer)\s*[=:]\s*["\'][^"\']{8,}',
35
+ r"AKIA[0-9A-Z]{16}",
36
+ r"sk-[a-zA-Z0-9]{20,}",
37
+ r"ghp_[a-zA-Z0-9]{36}",
38
+ ]
39
+
40
+
41
+ def categorize(path: str) -> str:
42
+ """Categorize a file path into a review domain.
43
+
44
+ Args:
45
+ path: Relative file path from the diff.
46
+
47
+ Returns:
48
+ Category name (``"security"``, ``"test"``, ``"config"``,
49
+ ``"migration"``, ``"infra"``, ``"docs"``, or ``"logic"``).
50
+ """
51
+ for cat, pattern in CATEGORY_PATTERNS.items():
52
+ if re.search(pattern, path, re.IGNORECASE):
53
+ return cat
54
+ return "logic"
55
+
56
+
57
+ def main() -> None:
58
+ """Entry point: analyze diff and print JSON risk report to stdout."""
59
+ base = sys.argv[1] if len(sys.argv) > 1 else "main"
60
+
61
+ # Get diff stats (try base...HEAD first, fall back to --cached)
62
+ r = subprocess.run(
63
+ ["git", "diff", "--numstat", f"{base}...HEAD"],
64
+ stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, text=True,
65
+ )
66
+ if r.returncode != 0:
67
+ r = subprocess.run(
68
+ ["git", "diff", "--numstat", "--cached"],
69
+ capture_output=True, text=True,
70
+ )
71
+ diff_stat = r.stdout.strip()
72
+ files: list[dict[str, Any]] = []
73
+ total_add, total_del = 0, 0
74
+
75
+ for line in diff_stat.split("\n"):
76
+ if not line.strip():
77
+ continue
78
+ parts = line.split("\t")
79
+ if len(parts) < 3:
80
+ continue
81
+ add = int(parts[0]) if parts[0] != "-" else 0
82
+ delete = int(parts[1]) if parts[1] != "-" else 0
83
+ path = parts[2]
84
+ cat = categorize(path)
85
+ if cat in ("security", "migration") or add > 100:
86
+ risk = "high"
87
+ elif add > 30:
88
+ risk = "medium"
89
+ else:
90
+ risk = "low"
91
+ files.append(
92
+ {
93
+ "path": path,
94
+ "additions": add,
95
+ "deletions": delete,
96
+ "category": cat,
97
+ "risk": risk,
98
+ }
99
+ )
100
+ total_add += add
101
+ total_del += delete
102
+
103
+ # Category summary
104
+ categories: dict[str, int] = {}
105
+ for f in files:
106
+ categories[f["category"]] = categories.get(f["category"], 0) + 1
107
+
108
+ # Hotspots - files with most additions
109
+ hotspots: list[str] = [
110
+ f"{f['path']} - {f['additions']} lines added ({f['category']})"
111
+ for f in sorted(files, key=lambda x: x["additions"], reverse=True)[:5]
112
+ if f["additions"] > 20
113
+ ]
114
+
115
+ # Secrets scan on added lines (try base...HEAD first, fall back to --cached)
116
+ r = subprocess.run(
117
+ ["git", "diff", f"{base}...HEAD"],
118
+ stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, text=True,
119
+ )
120
+ if r.returncode != 0:
121
+ r = subprocess.run(
122
+ ["git", "diff", "--cached"],
123
+ capture_output=True, text=True,
124
+ )
125
+ diff_content = r.stdout.strip()
126
+ secrets: list[dict[str, Any]] = []
127
+ for i, line in enumerate(diff_content.split("\n")):
128
+ if line.startswith("+") and not line.startswith("+++"):
129
+ for p in SECRET_PATTERNS:
130
+ if re.search(p, line):
131
+ secrets.append({"line": i, "preview": line[:80]})
132
+
133
+ # Risk score
134
+ has_security = any(f["category"] == "security" for f in files)
135
+ has_migration = any(f["category"] == "migration" for f in files)
136
+ if has_security or has_migration or secrets or len(files) > 20:
137
+ risk_score = "high"
138
+ elif len(files) > 10 or total_add > 500:
139
+ risk_score = "medium"
140
+ else:
141
+ risk_score = "low"
142
+
143
+ # Test coverage estimate
144
+ test_file_count = sum(1 for f in files if f["category"] == "test")
145
+ logic_files = sum(1 for f in files if f["category"] == "logic")
146
+ if test_file_count >= logic_files and logic_files > 0:
147
+ coverage = "good"
148
+ elif test_file_count > 0:
149
+ coverage = "partial"
150
+ else:
151
+ coverage = "none"
152
+
153
+ result: dict[str, Any] = {
154
+ "base": base,
155
+ "files_changed": len(files),
156
+ "additions": total_add,
157
+ "deletions": total_del,
158
+ "files": files,
159
+ "categories": categories,
160
+ "risk_score": risk_score,
161
+ "hotspots": hotspots,
162
+ "test_coverage_estimate": coverage,
163
+ "secrets_scan": secrets,
164
+ "parallel_review_recommended": risk_score == "high" or len(files) > 10,
165
+ }
166
+ print(json.dumps(result, indent=2))
167
+
168
+
169
+ if __name__ == "__main__":
170
+ main()
@@ -0,0 +1,87 @@
1
+ ---
2
+ name: rollback
3
+ description: "Roll back a deployment safely with verification"
4
+ effort: medium
5
+ disable-model-invocation: true
6
+ argument-hint: "[target: git/db/deploy]"
7
+ allowed-tools: Bash, Read
8
+ hooks:
9
+ PostToolUse:
10
+ - matcher: "Bash"
11
+ hooks:
12
+ - type: command
13
+ command: "echo 'Reminder: verify rollback was successful and services are healthy'"
14
+ scripts:
15
+ - scripts/rollback_info.py
16
+ ---
17
+
18
+ # /rollback - Safe Rollback
19
+
20
+ $ARGUMENTS
21
+
22
+ ## What This Command Does
23
+
24
+ Safely revert changes with appropriate safety checks and confirmation.
25
+
26
+ ## Rollback Types
27
+
28
+ ### 1. Git Rollback
29
+ ```bash
30
+ # Revert last commit (creates new commit)
31
+ git revert HEAD --no-edit
32
+
33
+ # Revert specific commit
34
+ git revert <commit-sha> --no-edit
35
+
36
+ # Revert to specific state (CAUTION)
37
+ git reset --soft <commit-sha> # Keep changes staged
38
+ ```
39
+
40
+ ### 2. Database Migration Rollback
41
+
42
+ | Tool | Command |
43
+ |------|---------|
44
+ | Alembic | `alembic downgrade -1` |
45
+ | Prisma | `npx prisma migrate resolve --rolled-back <name>` |
46
+ | Laravel | `php artisan migrate:rollback --step=1` |
47
+ | Django | `python manage.py migrate <app> <previous>` |
48
+ | Flyway | `flyway undo` |
49
+
50
+ ### 3. Deployment Rollback
51
+
52
+ | Platform | Command |
53
+ |----------|---------|
54
+ | Kubernetes | `kubectl rollout undo deployment/<name>` |
55
+ | Docker Compose | `docker compose up -d --force-recreate` (with previous image tag) |
56
+ | Heroku | `heroku rollback` |
57
+
58
+ ## Gather Rollback Context
59
+
60
+ Run the rollback info script to assess current state before rolling back:
61
+ ```bash
62
+ bash scripts/rollback_info.py
63
+ ```
64
+
65
+ Returns JSON with:
66
+ - `git{}` - current/previous commit, branch, commits ahead, uncommitted changes
67
+ - `migrations{}` - detected tool (alembic/prisma/laravel/django/drizzle), rollback command
68
+ - `docker{}` - running services and image tags
69
+
70
+ ## Safety Checks (MANDATORY)
71
+
72
+ Before any rollback:
73
+ 1. Confirm what will be reverted (show diff/plan)
74
+ 2. Check for dependent changes that may break
75
+ 3. Verify backup exists (for database rollbacks)
76
+ 4. Get explicit user confirmation
77
+
78
+ ## Usage Examples
79
+
80
+ ```
81
+ /rollback # Interactive - asks what to rollback
82
+ /rollback git last # Revert last git commit
83
+ /rollback migration # Rollback last database migration
84
+ /rollback deploy # Rollback to previous deployment
85
+ ```
86
+
87
+ > **CRITICAL: Always confirm with the user before executing destructive rollback operations.**