claude-code-orchestrator-kit 1.4.1 → 1.4.15

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 (218) hide show
  1. package/.claude/agents/business/workers/lead-research-assistant.md +199 -0
  2. package/.claude/agents/database/workers/database-architect.md +3 -3
  3. package/.claude/agents/database/workers/supabase-auditor.md +7 -7
  4. package/.claude/agents/development/workers/code-reviewer.md +17 -2
  5. package/.claude/agents/frontend/workers/nextjs-ui-designer.md +30 -0
  6. package/.claude/agents/health/workers/bug-fixer.md +31 -2
  7. package/.claude/agents/health/workers/bug-hunter.md +0 -1
  8. package/.claude/agents/health/workers/dead-code-hunter.md +167 -75
  9. package/.claude/agents/health/workers/dead-code-remover.md +217 -66
  10. package/.claude/agents/health/workers/dependency-auditor.md +83 -24
  11. package/.claude/agents/health/workers/dependency-updater.md +0 -1
  12. package/.claude/agents/health/workers/security-scanner.md +0 -1
  13. package/.claude/agents/infrastructure/workers/deployment-engineer.md +446 -0
  14. package/.claude/agents/infrastructure/workers/infrastructure-specialist.md +2 -2
  15. package/.claude/agents/meta/workers/meta-agent-v3.md +22 -0
  16. package/.claude/agents/testing/workers/integration-tester.md +1 -1
  17. package/.claude/agents/testing/workers/test-writer.md +16 -0
  18. package/.claude/commands/health-bugs.md +14 -281
  19. package/.claude/commands/health-cleanup.md +14 -281
  20. package/.claude/commands/health-deps.md +14 -281
  21. package/.claude/commands/health-metrics.md +51 -709
  22. package/.claude/commands/health-reuse.md +14 -311
  23. package/.claude/commands/health-security.md +14 -281
  24. package/.claude/commands/push.md +17 -3
  25. package/.claude/commands/speckit.implement.md +0 -11
  26. package/.claude/commands/worktree.md +150 -0
  27. package/.claude/scripts/gates/check-bundle-size.sh +0 -0
  28. package/.claude/scripts/gates/check-coverage.sh +0 -0
  29. package/.claude/scripts/gates/check-security.sh +0 -0
  30. package/.claude/scripts/release.sh +469 -94
  31. package/.claude/skills/algorithmic-art/LICENSE.txt +202 -0
  32. package/.claude/skills/algorithmic-art/SKILL.md +405 -0
  33. package/.claude/skills/algorithmic-art/templates/generator_template.js +223 -0
  34. package/.claude/skills/algorithmic-art/templates/viewer.html +599 -0
  35. package/.claude/skills/artifacts-builder/LICENSE.txt +202 -0
  36. package/.claude/skills/artifacts-builder/SKILL.md +74 -0
  37. package/.claude/skills/artifacts-builder/scripts/bundle-artifact.sh +54 -0
  38. package/.claude/skills/artifacts-builder/scripts/init-artifact.sh +322 -0
  39. package/.claude/skills/artifacts-builder/scripts/shadcn-components.tar.gz +0 -0
  40. package/.claude/skills/bug-health-inline/SKILL.md +221 -0
  41. package/.claude/skills/bug-health-inline/references/worker-prompts.md +182 -0
  42. package/.claude/skills/canvas-design/LICENSE.txt +202 -0
  43. package/.claude/skills/canvas-design/SKILL.md +130 -0
  44. package/.claude/skills/canvas-design/canvas-fonts/ArsenalSC-OFL.txt +93 -0
  45. package/.claude/skills/canvas-design/canvas-fonts/ArsenalSC-Regular.ttf +0 -0
  46. package/.claude/skills/canvas-design/canvas-fonts/BigShoulders-Bold.ttf +0 -0
  47. package/.claude/skills/canvas-design/canvas-fonts/BigShoulders-OFL.txt +93 -0
  48. package/.claude/skills/canvas-design/canvas-fonts/BigShoulders-Regular.ttf +0 -0
  49. package/.claude/skills/canvas-design/canvas-fonts/Boldonse-OFL.txt +93 -0
  50. package/.claude/skills/canvas-design/canvas-fonts/Boldonse-Regular.ttf +0 -0
  51. package/.claude/skills/canvas-design/canvas-fonts/BricolageGrotesque-Bold.ttf +0 -0
  52. package/.claude/skills/canvas-design/canvas-fonts/BricolageGrotesque-OFL.txt +93 -0
  53. package/.claude/skills/canvas-design/canvas-fonts/BricolageGrotesque-Regular.ttf +0 -0
  54. package/.claude/skills/canvas-design/canvas-fonts/CrimsonPro-Bold.ttf +0 -0
  55. package/.claude/skills/canvas-design/canvas-fonts/CrimsonPro-Italic.ttf +0 -0
  56. package/.claude/skills/canvas-design/canvas-fonts/CrimsonPro-OFL.txt +93 -0
  57. package/.claude/skills/canvas-design/canvas-fonts/CrimsonPro-Regular.ttf +0 -0
  58. package/.claude/skills/canvas-design/canvas-fonts/DMMono-OFL.txt +93 -0
  59. package/.claude/skills/canvas-design/canvas-fonts/DMMono-Regular.ttf +0 -0
  60. package/.claude/skills/canvas-design/canvas-fonts/EricaOne-OFL.txt +94 -0
  61. package/.claude/skills/canvas-design/canvas-fonts/EricaOne-Regular.ttf +0 -0
  62. package/.claude/skills/canvas-design/canvas-fonts/GeistMono-Bold.ttf +0 -0
  63. package/.claude/skills/canvas-design/canvas-fonts/GeistMono-OFL.txt +93 -0
  64. package/.claude/skills/canvas-design/canvas-fonts/GeistMono-Regular.ttf +0 -0
  65. package/.claude/skills/canvas-design/canvas-fonts/Gloock-OFL.txt +93 -0
  66. package/.claude/skills/canvas-design/canvas-fonts/Gloock-Regular.ttf +0 -0
  67. package/.claude/skills/canvas-design/canvas-fonts/IBMPlexMono-Bold.ttf +0 -0
  68. package/.claude/skills/canvas-design/canvas-fonts/IBMPlexMono-OFL.txt +93 -0
  69. package/.claude/skills/canvas-design/canvas-fonts/IBMPlexMono-Regular.ttf +0 -0
  70. package/.claude/skills/canvas-design/canvas-fonts/IBMPlexSerif-Bold.ttf +0 -0
  71. package/.claude/skills/canvas-design/canvas-fonts/IBMPlexSerif-BoldItalic.ttf +0 -0
  72. package/.claude/skills/canvas-design/canvas-fonts/IBMPlexSerif-Italic.ttf +0 -0
  73. package/.claude/skills/canvas-design/canvas-fonts/IBMPlexSerif-Regular.ttf +0 -0
  74. package/.claude/skills/canvas-design/canvas-fonts/InstrumentSans-Bold.ttf +0 -0
  75. package/.claude/skills/canvas-design/canvas-fonts/InstrumentSans-BoldItalic.ttf +0 -0
  76. package/.claude/skills/canvas-design/canvas-fonts/InstrumentSans-Italic.ttf +0 -0
  77. package/.claude/skills/canvas-design/canvas-fonts/InstrumentSans-OFL.txt +93 -0
  78. package/.claude/skills/canvas-design/canvas-fonts/InstrumentSans-Regular.ttf +0 -0
  79. package/.claude/skills/canvas-design/canvas-fonts/InstrumentSerif-Italic.ttf +0 -0
  80. package/.claude/skills/canvas-design/canvas-fonts/InstrumentSerif-Regular.ttf +0 -0
  81. package/.claude/skills/canvas-design/canvas-fonts/Italiana-OFL.txt +93 -0
  82. package/.claude/skills/canvas-design/canvas-fonts/Italiana-Regular.ttf +0 -0
  83. package/.claude/skills/canvas-design/canvas-fonts/JetBrainsMono-Bold.ttf +0 -0
  84. package/.claude/skills/canvas-design/canvas-fonts/JetBrainsMono-OFL.txt +93 -0
  85. package/.claude/skills/canvas-design/canvas-fonts/JetBrainsMono-Regular.ttf +0 -0
  86. package/.claude/skills/canvas-design/canvas-fonts/Jura-Light.ttf +0 -0
  87. package/.claude/skills/canvas-design/canvas-fonts/Jura-Medium.ttf +0 -0
  88. package/.claude/skills/canvas-design/canvas-fonts/Jura-OFL.txt +93 -0
  89. package/.claude/skills/canvas-design/canvas-fonts/LibreBaskerville-OFL.txt +93 -0
  90. package/.claude/skills/canvas-design/canvas-fonts/LibreBaskerville-Regular.ttf +0 -0
  91. package/.claude/skills/canvas-design/canvas-fonts/Lora-Bold.ttf +0 -0
  92. package/.claude/skills/canvas-design/canvas-fonts/Lora-BoldItalic.ttf +0 -0
  93. package/.claude/skills/canvas-design/canvas-fonts/Lora-Italic.ttf +0 -0
  94. package/.claude/skills/canvas-design/canvas-fonts/Lora-OFL.txt +93 -0
  95. package/.claude/skills/canvas-design/canvas-fonts/Lora-Regular.ttf +0 -0
  96. package/.claude/skills/canvas-design/canvas-fonts/NationalPark-Bold.ttf +0 -0
  97. package/.claude/skills/canvas-design/canvas-fonts/NationalPark-OFL.txt +93 -0
  98. package/.claude/skills/canvas-design/canvas-fonts/NationalPark-Regular.ttf +0 -0
  99. package/.claude/skills/canvas-design/canvas-fonts/NothingYouCouldDo-OFL.txt +93 -0
  100. package/.claude/skills/canvas-design/canvas-fonts/NothingYouCouldDo-Regular.ttf +0 -0
  101. package/.claude/skills/canvas-design/canvas-fonts/Outfit-Bold.ttf +0 -0
  102. package/.claude/skills/canvas-design/canvas-fonts/Outfit-OFL.txt +93 -0
  103. package/.claude/skills/canvas-design/canvas-fonts/Outfit-Regular.ttf +0 -0
  104. package/.claude/skills/canvas-design/canvas-fonts/PixelifySans-Medium.ttf +0 -0
  105. package/.claude/skills/canvas-design/canvas-fonts/PixelifySans-OFL.txt +93 -0
  106. package/.claude/skills/canvas-design/canvas-fonts/PoiretOne-OFL.txt +93 -0
  107. package/.claude/skills/canvas-design/canvas-fonts/PoiretOne-Regular.ttf +0 -0
  108. package/.claude/skills/canvas-design/canvas-fonts/RedHatMono-Bold.ttf +0 -0
  109. package/.claude/skills/canvas-design/canvas-fonts/RedHatMono-OFL.txt +93 -0
  110. package/.claude/skills/canvas-design/canvas-fonts/RedHatMono-Regular.ttf +0 -0
  111. package/.claude/skills/canvas-design/canvas-fonts/Silkscreen-OFL.txt +93 -0
  112. package/.claude/skills/canvas-design/canvas-fonts/Silkscreen-Regular.ttf +0 -0
  113. package/.claude/skills/canvas-design/canvas-fonts/SmoochSans-Medium.ttf +0 -0
  114. package/.claude/skills/canvas-design/canvas-fonts/SmoochSans-OFL.txt +93 -0
  115. package/.claude/skills/canvas-design/canvas-fonts/Tektur-Medium.ttf +0 -0
  116. package/.claude/skills/canvas-design/canvas-fonts/Tektur-OFL.txt +93 -0
  117. package/.claude/skills/canvas-design/canvas-fonts/Tektur-Regular.ttf +0 -0
  118. package/.claude/skills/canvas-design/canvas-fonts/WorkSans-Bold.ttf +0 -0
  119. package/.claude/skills/canvas-design/canvas-fonts/WorkSans-BoldItalic.ttf +0 -0
  120. package/.claude/skills/canvas-design/canvas-fonts/WorkSans-Italic.ttf +0 -0
  121. package/.claude/skills/canvas-design/canvas-fonts/WorkSans-OFL.txt +93 -0
  122. package/.claude/skills/canvas-design/canvas-fonts/WorkSans-Regular.ttf +0 -0
  123. package/.claude/skills/canvas-design/canvas-fonts/YoungSerif-OFL.txt +93 -0
  124. package/.claude/skills/canvas-design/canvas-fonts/YoungSerif-Regular.ttf +0 -0
  125. package/.claude/skills/changelog-generator/SKILL.md +104 -0
  126. package/.claude/skills/cleanup-health-inline/SKILL.md +224 -0
  127. package/.claude/skills/code-reviewer/SKILL.md +209 -0
  128. package/.claude/skills/code-reviewer/references/code_review_checklist.md +103 -0
  129. package/.claude/skills/code-reviewer/references/coding_standards.md +103 -0
  130. package/.claude/skills/code-reviewer/references/common_antipatterns.md +103 -0
  131. package/.claude/skills/code-reviewer/scripts/code_quality_checker.py +114 -0
  132. package/.claude/skills/code-reviewer/scripts/pr_analyzer.py +114 -0
  133. package/.claude/skills/code-reviewer/scripts/review_report_generator.py +114 -0
  134. package/.claude/skills/content-research-writer/SKILL.md +538 -0
  135. package/.claude/skills/deps-health-inline/SKILL.md +227 -0
  136. package/.claude/skills/frontend-aesthetics/SKILL.md +51 -396
  137. package/.claude/skills/git-commit-helper/SKILL.md +203 -0
  138. package/.claude/skills/lead-research-assistant/SKILL.md +199 -0
  139. package/.claude/skills/reuse-health-inline/SKILL.md +248 -0
  140. package/.claude/skills/rollback-changes/SKILL.md +50 -524
  141. package/.claude/skills/run-quality-gate/SKILL.md +36 -346
  142. package/.claude/skills/security-health-inline/SKILL.md +224 -0
  143. package/.claude/skills/senior-devops/SKILL.md +209 -0
  144. package/.claude/skills/senior-devops/references/cicd_pipeline_guide.md +103 -0
  145. package/.claude/skills/senior-devops/references/deployment_strategies.md +103 -0
  146. package/.claude/skills/senior-devops/references/infrastructure_as_code.md +103 -0
  147. package/.claude/skills/senior-devops/scripts/deployment_manager.py +114 -0
  148. package/.claude/skills/senior-devops/scripts/pipeline_generator.py +114 -0
  149. package/.claude/skills/senior-devops/scripts/terraform_scaffolder.py +114 -0
  150. package/.claude/skills/senior-prompt-engineer/SKILL.md +226 -0
  151. package/.claude/skills/senior-prompt-engineer/references/agentic_system_design.md +80 -0
  152. package/.claude/skills/senior-prompt-engineer/references/llm_evaluation_frameworks.md +80 -0
  153. package/.claude/skills/senior-prompt-engineer/references/prompt_engineering_patterns.md +80 -0
  154. package/.claude/skills/senior-prompt-engineer/scripts/agent_orchestrator.py +100 -0
  155. package/.claude/skills/senior-prompt-engineer/scripts/prompt_optimizer.py +100 -0
  156. package/.claude/skills/senior-prompt-engineer/scripts/rag_evaluator.py +100 -0
  157. package/.claude/skills/setup-knip/SKILL.md +372 -0
  158. package/.claude/skills/systematic-debugging/CREATION-LOG.md +119 -0
  159. package/.claude/skills/systematic-debugging/SKILL.md +296 -0
  160. package/.claude/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  161. package/.claude/skills/systematic-debugging/condition-based-waiting.md +115 -0
  162. package/.claude/skills/systematic-debugging/defense-in-depth.md +122 -0
  163. package/.claude/skills/systematic-debugging/find-polluter.sh +63 -0
  164. package/.claude/skills/systematic-debugging/root-cause-tracing.md +169 -0
  165. package/.claude/skills/systematic-debugging/test-academic.md +14 -0
  166. package/.claude/skills/systematic-debugging/test-pressure-1.md +58 -0
  167. package/.claude/skills/systematic-debugging/test-pressure-2.md +68 -0
  168. package/.claude/skills/systematic-debugging/test-pressure-3.md +69 -0
  169. package/.claude/skills/theme-factory/LICENSE.txt +202 -0
  170. package/.claude/skills/theme-factory/SKILL.md +59 -0
  171. package/.claude/skills/theme-factory/theme-showcase.pdf +0 -0
  172. package/.claude/skills/theme-factory/themes/arctic-frost.md +19 -0
  173. package/.claude/skills/theme-factory/themes/botanical-garden.md +19 -0
  174. package/.claude/skills/theme-factory/themes/desert-rose.md +19 -0
  175. package/.claude/skills/theme-factory/themes/forest-canopy.md +19 -0
  176. package/.claude/skills/theme-factory/themes/golden-hour.md +19 -0
  177. package/.claude/skills/theme-factory/themes/midnight-galaxy.md +19 -0
  178. package/.claude/skills/theme-factory/themes/modern-minimalist.md +19 -0
  179. package/.claude/skills/theme-factory/themes/ocean-depths.md +19 -0
  180. package/.claude/skills/theme-factory/themes/sunset-boulevard.md +19 -0
  181. package/.claude/skills/theme-factory/themes/tech-innovation.md +19 -0
  182. package/.claude/skills/ui-design-system/SKILL.md +32 -0
  183. package/.claude/skills/ui-design-system/scripts/design_token_generator.py +529 -0
  184. package/.claude/skills/ux-researcher-designer/SKILL.md +30 -0
  185. package/.claude/skills/ux-researcher-designer/scripts/persona_generator.py +508 -0
  186. package/.claude/skills/webapp-testing/LICENSE.txt +202 -0
  187. package/.claude/skills/webapp-testing/SKILL.md +96 -0
  188. package/.claude/skills/webapp-testing/examples/console_logging.py +35 -0
  189. package/.claude/skills/webapp-testing/examples/element_discovery.py +40 -0
  190. package/.claude/skills/webapp-testing/examples/static_html_automation.py +33 -0
  191. package/.claude/skills/webapp-testing/scripts/with_server.py +106 -0
  192. package/.gitignore +4 -0
  193. package/README.md +492 -1093
  194. package/README.ru.md +719 -0
  195. package/docs/Agents Ecosystem/AGENT-ORCHESTRATION.md +2 -2
  196. package/docs/COMMANDS-GUIDE.md +0 -15
  197. package/docs/reports/skills/new-skills-analysis-2025-12.md +331 -0
  198. package/package.json +11 -3
  199. package/.claude/agents/health/orchestrators/bug-orchestrator.md +0 -1084
  200. package/.claude/agents/health/orchestrators/dead-code-orchestrator.md +0 -1064
  201. package/.claude/agents/health/orchestrators/dependency-orchestrator.md +0 -1064
  202. package/.claude/agents/health/orchestrators/reuse-orchestrator.md +0 -1112
  203. package/.claude/agents/health/orchestrators/security-orchestrator.md +0 -1064
  204. package/.claude/commands/worktree-cleanup.md +0 -382
  205. package/.claude/commands/worktree-create.md +0 -287
  206. package/.claude/commands/worktree-list.md +0 -239
  207. package/.claude/commands/worktree-remove.md +0 -339
  208. package/.claude/project-index.md +0 -75
  209. package/.claude/skills/load-project-context/SKILL.md +0 -89
  210. package/.claude/skills/resume-session/SKILL.md +0 -164
  211. package/.claude/skills/save-session-context/SKILL.md +0 -123
  212. package/.claude/templates/project-index.template.md +0 -67
  213. package/.claude/templates/session/context.template.md +0 -40
  214. package/.claude/templates/session/log.template.md +0 -72
  215. package/.github/BRANCH_PROTECTION.md +0 -137
  216. package/.github/workflows/build.yml +0 -70
  217. package/.github/workflows/deploy-staging.yml +0 -90
  218. package/.github/workflows/test.yml +0 -104
