@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,136 @@
1
+ ---
2
+ name: debugging-tactics
3
+ description: "Loaded when user is debugging an issue or needs root cause analysis"
4
+ effort: medium
5
+ user-invocable: false
6
+ allowed-tools: Bash, Grep, Read
7
+ ---
8
+
9
+ # Debugging Tactics Skill
10
+
11
+ ## The Iron Law
12
+
13
+ ```
14
+ NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
15
+ ```
16
+
17
+ If you haven't completed Phase 1 (Root Cause Investigation), you cannot propose fixes.
18
+
19
+ Random fixes waste time and create new bugs. Quick patches mask underlying issues.
20
+
21
+ **Violating the letter of this process is violating the spirit of debugging.**
22
+
23
+ ## The Four Phases
24
+
25
+ You MUST complete each phase before proceeding to the next.
26
+
27
+ ### Phase 1: Root Cause Investigation
28
+
29
+ **BEFORE attempting ANY fix:**
30
+
31
+ 1. **Read Error Messages Carefully**
32
+ - Don't skip past errors or warnings — they often contain the answer
33
+ - Read stack traces completely
34
+ - Note line numbers, file paths, error codes
35
+
36
+ 2. **Reproduce Consistently**
37
+ - Can you trigger it reliably?
38
+ - What are the exact steps?
39
+ - If not reproducible, gather more data — don't guess
40
+
41
+ 3. **Check Recent Changes**
42
+ - `git diff`, recent commits, new dependencies
43
+ - Config changes, environmental differences
44
+
45
+ 4. **Gather Evidence in Multi-Component Systems**
46
+ For each component boundary: log what enters, log what exits, verify state at each layer.
47
+ Run once to gather evidence showing WHERE it breaks, THEN investigate that specific component.
48
+
49
+ 5. **Trace Data Flow**
50
+ Where does the bad value originate? Trace backward through call stack to the source. Fix at source, not at symptom.
51
+
52
+ ### Phase 2: Pattern Analysis
53
+
54
+ 1. **Find Working Examples** — locate similar working code in same codebase
55
+ 2. **Compare Against References** — read reference implementations COMPLETELY, not skimming
56
+ 3. **Identify Differences** — list every difference, however small
57
+ 4. **Understand Dependencies** — what other components, settings, config does this need?
58
+
59
+ ### Phase 3: Hypothesis and Testing
60
+
61
+ 1. **Form Single Hypothesis** — "I think X is the root cause because Y" (be specific)
62
+ 2. **Test Minimally** — smallest possible change, one variable at a time
63
+ 3. **Verify Before Continuing** — did it work? If not, form NEW hypothesis. Don't add more fixes on top.
64
+
65
+ ### Phase 4: Implementation
66
+
67
+ 1. **Create Failing Test Case** — MUST have before fixing (use TDD skill)
68
+ 2. **Implement Single Fix** — address root cause, ONE change at a time, no "while I'm here" improvements
69
+ 3. **Verify Fix** — test passes? No regressions? Issue resolved?
70
+ 4. **If Fix Doesn't Work** — count your attempts:
71
+ - If < 3: Return to Phase 1, re-analyze with new information
72
+ - **If >= 3: STOP and question the architecture** (see below)
73
+
74
+ ### Architecture Escalation (3+ Failed Fixes)
75
+
76
+ **Pattern indicating architectural problem:**
77
+ - Each fix reveals new shared state/coupling in different places
78
+ - Fixes require "massive refactoring" to implement
79
+ - Each fix creates new symptoms elsewhere
80
+
81
+ **STOP and question fundamentals:**
82
+ - Is this pattern fundamentally sound?
83
+ - Should we refactor architecture vs. continue fixing symptoms?
84
+ - Discuss with user before attempting more fixes
85
+
86
+ This is NOT a failed hypothesis — this is a wrong architecture.
87
+
88
+ ## Red Flags — STOP and Follow Process
89
+
90
+ | Excuse | Reality |
91
+ |--------|---------|
92
+ | "Quick fix for now, investigate later" | Systematic is faster than thrashing |
93
+ | "Just try changing X and see" | One variable at a time, with hypothesis |
94
+ | "I'll skip the test, I'll manually verify" | Untested fixes don't stick |
95
+ | "It's probably X, let me fix that" | Seeing symptoms is not understanding root cause |
96
+ | "One more fix attempt" (after 2+) | 3+ failures = architectural problem. STOP. |
97
+ | "Here are the main problems: [list]" | You're proposing fixes without investigation |
98
+
99
+ ## Legacy Reference
100
+
101
+ ## Language-Specific Tactics
102
+
103
+ ### Python
104
+ - **Debugger**: `import pdb; pdb.set_trace()` (or `ipdb`)
105
+ - **Trace**: `traceback.print_stack()`
106
+ - **Memory**: `tracemalloc` for leaks.
107
+ ```python
108
+ import tracemalloc
109
+ tracemalloc.start()
110
+ # ... code ...
111
+ snapshot = tracemalloc.take_snapshot()
112
+ top_stats = snapshot.statistics('lineno')
113
+ ```
114
+
115
+ ### Node.js / TypeScript
116
+ - **Debugger**: `node --inspect-brk app.js` -> Open `chrome://inspect`.
117
+ - **Memory**: `heapdump` or built-in inspector.
118
+ - **Async Traces**: Ensure `Error.stackTraceLimit = Infinity`.
119
+
120
+ ### PHP (Laravel/Symfony)
121
+ - **Debugger**: Xdebug (`xdebug_break()`).
122
+ - **Logs**: `Log::info('State:', $data);`.
123
+ - **Query Log**: `DB::enableQueryLog(); ... dd(DB::getQueryLog());`.
124
+
125
+ ### Flutter / Dart
126
+ - **Debugger**: `debugger()` statement.
127
+ - **Inspector**: Flutter DevTools (Widget Inspector).
128
+ - **Network**: Network tab in DevTools for API calls.
129
+
130
+ ## "5 Whys" Root Cause Analysis
131
+ Ask "Why?" 5 times to find the real issue:
132
+ - "The app crashed." -> Why? -> "Null pointer exception."
133
+ - -> Why? -> "User object was null."
134
+ - -> Why? -> "API returned 404."
135
+ - -> Why? -> "User ID was invalid."
136
+ - -> Why? -> "Frontend validation allowed negative IDs." (ROOT CAUSE)
@@ -0,0 +1,130 @@
1
+ ---
2
+ name: deploy
3
+ description: "Deploy with pre-flight checks and health verification"
4
+ effort: medium
5
+ disable-model-invocation: true
6
+ argument-hint: "[environment]"
7
+ allowed-tools: Bash, Read
8
+ hooks:
9
+ PostToolUse:
10
+ - matcher: "Bash"
11
+ hooks:
12
+ - type: command
13
+ command: "echo 'Reminder: verify health checks pass after deployment'"
14
+ scripts:
15
+ - scripts/pre_deploy_check.py
16
+ ---
17
+
18
+ # Deploy Application
19
+
20
+ $ARGUMENTS
21
+
22
+ Deploy application to target environment.
23
+
24
+ ## Project context
25
+
26
+ - Docker config: !`cat docker-compose.yml 2>/dev/null || cat Dockerfile 2>/dev/null || echo "no-docker"`
27
+
28
+ ## Usage
29
+
30
+ ```
31
+ /deploy [environment]
32
+ ```
33
+
34
+ ## What This Command Does
35
+
36
+ 1. **Validates** deployment prerequisites
37
+ 2. **Runs** pre-deployment checks
38
+ 3. **Executes** deployment
39
+ 4. **Verifies** deployment success
40
+
41
+ ## Environments
42
+
43
+ | Environment | Description |
44
+ |-------------|-------------|
45
+ | `dev` | Development environment |
46
+ | `staging` | Staging/QA environment |
47
+ | `prod` | Production environment |
48
+
49
+ ## Pre-Deployment Checklist
50
+
51
+ Run automated pre-deployment checks:
52
+ ```bash
53
+ python3 scripts/pre_deploy_check.py [environment]
54
+ ```
55
+
56
+ Returns JSON with pass/fail for each check:
57
+ - `git_clean` - no uncommitted changes
58
+ - `branch` - on main/master for production
59
+ - `docker` - services running (if applicable)
60
+ - `env_file` - .env or .env.$ENV exists
61
+ - `build_artifacts` - dist/build present
62
+ - `tests_ran` - test result artifacts found
63
+
64
+ Manual verification:
65
+ - [ ] Tests passing
66
+ - [ ] Build successful
67
+ - [ ] Environment variables set
68
+ - [ ] Secrets configured
69
+ - [ ] Database migrations ready
70
+ - [ ] Rollback plan documented
71
+
72
+ ## Deployment Strategies
73
+
74
+ | Strategy | Use Case |
75
+ |----------|----------|
76
+ | Rolling | Zero-downtime, gradual |
77
+ | Blue-Green | Instant switch, easy rollback |
78
+ | Canary | Risk mitigation, gradual traffic |
79
+ | Recreate | Simple, allows downtime |
80
+
81
+ ## Output Format
82
+
83
+ ```markdown
84
+ ## Deployment Report
85
+
86
+ ### Status: Success / Failed
87
+
88
+ ### Details
89
+ - **Environment**: [env]
90
+ - **Version**: [version]
91
+ - **Started**: [timestamp]
92
+ - **Completed**: [timestamp]
93
+
94
+ ### Steps
95
+ 1. [Step 1] - Done
96
+ 2. [Step 2] - Done
97
+ 3. [Step 3] - Failed (if failed)
98
+
99
+ ### Health Check
100
+ - [endpoint]: [status]
101
+
102
+ ### Rollback
103
+ If needed: `[rollback command]`
104
+ ```
105
+
106
+ ## PRODUCTION SAFETY
107
+
108
+ - Always deploy to staging first
109
+ - Verify health checks pass
110
+ - Have rollback plan ready
111
+ - Monitor after deployment
112
+
113
+ ## MANDATORY: Documentation Update
114
+
115
+ After deployment, update documentation:
116
+
117
+ ### Required Updates
118
+ | Change Type | Update |
119
+ |-------------|--------|
120
+ | New release | CHANGELOG, release notes |
121
+ | Config changes | Deployment docs, procedures |
122
+ | New features | User documentation |
123
+ | Infrastructure | `kb/procedures/deployment-*.md` |
124
+
125
+ ### Post-Deployment Checklist
126
+ - [ ] Deployment successful
127
+ - [ ] Health checks passing
128
+ - [ ] **CHANGELOG updated**
129
+ - [ ] **Deployment docs updated**
130
+ - [ ] Release notes created (if applicable)
@@ -0,0 +1,171 @@
1
+ #!/usr/bin/env python3
2
+ """Pre-deployment readiness checklist.
3
+
4
+ Runs a series of checks (git clean, branch, Docker, env file, build
5
+ artifacts, test results) and returns a JSON object with pass/fail for
6
+ each check, a list of blockers, and an overall ready status.
7
+
8
+ Usage::
9
+
10
+ python3 pre_deploy_check.py [environment]
11
+ """
12
+ from __future__ import annotations
13
+
14
+ import json
15
+ import subprocess
16
+ import sys
17
+ from datetime import datetime, timezone
18
+ from pathlib import Path
19
+ from typing import Any
20
+
21
+
22
+ def _run(cmd: list[str], *, check: bool = False) -> subprocess.CompletedProcess[str]:
23
+ """Run a command and return the CompletedProcess.
24
+
25
+ Captures stdout/stderr as text. Never raises on non-zero exit unless
26
+ *check* is True.
27
+ """
28
+ return subprocess.run(
29
+ cmd,
30
+ capture_output=True,
31
+ text=True,
32
+ check=check,
33
+ )
34
+
35
+
36
+ def _git_porcelain() -> str:
37
+ """Return the porcelain output of ``git status``."""
38
+ result = _run(["git", "status", "--porcelain"])
39
+ return result.stdout.strip()
40
+
41
+
42
+ def _git_branch() -> str:
43
+ """Return the current git branch name, or ``unknown``."""
44
+ result = _run(["git", "branch", "--show-current"])
45
+ return result.stdout.strip() or "unknown"
46
+
47
+
48
+ def _docker_available() -> bool:
49
+ """Return True if the ``docker`` command is on PATH."""
50
+ result = _run(["command", "-v", "docker"])
51
+ # Fallback: just try docker --version
52
+ if result.returncode != 0:
53
+ result = _run(["docker", "--version"])
54
+ return result.returncode == 0
55
+
56
+
57
+ def _docker_services_running() -> bool:
58
+ """Return True if any docker compose service reports running."""
59
+ result = _run(["docker", "compose", "ps"])
60
+ if result.returncode != 0:
61
+ return False
62
+ return "running" in result.stdout.lower()
63
+
64
+
65
+ class _CheckCollector:
66
+ """Accumulates individual check results and blockers."""
67
+
68
+ def __init__(self) -> None:
69
+ self.checks: dict[str, dict[str, Any]] = {}
70
+ self.blockers: list[str] = []
71
+
72
+ def add(self, name: str, passed: bool, detail: str) -> None:
73
+ """Record a single check result."""
74
+ self.checks[name] = {"pass": passed, "detail": detail}
75
+ if not passed:
76
+ self.blockers.append(detail)
77
+
78
+ @property
79
+ def ready(self) -> bool:
80
+ """Return True when there are no blockers."""
81
+ return len(self.blockers) == 0
82
+
83
+
84
+ def _run_checks(env: str) -> _CheckCollector:
85
+ """Execute all pre-deployment checks and return the collector."""
86
+ collector = _CheckCollector()
87
+
88
+ # 1. Git clean
89
+ porcelain = _git_porcelain()
90
+ if not porcelain:
91
+ collector.add("git_clean", True, "No uncommitted changes")
92
+ else:
93
+ collector.add("git_clean", False, "Uncommitted changes detected")
94
+
95
+ # 2. Branch
96
+ branch = _git_branch()
97
+ if env in ("prod", "production"):
98
+ if branch in ("main", "master"):
99
+ collector.add("branch", True, f"On {branch}")
100
+ else:
101
+ collector.add("branch", False, f"Not on main/master (on {branch})")
102
+ else:
103
+ collector.add("branch", True, f"On {branch}")
104
+
105
+ # 3. Docker
106
+ has_compose = (
107
+ Path("docker-compose.yml").exists()
108
+ or Path("compose.yml").exists()
109
+ )
110
+ if _docker_available() and has_compose:
111
+ if _docker_services_running():
112
+ collector.add("docker", True, "Docker services running")
113
+ else:
114
+ collector.add("docker", False, "Docker services not running")
115
+ else:
116
+ collector.add("docker", True, "No Docker config (skipped)")
117
+
118
+ # 4. Env file
119
+ if Path(".env").exists() or Path(f".env.{env}").exists():
120
+ collector.add("env_file", True, "Environment file exists")
121
+ else:
122
+ collector.add("env_file", False, f"Missing .env or .env.{env} file")
123
+
124
+ # 5. Build artifacts
125
+ found_artifacts = any(Path(d).is_dir() for d in ("dist", "build"))
126
+ if found_artifacts:
127
+ collector.add("build_artifacts", True, "Build artifacts present")
128
+ else:
129
+ collector.add(
130
+ "build_artifacts", True,
131
+ "No build artifacts expected (interpreted language)",
132
+ )
133
+
134
+ # 6. Test results
135
+ test_artifacts = [
136
+ "coverage/.last_run.json",
137
+ "htmlcov/status.json",
138
+ ".coverage",
139
+ "test-results.xml",
140
+ ]
141
+ if any(Path(p).exists() for p in test_artifacts):
142
+ collector.add("tests_ran", True, "Test result artifacts found")
143
+ else:
144
+ collector.add(
145
+ "tests_ran", False,
146
+ "No recent test results found - run tests first",
147
+ )
148
+
149
+ return collector
150
+
151
+
152
+ def main() -> None:
153
+ """Entry point: run checks and print JSON result to stdout."""
154
+ env = sys.argv[1] if len(sys.argv) > 1 else "staging"
155
+ branch = _git_branch()
156
+ collector = _run_checks(env)
157
+ now = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
158
+
159
+ output: dict[str, Any] = {
160
+ "environment": env,
161
+ "timestamp": now,
162
+ "branch": branch,
163
+ "checks": collector.checks,
164
+ "ready": collector.ready,
165
+ "blockers": collector.blockers,
166
+ }
167
+ print(json.dumps(output, indent=2))
168
+
169
+
170
+ if __name__ == "__main__":
171
+ main()
@@ -0,0 +1,31 @@
1
+ # Deployment Checklist
2
+
3
+ ## Pre-Deployment
4
+ - [ ] All tests passing on CI
5
+ - [ ] Code reviewed and approved
6
+ - [ ] No critical security vulnerabilities
7
+ - [ ] Database migrations tested
8
+ - [ ] Environment variables configured
9
+ - [ ] Rollback plan documented
10
+
11
+ ## Deployment
12
+ - [ ] Notify team of deployment start
13
+ - [ ] Create deployment tag/release
14
+ - [ ] Run database migrations
15
+ - [ ] Deploy application
16
+ - [ ] Verify health checks pass
17
+ - [ ] Run smoke tests
18
+
19
+ ## Post-Deployment
20
+ - [ ] Monitor error rates (15 min)
21
+ - [ ] Monitor response times (15 min)
22
+ - [ ] Verify key user flows work
23
+ - [ ] Check logs for unexpected errors
24
+ - [ ] Notify team of deployment completion
25
+ - [ ] Update deployment log
26
+
27
+ ## Rollback Triggers
28
+ - Error rate > 5%
29
+ - P95 latency > 2x baseline
30
+ - Critical user flow broken
31
+ - Data integrity issues detected
@@ -0,0 +1,105 @@
1
+ ---
2
+ name: design-an-interface
3
+ description: "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'."
4
+ user-invocable: true
5
+ effort: high
6
+ argument-hint: "[module or interface to design]"
7
+ allowed-tools: Read, Grep, Glob, Bash, Agent
8
+ ---
9
+
10
+ # Design an Interface
11
+
12
+ $ARGUMENTS
13
+
14
+ Generate 3+ radically different interface designs using parallel sub-agents, then compare. Based on "Design It Twice" from "A Philosophy of Software Design."
15
+
16
+ ## Usage
17
+
18
+ ```
19
+ /design-an-interface [module or interface to design]
20
+ ```
21
+
22
+ ## What This Command Does
23
+
24
+ 1. **Gathers** requirements and constraints
25
+ 2. **Spawns** 3+ parallel sub-agents with different design constraints
26
+ 3. **Presents** each design with signatures, usage examples, and trade-offs
27
+ 4. **Compares** on simplicity, depth, efficiency, and correctness
28
+ 5. **Synthesizes** best elements into final recommendation
29
+
30
+ ## Process
31
+
32
+ ### 1. Gather Requirements
33
+
34
+ Before designing, understand:
35
+
36
+ - [ ] What problem does this module solve?
37
+ - [ ] Who are the callers? (other modules, external users, tests)
38
+ - [ ] What are the key operations?
39
+ - [ ] Any constraints? (performance, compatibility, existing patterns)
40
+ - [ ] What should be hidden inside vs exposed?
41
+
42
+ ### 2. Generate Designs (Parallel Sub-Agents)
43
+
44
+ Spawn 3+ sub-agents simultaneously using Agent tool. Each gets a **radically different** constraint:
45
+
46
+ | Agent | Constraint |
47
+ |-------|-----------|
48
+ | Agent 1 | Minimize method count — aim for 1-3 methods max |
49
+ | Agent 2 | Maximize flexibility — support many use cases |
50
+ | Agent 3 | Optimize for the most common case |
51
+ | Agent 4 | Take inspiration from a specific paradigm/library |
52
+
53
+ Each agent outputs:
54
+ 1. Interface signature (types/methods)
55
+ 2. Usage example (how caller uses it)
56
+ 3. What this design hides internally
57
+ 4. Trade-offs of this approach
58
+
59
+ ### 3. Present Designs
60
+
61
+ Show each design sequentially so user can absorb each approach before comparison:
62
+ 1. **Interface signature** — types, methods, params
63
+ 2. **Usage examples** — how callers actually use it
64
+ 3. **What it hides** — complexity kept internal
65
+
66
+ ### 4. Compare Designs
67
+
68
+ Compare in prose (not tables) on:
69
+
70
+ | Criterion | Description |
71
+ |-----------|-------------|
72
+ | Interface simplicity | Fewer methods, simpler params |
73
+ | General-purpose vs specialized | Flexibility vs focus |
74
+ | Implementation efficiency | Does shape allow efficient internals? |
75
+ | Depth | Small interface hiding significant complexity (good) vs large interface with thin implementation (bad) |
76
+ | Ease of correct use | vs ease of misuse |
77
+
78
+ ### 5. Synthesize
79
+
80
+ Often the best design combines insights from multiple options. Give an opinionated recommendation. Ask:
81
+ - Which design best fits the primary use case?
82
+ - Any elements from other designs worth incorporating?
83
+
84
+ ## Visual Companion (Optional)
85
+
86
+ When upcoming design explorations will involve visual content (mockups, layout comparisons, architecture diagrams), offer the browser companion:
87
+
88
+ > "Some of these interface designs might be easier to compare visually. I can show diagrams and side-by-side comparisons in a browser. Want to try it?"
89
+
90
+ **This offer MUST be its own message.** Do not combine with other questions. Wait for response.
91
+
92
+ If accepted, start the server and use it for visual comparisons only. Text/conceptual questions stay in terminal.
93
+
94
+ See [../write-a-prd/reference/visual-companion.md](../write-a-prd/reference/visual-companion.md) for details.
95
+
96
+ ## Anti-Patterns
97
+
98
+ - Don't let sub-agents produce similar designs — enforce radical difference
99
+ - Don't skip comparison — the value is in contrast
100
+ - Don't implement — this is purely about interface shape
101
+ - Don't evaluate based on implementation effort
102
+
103
+ ## READ-ONLY
104
+
105
+ This skill designs interfaces. It does NOT write implementation code.