@@ -0,0 +1,119 @@
1
+ # Creation Log: Systematic Debugging Skill
2
+
3
+ Reference example of extracting, structuring, and bulletproofing a critical skill.
4
+
5
+ ## Source Material
6
+
7
+ Extracted debugging framework from `/Users/jesse/.claude/CLAUDE.md`:
8
+ - 4-phase systematic process (Investigation → Pattern Analysis → Hypothesis → Implementation)
9
+ - Core mandate: ALWAYS find root cause, NEVER fix symptoms
10
+ - Rules designed to resist time pressure and rationalization
11
+
12
+ ## Extraction Decisions
13
+
14
+ **What to include:**
15
+ - Complete 4-phase framework with all rules
16
+ - Anti-shortcuts ("NEVER fix symptom", "STOP and re-analyze")
17
+ - Pressure-resistant language ("even if faster", "even if I seem in a hurry")
18
+ - Concrete steps for each phase
19
+
20
+ **What to leave out:**
21
+ - Project-specific context
22
+ - Repetitive variations of same rule
23
+ - Narrative explanations (condensed to principles)
24
+
25
+ ## Structure Following skill-creation/SKILL.md
26
+
27
+ 1. **Rich when_to_use** - Included symptoms and anti-patterns
28
+ 2. **Type: technique** - Concrete process with steps
29
+ 3. **Keywords** - "root cause", "symptom", "workaround", "debugging", "investigation"
30
+ 4. **Flowchart** - Decision point for "fix failed" → re-analyze vs add more fixes
31
+ 5. **Phase-by-phase breakdown** - Scannable checklist format
32
+ 6. **Anti-patterns section** - What NOT to do (critical for this skill)
33
+
34
+ ## Bulletproofing Elements
35
+
36
+ Framework designed to resist rationalization under pressure:
37
+
38
+ ### Language Choices
39
+ - "ALWAYS" / "NEVER" (not "should" / "try to")
40
+ - "even if faster" / "even if I seem in a hurry"
41
+ - "STOP and re-analyze" (explicit pause)
42
+ - "Don't skip past" (catches the actual behavior)
43
+
44
+ ### Structural Defenses
45
+ - **Phase 1 required** - Can't skip to implementation
46
+ - **Single hypothesis rule** - Forces thinking, prevents shotgun fixes
47
+ - **Explicit failure mode** - "IF your first fix doesn't work" with mandatory action
48
+ - **Anti-patterns section** - Shows exactly what shortcuts look like
49
+
50
+ ### Redundancy
51
+ - Root cause mandate in overview + when_to_use + Phase 1 + implementation rules
52
+ - "NEVER fix symptom" appears 4 times in different contexts
53
+ - Each phase has explicit "don't skip" guidance
54
+
55
+ ## Testing Approach
56
+
57
+ Created 4 validation tests following skills/meta/testing-skills-with-subagents:
58
+
59
+ ### Test 1: Academic Context (No Pressure)
60
+ - Simple bug, no time pressure
61
+ - **Result:** Perfect compliance, complete investigation
62
+
63
+ ### Test 2: Time Pressure + Obvious Quick Fix
64
+ - User "in a hurry", symptom fix looks easy
65
+ - **Result:** Resisted shortcut, followed full process, found real root cause
66
+
67
+ ### Test 3: Complex System + Uncertainty
68
+ - Multi-layer failure, unclear if can find root cause
69
+ - **Result:** Systematic investigation, traced through all layers, found source
70
+
71
+ ### Test 4: Failed First Fix
72
+ - Hypothesis doesn't work, temptation to add more fixes
73
+ - **Result:** Stopped, re-analyzed, formed new hypothesis (no shotgun)
74
+
75
+ **All tests passed.** No rationalizations found.
76
+
77
+ ## Iterations
78
+
79
+ ### Initial Version
80
+ - Complete 4-phase framework
81
+ - Anti-patterns section
82
+ - Flowchart for "fix failed" decision
83
+
84
+ ### Enhancement 1: TDD Reference
85
+ - Added link to skills/testing/test-driven-development
86
+ - Note explaining TDD's "simplest code" ≠ debugging's "root cause"
87
+ - Prevents confusion between methodologies
88
+
89
+ ## Final Outcome
90
+
91
+ Bulletproof skill that:
92
+ - ✅ Clearly mandates root cause investigation
93
+ - ✅ Resists time pressure rationalization
94
+ - ✅ Provides concrete steps for each phase
95
+ - ✅ Shows anti-patterns explicitly
96
+ - ✅ Tested under multiple pressure scenarios
97
+ - ✅ Clarifies relationship to TDD
98
+ - ✅ Ready for use
99
+
100
+ ## Key Insight
101
+
102
+ **Most important bulletproofing:** Anti-patterns section showing exact shortcuts that feel justified in the moment. When Claude thinks "I'll just add this one quick fix", seeing that exact pattern listed as wrong creates cognitive friction.
103
+
104
+ ## Usage Example
105
+
106
+ When encountering a bug:
107
+ 1. Load skill: skills/debugging/systematic-debugging
108
+ 2. Read overview (10 sec) - reminded of mandate
109
+ 3. Follow Phase 1 checklist - forced investigation
110
+ 4. If tempted to skip - see anti-pattern, stop
111
+ 5. Complete all phases - root cause found
112
+
113
+ **Time investment:** 5-10 minutes
114
+ **Time saved:** Hours of symptom-whack-a-mole
115
+
116
+ ---
117
+
118
+ *Created: 2025-10-03*
119
+ *Purpose: Reference example for skill extraction and bulletproofing*
@@ -0,0 +1,296 @@
1
+ ---
2
+ name: systematic-debugging
3
+ description: Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes
4
+ ---
5
+
6
+ # Systematic Debugging
7
+
8
+ ## Overview
9
+
10
+ Random fixes waste time and create new bugs. Quick patches mask underlying issues.
11
+
12
+ **Core principle:** ALWAYS find root cause before attempting fixes. Symptom fixes are failure.
13
+
14
+ **Violating the letter of this process is violating the spirit of debugging.**
15
+
16
+ ## The Iron Law
17
+
18
+ ```
19
+ NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
20
+ ```
21
+
22
+ If you haven't completed Phase 1, you cannot propose fixes.
23
+
24
+ ## When to Use
25
+
26
+ Use for ANY technical issue:
27
+ - Test failures
28
+ - Bugs in production
29
+ - Unexpected behavior
30
+ - Performance problems
31
+ - Build failures
32
+ - Integration issues
33
+
34
+ **Use this ESPECIALLY when:**
35
+ - Under time pressure (emergencies make guessing tempting)
36
+ - "Just one quick fix" seems obvious
37
+ - You've already tried multiple fixes
38
+ - Previous fix didn't work
39
+ - You don't fully understand the issue
40
+
41
+ **Don't skip when:**
42
+ - Issue seems simple (simple bugs have root causes too)
43
+ - You're in a hurry (rushing guarantees rework)
44
+ - Manager wants it fixed NOW (systematic is faster than thrashing)
45
+
46
+ ## The Four Phases
47
+
48
+ You MUST complete each phase before proceeding to the next.
49
+
50
+ ### Phase 1: Root Cause Investigation
51
+
52
+ **BEFORE attempting ANY fix:**
53
+
54
+ 1. **Read Error Messages Carefully**
55
+ - Don't skip past errors or warnings
56
+ - They often contain the exact solution
57
+ - Read stack traces completely
58
+ - Note line numbers, file paths, error codes
59
+
60
+ 2. **Reproduce Consistently**
61
+ - Can you trigger it reliably?
62
+ - What are the exact steps?
63
+ - Does it happen every time?
64
+ - If not reproducible → gather more data, don't guess
65
+
66
+ 3. **Check Recent Changes**
67
+ - What changed that could cause this?
68
+ - Git diff, recent commits
69
+ - New dependencies, config changes
70
+ - Environmental differences
71
+
72
+ 4. **Gather Evidence in Multi-Component Systems**
73
+
74
+ **WHEN system has multiple components (CI → build → signing, API → service → database):**
75
+
76
+ **BEFORE proposing fixes, add diagnostic instrumentation:**
77
+ ```
78
+ For EACH component boundary:
79
+ - Log what data enters component
80
+ - Log what data exits component
81
+ - Verify environment/config propagation
82
+ - Check state at each layer
83
+
84
+ Run once to gather evidence showing WHERE it breaks
85
+ THEN analyze evidence to identify failing component
86
+ THEN investigate that specific component
87
+ ```
88
+
89
+ **Example (multi-layer system):**
90
+ ```bash
91
+ # Layer 1: Workflow
92
+ echo "=== Secrets available in workflow: ==="
93
+ echo "IDENTITY: ${IDENTITY:+SET}${IDENTITY:-UNSET}"
94
+
95
+ # Layer 2: Build script
96
+ echo "=== Env vars in build script: ==="
97
+ env | grep IDENTITY || echo "IDENTITY not in environment"
98
+
99
+ # Layer 3: Signing script
100
+ echo "=== Keychain state: ==="
101
+ security list-keychains
102
+ security find-identity -v
103
+
104
+ # Layer 4: Actual signing
105
+ codesign --sign "$IDENTITY" --verbose=4 "$APP"
106
+ ```
107
+
108
+ **This reveals:** Which layer fails (secrets → workflow ✓, workflow → build ✗)
109
+
110
+ 5. **Trace Data Flow**
111
+
112
+ **WHEN error is deep in call stack:**
113
+
114
+ See `root-cause-tracing.md` in this directory for the complete backward tracing technique.
115
+
116
+ **Quick version:**
117
+ - Where does bad value originate?
118
+ - What called this with bad value?
119
+ - Keep tracing up until you find the source
120
+ - Fix at source, not at symptom
121
+
122
+ ### Phase 2: Pattern Analysis
123
+
124
+ **Find the pattern before fixing:**
125
+
126
+ 1. **Find Working Examples**
127
+ - Locate similar working code in same codebase
128
+ - What works that's similar to what's broken?
129
+
130
+ 2. **Compare Against References**
131
+ - If implementing pattern, read reference implementation COMPLETELY
132
+ - Don't skim - read every line
133
+ - Understand the pattern fully before applying
134
+
135
+ 3. **Identify Differences**
136
+ - What's different between working and broken?
137
+ - List every difference, however small
138
+ - Don't assume "that can't matter"
139
+
140
+ 4. **Understand Dependencies**
141
+ - What other components does this need?
142
+ - What settings, config, environment?
143
+ - What assumptions does it make?
144
+
145
+ ### Phase 3: Hypothesis and Testing
146
+
147
+ **Scientific method:**
148
+
149
+ 1. **Form Single Hypothesis**
150
+ - State clearly: "I think X is the root cause because Y"
151
+ - Write it down
152
+ - Be specific, not vague
153
+
154
+ 2. **Test Minimally**
155
+ - Make the SMALLEST possible change to test hypothesis
156
+ - One variable at a time
157
+ - Don't fix multiple things at once
158
+
159
+ 3. **Verify Before Continuing**
160
+ - Did it work? Yes → Phase 4
161
+ - Didn't work? Form NEW hypothesis
162
+ - DON'T add more fixes on top
163
+
164
+ 4. **When You Don't Know**
165
+ - Say "I don't understand X"
166
+ - Don't pretend to know
167
+ - Ask for help
168
+ - Research more
169
+
170
+ ### Phase 4: Implementation
171
+
172
+ **Fix the root cause, not the symptom:**
173
+
174
+ 1. **Create Failing Test Case**
175
+ - Simplest possible reproduction
176
+ - Automated test if possible
177
+ - One-off test script if no framework
178
+ - MUST have before fixing
179
+ - Use the `superpowers:test-driven-development` skill for writing proper failing tests
180
+
181
+ 2. **Implement Single Fix**
182
+ - Address the root cause identified
183
+ - ONE change at a time
184
+ - No "while I'm here" improvements
185
+ - No bundled refactoring
186
+
187
+ 3. **Verify Fix**
188
+ - Test passes now?
189
+ - No other tests broken?
190
+ - Issue actually resolved?
191
+
192
+ 4. **If Fix Doesn't Work**
193
+ - STOP
194
+ - Count: How many fixes have you tried?
195
+ - If < 3: Return to Phase 1, re-analyze with new information
196
+ - **If ≥ 3: STOP and question the architecture (step 5 below)**
197
+ - DON'T attempt Fix #4 without architectural discussion
198
+
199
+ 5. **If 3+ Fixes Failed: Question Architecture**
200
+
201
+ **Pattern indicating architectural problem:**
202
+ - Each fix reveals new shared state/coupling/problem in different place
203
+ - Fixes require "massive refactoring" to implement
204
+ - Each fix creates new symptoms elsewhere
205
+
206
+ **STOP and question fundamentals:**
207
+ - Is this pattern fundamentally sound?
208
+ - Are we "sticking with it through sheer inertia"?
209
+ - Should we refactor architecture vs. continue fixing symptoms?
210
+
211
+ **Discuss with your human partner before attempting more fixes**
212
+
213
+ This is NOT a failed hypothesis - this is a wrong architecture.
214
+
215
+ ## Red Flags - STOP and Follow Process
216
+
217
+ If you catch yourself thinking:
218
+ - "Quick fix for now, investigate later"
219
+ - "Just try changing X and see if it works"
220
+ - "Add multiple changes, run tests"
221
+ - "Skip the test, I'll manually verify"
222
+ - "It's probably X, let me fix that"
223
+ - "I don't fully understand but this might work"
224
+ - "Pattern says X but I'll adapt it differently"
225
+ - "Here are the main problems: [lists fixes without investigation]"
226
+ - Proposing solutions before tracing data flow
227
+ - **"One more fix attempt" (when already tried 2+)**
228
+ - **Each fix reveals new problem in different place**
229
+
230
+ **ALL of these mean: STOP. Return to Phase 1.**
231
+
232
+ **If 3+ fixes failed:** Question the architecture (see Phase 4.5)
233
+
234
+ ## your human partner's Signals You're Doing It Wrong
235
+
236
+ **Watch for these redirections:**
237
+ - "Is that not happening?" - You assumed without verifying
238
+ - "Will it show us...?" - You should have added evidence gathering
239
+ - "Stop guessing" - You're proposing fixes without understanding
240
+ - "Ultrathink this" - Question fundamentals, not just symptoms
241
+ - "We're stuck?" (frustrated) - Your approach isn't working
242
+
243
+ **When you see these:** STOP. Return to Phase 1.
244
+
245
+ ## Common Rationalizations
246
+
247
+ | Excuse | Reality |
248
+ |--------|---------|
249
+ | "Issue is simple, don't need process" | Simple issues have root causes too. Process is fast for simple bugs. |
250
+ | "Emergency, no time for process" | Systematic debugging is FASTER than guess-and-check thrashing. |
251
+ | "Just try this first, then investigate" | First fix sets the pattern. Do it right from the start. |
252
+ | "I'll write test after confirming fix works" | Untested fixes don't stick. Test first proves it. |
253
+ | "Multiple fixes at once saves time" | Can't isolate what worked. Causes new bugs. |
254
+ | "Reference too long, I'll adapt the pattern" | Partial understanding guarantees bugs. Read it completely. |
255
+ | "I see the problem, let me fix it" | Seeing symptoms ≠ understanding root cause. |
256
+ | "One more fix attempt" (after 2+ failures) | 3+ failures = architectural problem. Question pattern, don't fix again. |
257
+
258
+ ## Quick Reference
259
+
260
+ | Phase | Key Activities | Success Criteria |
261
+ |-------|---------------|------------------|
262
+ | **1. Root Cause** | Read errors, reproduce, check changes, gather evidence | Understand WHAT and WHY |
263
+ | **2. Pattern** | Find working examples, compare | Identify differences |
264
+ | **3. Hypothesis** | Form theory, test minimally | Confirmed or new hypothesis |
265
+ | **4. Implementation** | Create test, fix, verify | Bug resolved, tests pass |
266
+
267
+ ## When Process Reveals "No Root Cause"
268
+
269
+ If systematic investigation reveals issue is truly environmental, timing-dependent, or external:
270
+
271
+ 1. You've completed the process
272
+ 2. Document what you investigated
273
+ 3. Implement appropriate handling (retry, timeout, error message)
274
+ 4. Add monitoring/logging for future investigation
275
+
276
+ **But:** 95% of "no root cause" cases are incomplete investigation.
277
+
278
+ ## Supporting Techniques
279
+
280
+ These techniques are part of systematic debugging and available in this directory:
281
+
282
+ - **`root-cause-tracing.md`** - Trace bugs backward through call stack to find original trigger
283
+ - **`defense-in-depth.md`** - Add validation at multiple layers after finding root cause
284
+ - **`condition-based-waiting.md`** - Replace arbitrary timeouts with condition polling
285
+
286
+ **Related skills:**
287
+ - **superpowers:test-driven-development** - For creating failing test case (Phase 4, Step 1)
288
+ - **superpowers:verification-before-completion** - Verify fix worked before claiming success
289
+
290
+ ## Real-World Impact
291
+
292
+ From debugging sessions:
293
+ - Systematic approach: 15-30 minutes to fix
294
+ - Random fixes approach: 2-3 hours of thrashing
295
+ - First-time fix rate: 95% vs 40%
296
+ - New bugs introduced: Near zero vs common
@@ -0,0 +1,158 @@
1
+ // Complete implementation of condition-based waiting utilities
2
+ // From: Lace test infrastructure improvements (2025-10-03)
3
+ // Context: Fixed 15 flaky tests by replacing arbitrary timeouts
4
+
5
+ import type { ThreadManager } from '~/threads/thread-manager';
6
+ import type { LaceEvent, LaceEventType } from '~/threads/types';
7
+
8
+ /**
9
+ * Wait for a specific event type to appear in thread
10
+ *
11
+ * @param threadManager - The thread manager to query
12
+ * @param threadId - Thread to check for events
13
+ * @param eventType - Type of event to wait for
14
+ * @param timeoutMs - Maximum time to wait (default 5000ms)
15
+ * @returns Promise resolving to the first matching event
16
+ *
17
+ * Example:
18
+ * await waitForEvent(threadManager, agentThreadId, 'TOOL_RESULT');
19
+ */
20
+ export function waitForEvent(
21
+ threadManager: ThreadManager,
22
+ threadId: string,
23
+ eventType: LaceEventType,
24
+ timeoutMs = 5000
25
+ ): Promise<LaceEvent> {
26
+ return new Promise((resolve, reject) => {
27
+ const startTime = Date.now();
28
+
29
+ const check = () => {
30
+ const events = threadManager.getEvents(threadId);
31
+ const event = events.find((e) => e.type === eventType);
32
+
33
+ if (event) {
34
+ resolve(event);
35
+ } else if (Date.now() - startTime > timeoutMs) {
36
+ reject(new Error(`Timeout waiting for ${eventType} event after ${timeoutMs}ms`));
37
+ } else {
38
+ setTimeout(check, 10); // Poll every 10ms for efficiency
39
+ }
40
+ };
41
+
42
+ check();
43
+ });
44
+ }
45
+
46
+ /**
47
+ * Wait for a specific number of events of a given type
48
+ *
49
+ * @param threadManager - The thread manager to query
50
+ * @param threadId - Thread to check for events
51
+ * @param eventType - Type of event to wait for
52
+ * @param count - Number of events to wait for
53
+ * @param timeoutMs - Maximum time to wait (default 5000ms)
54
+ * @returns Promise resolving to all matching events once count is reached
55
+ *
56
+ * Example:
57
+ * // Wait for 2 AGENT_MESSAGE events (initial response + continuation)
58
+ * await waitForEventCount(threadManager, agentThreadId, 'AGENT_MESSAGE', 2);
59
+ */
60
+ export function waitForEventCount(
61
+ threadManager: ThreadManager,
62
+ threadId: string,
63
+ eventType: LaceEventType,
64
+ count: number,
65
+ timeoutMs = 5000
66
+ ): Promise<LaceEvent[]> {
67
+ return new Promise((resolve, reject) => {
68
+ const startTime = Date.now();
69
+
70
+ const check = () => {
71
+ const events = threadManager.getEvents(threadId);
72
+ const matchingEvents = events.filter((e) => e.type === eventType);
73
+
74
+ if (matchingEvents.length >= count) {
75
+ resolve(matchingEvents);
76
+ } else if (Date.now() - startTime > timeoutMs) {
77
+ reject(
78
+ new Error(
79
+ `Timeout waiting for ${count} ${eventType} events after ${timeoutMs}ms (got ${matchingEvents.length})`
80
+ )
81
+ );
82
+ } else {
83
+ setTimeout(check, 10);
84
+ }
85
+ };
86
+
87
+ check();
88
+ });
89
+ }
90
+
91
+ /**
92
+ * Wait for an event matching a custom predicate
93
+ * Useful when you need to check event data, not just type
94
+ *
95
+ * @param threadManager - The thread manager to query
96
+ * @param threadId - Thread to check for events
97
+ * @param predicate - Function that returns true when event matches
98
+ * @param description - Human-readable description for error messages
99
+ * @param timeoutMs - Maximum time to wait (default 5000ms)
100
+ * @returns Promise resolving to the first matching event
101
+ *
102
+ * Example:
103
+ * // Wait for TOOL_RESULT with specific ID
104
+ * await waitForEventMatch(
105
+ * threadManager,
106
+ * agentThreadId,
107
+ * (e) => e.type === 'TOOL_RESULT' && e.data.id === 'call_123',
108
+ * 'TOOL_RESULT with id=call_123'
109
+ * );
110
+ */
111
+ export function waitForEventMatch(
112
+ threadManager: ThreadManager,
113
+ threadId: string,
114
+ predicate: (event: LaceEvent) => boolean,
115
+ description: string,
116
+ timeoutMs = 5000
117
+ ): Promise<LaceEvent> {
118
+ return new Promise((resolve, reject) => {
119
+ const startTime = Date.now();
120
+
121
+ const check = () => {
122
+ const events = threadManager.getEvents(threadId);
123
+ const event = events.find(predicate);
124
+
125
+ if (event) {
126
+ resolve(event);
127
+ } else if (Date.now() - startTime > timeoutMs) {
128
+ reject(new Error(`Timeout waiting for ${description} after ${timeoutMs}ms`));
129
+ } else {
130
+ setTimeout(check, 10);
131
+ }
132
+ };
133
+
134
+ check();
135
+ });
136
+ }
137
+
138
+ // Usage example from actual debugging session:
139
+ //
140
+ // BEFORE (flaky):
141
+ // ---------------
142
+ // const messagePromise = agent.sendMessage('Execute tools');
143
+ // await new Promise(r => setTimeout(r, 300)); // Hope tools start in 300ms
144
+ // agent.abort();
145
+ // await messagePromise;
146
+ // await new Promise(r => setTimeout(r, 50)); // Hope results arrive in 50ms
147
+ // expect(toolResults.length).toBe(2); // Fails randomly
148
+ //
149
+ // AFTER (reliable):
150
+ // ----------------
151
+ // const messagePromise = agent.sendMessage('Execute tools');
152
+ // await waitForEventCount(threadManager, threadId, 'TOOL_CALL', 2); // Wait for tools to start
153
+ // agent.abort();
154
+ // await messagePromise;
155
+ // await waitForEventCount(threadManager, threadId, 'TOOL_RESULT', 2); // Wait for results
156
+ // expect(toolResults.length).toBe(2); // Always succeeds
157
+ //
158
+ // Result: 60% pass rate → 100%, 40% faster execution
@@ -0,0 +1,115 @@
1
+ # Condition-Based Waiting
2
+
3
+ ## Overview
4
+
5
+ Flaky tests often guess at timing with arbitrary delays. This creates race conditions where tests pass on fast machines but fail under load or in CI.
6
+
7
+ **Core principle:** Wait for the actual condition you care about, not a guess about how long it takes.
8
+
9
+ ## When to Use
10
+
11
+ ```dot
12
+ digraph when_to_use {
13
+ "Test uses setTimeout/sleep?" [shape=diamond];
14
+ "Testing timing behavior?" [shape=diamond];
15
+ "Document WHY timeout needed" [shape=box];
16
+ "Use condition-based waiting" [shape=box];
17
+
18
+ "Test uses setTimeout/sleep?" -> "Testing timing behavior?" [label="yes"];
19
+ "Testing timing behavior?" -> "Document WHY timeout needed" [label="yes"];
20
+ "Testing timing behavior?" -> "Use condition-based waiting" [label="no"];
21
+ }
22
+ ```
23
+
24
+ **Use when:**
25
+ - Tests have arbitrary delays (`setTimeout`, `sleep`, `time.sleep()`)
26
+ - Tests are flaky (pass sometimes, fail under load)
27
+ - Tests timeout when run in parallel
28
+ - Waiting for async operations to complete
29
+
30
+ **Don't use when:**
31
+ - Testing actual timing behavior (debounce, throttle intervals)
32
+ - Always document WHY if using arbitrary timeout
33
+
34
+ ## Core Pattern
35
+
36
+ ```typescript
37
+ // ❌ BEFORE: Guessing at timing
38
+ await new Promise(r => setTimeout(r, 50));
39
+ const result = getResult();
40
+ expect(result).toBeDefined();
41
+
42
+ // ✅ AFTER: Waiting for condition
43
+ await waitFor(() => getResult() !== undefined);
44
+ const result = getResult();
45
+ expect(result).toBeDefined();
46
+ ```
47
+
48
+ ## Quick Patterns
49
+
50
+ | Scenario | Pattern |
51
+ |----------|---------|
52
+ | Wait for event | `waitFor(() => events.find(e => e.type === 'DONE'))` |
53
+ | Wait for state | `waitFor(() => machine.state === 'ready')` |
54
+ | Wait for count | `waitFor(() => items.length >= 5)` |
55
+ | Wait for file | `waitFor(() => fs.existsSync(path))` |
56
+ | Complex condition | `waitFor(() => obj.ready && obj.value > 10)` |
57
+
58
+ ## Implementation
59
+
60
+ Generic polling function:
61
+ ```typescript
62
+ async function waitFor<T>(
63
+ condition: () => T | undefined | null | false,
64
+ description: string,
65
+ timeoutMs = 5000
66
+ ): Promise<T> {
67
+ const startTime = Date.now();
68
+
69
+ while (true) {
70
+ const result = condition();
71
+ if (result) return result;
72
+
73
+ if (Date.now() - startTime > timeoutMs) {
74
+ throw new Error(`Timeout waiting for ${description} after ${timeoutMs}ms`);
75
+ }
76
+
77
+ await new Promise(r => setTimeout(r, 10)); // Poll every 10ms
78
+ }
79
+ }
80
+ ```
81
+
82
+ See `condition-based-waiting-example.ts` in this directory for complete implementation with domain-specific helpers (`waitForEvent`, `waitForEventCount`, `waitForEventMatch`) from actual debugging session.
83
+
84
+ ## Common Mistakes
85
+
86
+ **❌ Polling too fast:** `setTimeout(check, 1)` - wastes CPU
87
+ **✅ Fix:** Poll every 10ms
88
+
89
+ **❌ No timeout:** Loop forever if condition never met
90
+ **✅ Fix:** Always include timeout with clear error
91
+
92
+ **❌ Stale data:** Cache state before loop
93
+ **✅ Fix:** Call getter inside loop for fresh data
94
+
95
+ ## When Arbitrary Timeout IS Correct
96
+
97
+ ```typescript
98
+ // Tool ticks every 100ms - need 2 ticks to verify partial output
99
+ await waitForEvent(manager, 'TOOL_STARTED'); // First: wait for condition
100
+ await new Promise(r => setTimeout(r, 200)); // Then: wait for timed behavior
101
+ // 200ms = 2 ticks at 100ms intervals - documented and justified
102
+ ```
103
+
104
+ **Requirements:**
105
+ 1. First wait for triggering condition
106
+ 2. Based on known timing (not guessing)
107
+ 3. Comment explaining WHY
108
+
109
+ ## Real-World Impact
110
+
111
+ From debugging session (2025-10-03):
112
+ - Fixed 15 flaky tests across 3 files
113
+ - Pass rate: 60% → 100%
114
+ - Execution time: 40% faster
115
+ - No more race conditions