tribunal-kit 8.0.0 → 9.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 (258) hide show
  1. package/.agent/ARCHITECTURE.md +2 -2
  2. package/.agent/config/plugin.json +4 -4
  3. package/.agent/config/system-prompt.md +54 -1
  4. package/.agent/routing_index.json +2 -2
  5. package/.agent/skills/12-principles-of-animation/SKILL.md +19 -16
  6. package/.agent/skills/60fps-animation/SKILL.md +47 -21
  7. package/.agent/skills/accessible-animation/SKILL.md +19 -16
  8. package/.agent/skills/adapt/SKILL.md +19 -16
  9. package/.agent/skills/advanced-rag-pipelines/SKILL.md +41 -40
  10. package/.agent/skills/agent-organizer/SKILL.md +9 -59
  11. package/.agent/skills/agentic-patterns/SKILL.md +9 -57
  12. package/.agent/skills/agentic-workflows-2026/SKILL.md +45 -8
  13. package/.agent/skills/ai-app-hardening/SKILL.md +31 -5
  14. package/.agent/skills/ai-prompt-injection-defense/SKILL.md +28 -66
  15. package/.agent/skills/animation-on-scroll/SKILL.md +19 -16
  16. package/.agent/skills/animation-systems/SKILL.md +19 -15
  17. package/.agent/skills/antfu-conventions/SKILL.md +19 -18
  18. package/.agent/skills/api-patterns/SKILL.md +8 -58
  19. package/.agent/skills/api-security-auditor/SKILL.md +8 -58
  20. package/.agent/skills/app-builder/SKILL.md +9 -59
  21. package/.agent/skills/appflow-wireframe/SKILL.md +13 -57
  22. package/.agent/skills/apple-design/SKILL.md +22 -14
  23. package/.agent/skills/architecture/SKILL.md +9 -59
  24. package/.agent/skills/audit-and-fix/SKILL.md +19 -16
  25. package/.agent/skills/authentication-best-practices/SKILL.md +8 -58
  26. package/.agent/skills/backend-security-expert/SKILL.md +32 -65
  27. package/.agent/skills/baseline-ui/SKILL.md +22 -14
  28. package/.agent/skills/bash-linux/SKILL.md +9 -59
  29. package/.agent/skills/behavioral-modes/SKILL.md +9 -57
  30. package/.agent/skills/better-colors/SKILL.md +22 -14
  31. package/.agent/skills/better-typography/SKILL.md +26 -14
  32. package/.agent/skills/better-ui/SKILL.md +54 -19
  33. package/.agent/skills/bolder/SKILL.md +19 -16
  34. package/.agent/skills/brainstorming/SKILL.md +9 -57
  35. package/.agent/skills/browser-native-ai/SKILL.md +9 -28
  36. package/.agent/skills/build-primitive/SKILL.md +19 -16
  37. package/.agent/skills/building-native-ui/SKILL.md +9 -59
  38. package/.agent/skills/cicd-pro/SKILL.md +21 -28
  39. package/.agent/skills/clarify/SKILL.md +19 -16
  40. package/.agent/skills/clean-code/SKILL.md +18 -61
  41. package/.agent/skills/cloud-architect/SKILL.md +21 -28
  42. package/.agent/skills/cobejs/SKILL.md +19 -15
  43. package/.agent/skills/code-review-checklist/SKILL.md +8 -58
  44. package/.agent/skills/codebase-design/SKILL.md +33 -22
  45. package/.agent/skills/colorize/SKILL.md +19 -16
  46. package/.agent/skills/compact-landing/SKILL.md +19 -16
  47. package/.agent/skills/company-logos/SKILL.md +19 -16
  48. package/.agent/skills/config-validator/SKILL.md +9 -59
  49. package/.agent/skills/containerization-pro/SKILL.md +21 -28
  50. package/.agent/skills/context-engineering-pro/SKILL.md +31 -5
  51. package/.agent/skills/create-design-md/SKILL.md +22 -14
  52. package/.agent/skills/critique/SKILL.md +20 -11
  53. package/.agent/skills/csharp-developer/SKILL.md +8 -58
  54. package/.agent/skills/data-validation-schemas/SKILL.md +9 -59
  55. package/.agent/skills/database-design/SKILL.md +27 -67
  56. package/.agent/skills/delight/SKILL.md +19 -16
  57. package/.agent/skills/deployment-procedures/SKILL.md +9 -59
  58. package/.agent/skills/design-lab/SKILL.md +19 -16
  59. package/.agent/skills/devops-engineer/SKILL.md +8 -58
  60. package/.agent/skills/devops-incident-responder/SKILL.md +9 -59
  61. package/.agent/skills/diagnosing-bugs/SKILL.md +20 -21
  62. package/.agent/skills/distill/SKILL.md +19 -16
  63. package/.agent/skills/documentation-templates/SKILL.md +9 -59
  64. package/.agent/skills/domain-modeling/SKILL.md +19 -18
  65. package/.agent/skills/duckdb-analytical-sql/SKILL.md +31 -5
  66. package/.agent/skills/edge-ai-mobile/SKILL.md +31 -5
  67. package/.agent/skills/edge-computing/SKILL.md +9 -59
  68. package/.agent/skills/emil-design-eng/SKILL.md +21 -24
  69. package/.agent/skills/error-resilience/SKILL.md +31 -66
  70. package/.agent/skills/expo-router-v4/SKILL.md +31 -5
  71. package/.agent/skills/extract-design-system/SKILL.md +9 -59
  72. package/.agent/skills/fabel-protocol/SKILL.md +26 -8
  73. package/.agent/skills/fixing-accessibility/SKILL.md +22 -14
  74. package/.agent/skills/fixing-metadata/SKILL.md +19 -16
  75. package/.agent/skills/fixing-motion-performance/SKILL.md +22 -14
  76. package/.agent/skills/framer-motion-expert/SKILL.md +9 -57
  77. package/.agent/skills/frontend-design/SKILL.md +27 -7
  78. package/.agent/skills/frontend-security-expert/SKILL.md +8 -58
  79. package/.agent/skills/game-design-expert/SKILL.md +9 -59
  80. package/.agent/skills/game-engineering-expert/SKILL.md +9 -59
  81. package/.agent/skills/generative-ui-expert/SKILL.md +9 -28
  82. package/.agent/skills/geo-fundamentals/SKILL.md +9 -59
  83. package/.agent/skills/git-pro/SKILL.md +19 -30
  84. package/.agent/skills/github-operations/SKILL.md +8 -58
  85. package/.agent/skills/gpt-taste/SKILL.md +19 -16
  86. package/.agent/skills/gsap-core/SKILL.md +8 -78
  87. package/.agent/skills/gsap-frameworks/SKILL.md +8 -78
  88. package/.agent/skills/gsap-performance/SKILL.md +9 -77
  89. package/.agent/skills/gsap-plugins/SKILL.md +9 -77
  90. package/.agent/skills/gsap-react/SKILL.md +9 -21
  91. package/.agent/skills/gsap-scrolltrigger/SKILL.md +8 -78
  92. package/.agent/skills/gsap-timeline/SKILL.md +9 -77
  93. package/.agent/skills/gsap-utils/SKILL.md +9 -77
  94. package/.agent/skills/harden/SKILL.md +19 -16
  95. package/.agent/skills/harness-protocol/SKILL.md +9 -21
  96. package/.agent/skills/i18n-localization/SKILL.md +9 -59
  97. package/.agent/skills/impeccable/SKILL.md +19 -18
  98. package/.agent/skills/improve-codebase-architecture/SKILL.md +19 -17
  99. package/.agent/skills/improve-ui/SKILL.md +22 -14
  100. package/.agent/skills/intelligent-routing/SKILL.md +9 -23
  101. package/.agent/skills/knowledge-graph/SKILL.md +9 -21
  102. package/.agent/skills/landing-page/SKILL.md +19 -16
  103. package/.agent/skills/lint-and-validate/SKILL.md +9 -59
  104. package/.agent/skills/llm-engineering/SKILL.md +8 -58
  105. package/.agent/skills/local-first/SKILL.md +9 -59
  106. package/.agent/skills/local-first-architecture/SKILL.md +37 -20
  107. package/.agent/skills/lottie-animation/SKILL.md +19 -15
  108. package/.agent/skills/marquee-loop/SKILL.md +19 -16
  109. package/.agent/skills/masked-reveal/SKILL.md +19 -15
  110. package/.agent/skills/mcp-builder/SKILL.md +9 -59
  111. package/.agent/skills/micro-interaction/SKILL.md +19 -16
  112. package/.agent/skills/mobile-design/SKILL.md +8 -58
  113. package/.agent/skills/monorepo-management/SKILL.md +9 -59
  114. package/.agent/skills/morphing-icons/SKILL.md +19 -15
  115. package/.agent/skills/motion-engineering/SKILL.md +22 -15
  116. package/.agent/skills/nextjs-react-expert/SKILL.md +35 -67
  117. package/.agent/skills/nodejs-best-practices/SKILL.md +34 -61
  118. package/.agent/skills/observability/SKILL.md +8 -58
  119. package/.agent/skills/opentelemetry-observability/SKILL.md +31 -5
  120. package/.agent/skills/page-transition-animation/SKILL.md +19 -16
  121. package/.agent/skills/parallel-agents/SKILL.md +9 -59
  122. package/.agent/skills/performance-profiling/SKILL.md +8 -58
  123. package/.agent/skills/plan-writing/SKILL.md +36 -69
  124. package/.agent/skills/platform-engineer/SKILL.md +9 -59
  125. package/.agent/skills/platform-engineering-opentofu/SKILL.md +31 -5
  126. package/.agent/skills/playwright-ai-e2e/SKILL.md +31 -5
  127. package/.agent/skills/playwright-best-practices/SKILL.md +9 -59
  128. package/.agent/skills/polish/SKILL.md +19 -16
  129. package/.agent/skills/powershell-windows/SKILL.md +8 -58
  130. package/.agent/skills/pricing-page/SKILL.md +19 -16
  131. package/.agent/skills/product-aware-heuristics/SKILL.md +27 -8
  132. package/.agent/skills/progressive-blur/SKILL.md +19 -16
  133. package/.agent/skills/project-idioms/SKILL.md +9 -59
  134. package/.agent/skills/property-based-testing/SKILL.md +31 -5
  135. package/.agent/skills/python-patterns/SKILL.md +9 -59
  136. package/.agent/skills/python-pro/SKILL.md +35 -67
  137. package/.agent/skills/quieter/SKILL.md +19 -16
  138. package/.agent/skills/react-doctor/SKILL.md +19 -16
  139. package/.agent/skills/react-specialist/SKILL.md +26 -65
  140. package/.agent/skills/readme-builder/SKILL.md +9 -59
  141. package/.agent/skills/realtime-patterns/SKILL.md +8 -58
  142. package/.agent/skills/red-team-tactics/SKILL.md +9 -59
  143. package/.agent/skills/redesign-skill/SKILL.md +19 -16
  144. package/.agent/skills/review-animations/SKILL.md +21 -25
  145. package/.agent/skills/rust-pro/SKILL.md +30 -61
  146. package/.agent/skills/seo-fundamentals/SKILL.md +9 -59
  147. package/.agent/skills/server-management/SKILL.md +9 -59
  148. package/.agent/skills/shadcn-ui-expert/SKILL.md +9 -59
  149. package/.agent/skills/shape/SKILL.md +19 -16
  150. package/.agent/skills/skill-creator/SKILL.md +36 -86
  151. package/.agent/skills/soft-skill/SKILL.md +19 -16
  152. package/.agent/skills/sounds-on-the-web/SKILL.md +19 -16
  153. package/.agent/skills/sql-pro/SKILL.md +47 -62
  154. package/.agent/skills/supabase-postgres-best-practices/SKILL.md +9 -59
  155. package/.agent/skills/svg-animation/SKILL.md +19 -15
  156. package/.agent/skills/swiftui-expert/SKILL.md +9 -59
  157. package/.agent/skills/swiss-design/SKILL.md +19 -16
  158. package/.agent/skills/system-design-pro/SKILL.md +21 -26
  159. package/.agent/skills/systematic-debugging/SKILL.md +19 -60
  160. package/.agent/skills/systematic-debugging/condition-based-waiting.md +115 -0
  161. package/.agent/skills/systematic-debugging/defense-in-depth.md +122 -0
  162. package/.agent/skills/systematic-debugging/root-cause-tracing.md +169 -0
  163. package/.agent/skills/tailwind-patterns/SKILL.md +8 -58
  164. package/.agent/skills/taste-skill/SKILL.md +19 -16
  165. package/.agent/skills/tdd-workflow/SKILL.md +65 -25
  166. package/.agent/skills/test-result-analyzer/SKILL.md +9 -59
  167. package/.agent/skills/testing-patterns/SKILL.md +8 -58
  168. package/.agent/skills/thermo-nuclear-code-quality-review/SKILL.md +19 -18
  169. package/.agent/skills/thinking-protocol/SKILL.md +33 -2
  170. package/.agent/skills/to-spring-or-not-to-spring/SKILL.md +19 -15
  171. package/.agent/skills/transitions-dev/SKILL.md +19 -15
  172. package/.agent/skills/trend-researcher/SKILL.md +9 -59
  173. package/.agent/skills/typescript-advanced/SKILL.md +21 -64
  174. package/.agent/skills/typeset/SKILL.md +19 -16
  175. package/.agent/skills/ui-reasoning-engine/SKILL.md +27 -8
  176. package/.agent/skills/ui-skill-packs/SKILL.md +26 -16
  177. package/.agent/skills/ui-skills-root/SKILL.md +22 -14
  178. package/.agent/skills/ui-ux-pro-max/SKILL.md +38 -12
  179. package/.agent/skills/ui-ux-researcher/SKILL.md +9 -59
  180. package/.agent/skills/vector-search-pgvector/SKILL.md +31 -5
  181. package/.agent/skills/verification-before-completion/SKILL.md +125 -0
  182. package/.agent/skills/vue-expert/SKILL.md +9 -57
  183. package/.agent/skills/vulnerability-scanner/SKILL.md +8 -58
  184. package/.agent/skills/web-accessibility-auditor/SKILL.md +9 -59
  185. package/.agent/skills/web-design-guidelines/SKILL.md +27 -7
  186. package/.agent/skills/web-quality-audit/SKILL.md +19 -16
  187. package/.agent/skills/webapp-testing/SKILL.md +9 -59
  188. package/.agent/skills/webgpu-performance/SKILL.md +9 -28
  189. package/.agent/skills/whimsy-injector/SKILL.md +9 -57
  190. package/.agent/skills/workflow-optimizer/SKILL.md +9 -57
  191. package/.agent/skills/zero-trust-passkeys/SKILL.md +31 -5
  192. package/.agent/templates/DESIGN.md +680 -160
  193. package/.agent/templates/sdd/implementer-prompt.md +53 -0
  194. package/.agent/templates/sdd/re-review-prompt.md +28 -0
  195. package/.agent/templates/sdd/task-reviewer-prompt.md +59 -0
  196. package/.agent/workflows/acf.md +4 -0
  197. package/.agent/workflows/api-tester.md +5 -0
  198. package/.agent/workflows/audit.md +5 -0
  199. package/.agent/workflows/brainstorm.md +17 -1
  200. package/.agent/workflows/changelog.md +5 -0
  201. package/.agent/workflows/contract.md +19 -0
  202. package/.agent/workflows/create.md +6 -1
  203. package/.agent/workflows/debug.md +5 -0
  204. package/.agent/workflows/deploy.md +6 -1
  205. package/.agent/workflows/enhance.md +6 -1
  206. package/.agent/workflows/fix-ci.md +5 -0
  207. package/.agent/workflows/fix.md +5 -0
  208. package/.agent/workflows/generate.md +5 -0
  209. package/.agent/workflows/marathon.md +6 -1
  210. package/.agent/workflows/migrate.md +5 -0
  211. package/.agent/workflows/minimal.md +4 -0
  212. package/.agent/workflows/orchestrate.md +6 -1
  213. package/.agent/workflows/performance-benchmarker.md +6 -1
  214. package/.agent/workflows/pipeline.md +5 -0
  215. package/.agent/workflows/plan.md +6 -1
  216. package/.agent/workflows/preview.md +6 -1
  217. package/.agent/workflows/refactor.md +6 -0
  218. package/.agent/workflows/review-ai.md +5 -0
  219. package/.agent/workflows/review.md +5 -0
  220. package/.agent/workflows/sdd.md +122 -0
  221. package/.agent/workflows/session.md +5 -0
  222. package/.agent/workflows/status.md +4 -0
  223. package/.agent/workflows/super-prompt.md +4 -0
  224. package/.agent/workflows/swarm.md +6 -1
  225. package/.agent/workflows/test.md +6 -1
  226. package/.agent/workflows/tribunal-backend.md +5 -0
  227. package/.agent/workflows/tribunal-cicd.md +5 -0
  228. package/.agent/workflows/tribunal-database.md +5 -0
  229. package/.agent/workflows/tribunal-full.md +8 -0
  230. package/.agent/workflows/tribunal-mobile.md +5 -0
  231. package/.agent/workflows/tribunal-performance.md +5 -0
  232. package/.agent/workflows/tribunal-speed.md +5 -0
  233. package/.agent/workflows/tribunal-ui.md +7 -0
  234. package/.agents/plugins/marketplace.json +20 -0
  235. package/.claude-plugin/marketplace.json +17 -0
  236. package/.claude-plugin/plugin.json +26 -0
  237. package/.codex-plugin/plugin.json +45 -0
  238. package/.cursor-plugin/plugin.json +26 -0
  239. package/.devin-plugin/plugin.json +14 -0
  240. package/.hermes-plugin/__init__.py +102 -0
  241. package/.hermes-plugin/plugin.yaml +6 -0
  242. package/.kimi-plugin/plugin.json +38 -0
  243. package/.opencode/INSTALL.md +41 -0
  244. package/.opencode/plugins/tribunal.js +101 -0
  245. package/.pi/extensions/tribunal.ts +133 -0
  246. package/CONTRIBUTING.md +1 -1
  247. package/README.md +246 -221
  248. package/bin/wrapper.js +1 -0
  249. package/dist/cli.js +355 -355
  250. package/dist/esm/index.mjs +142 -142
  251. package/dist/index.d.ts +349 -343
  252. package/gemini-extension.json +6 -0
  253. package/hooks/hooks-cursor.json +16 -0
  254. package/hooks/hooks.json +16 -0
  255. package/hooks/session-start.js +77 -0
  256. package/package.json +165 -146
  257. package/scripts/audit_skill_sdo.js +87 -0
  258. package/scripts/modernize_skills.js +254 -0
@@ -2,8 +2,8 @@
2
2
  name: systematic-debugging
3
3
  description: Systematic debugging framework. Root-cause isolation, 4-phase methodology, hypothesis testing, log tracing, avoiding shotgun-surgery, memory allocation analysis, and empirical evidence gathering. Use when debugging complex, highly-coupled, or elusive bugs across mixed execution environments.
4
4
  tools: Read, Grep, Glob, Bash, Edit, Write
5
- version: 3.0.0
6
- last-updated: 2026-07-30
5
+ version: 4.0.0
6
+ last-updated: 2026-09-07
7
7
  skills:
8
8
  - diagnosing-bugs
9
9
  - test-result-analyzer
@@ -25,6 +25,12 @@ Before debugging issues or analyzing stack traces, you MUST inspect:
25
25
  2. Deterministic Reproduction Pre-requisite (Section 29) → Write a failing deterministic test/reproduction script FIRST before modifying code logic
26
26
  3. Stack Trace Application Line Extraction (Section 98) → Trace up past `node_modules` to locate the top-most application code frame you wrote
27
27
 
28
+
29
+ ## Activation Boundaries
30
+
31
+ - **Activate when:** Operating in tasks requiring Systematic debugging framework. Root-cause isolation, 4-phase methodology, hypothesis testing, log tracing, avoiding shotgun-surgery, memory allocation analysis, and empirical evidence gathering. Use when debugging complex, highly-coupled, or elusive bugs across mixed execution environments..
32
+ - **DO NOT activate when:** The task falls strictly outside systematic-debugging domain or belongs to a different dedicated specialist.
33
+
28
34
  ## Hallucination Traps (Read First)
29
35
 
30
36
  - ❌ Changing multiple things at once to fix a bug -> ✅ Change ONE variable at a time; multiple changes make it impossible to identify the fix
@@ -33,8 +39,6 @@ Before debugging issues or analyzing stack traces, you MUST inspect:
33
39
 
34
40
  ---
35
41
 
36
- # Systematic Debugging — Root Cause Mastery
37
-
38
42
  ---
39
43
 
40
44
  ## 1. The 4-Phase Debugging Methodology
@@ -69,7 +73,16 @@ Never jump straight into modifying code when a bug is reported.
69
73
 
70
74
  ---
71
75
 
72
- ## 2. Advanced Diagnostic Vectors
76
+ ## 2. Specialized Diagnostic Techniques
77
+
78
+ When debugging intricate or elusive bugs, reference these specialized technique guides:
79
+ - **Root Cause Tracing (`./root-cause-tracing.md`):** Trace backwards up the call stack to identify where invalid data originated, rather than fixing where the error appears.
80
+ - **Condition-Based Waiting (`./condition-based-waiting.md`):** Eliminate flaky tests and timing bugs by waiting for specific deterministic state conditions instead of arbitrary `setTimeout` or `sleep` calls.
81
+ - **Defense in Depth (`./defense-in-depth.md`):** Add validation and runtime assertions at multiple component boundaries.
82
+
83
+ ---
84
+
85
+ ## 3. Advanced Diagnostic Vectors
73
86
 
74
87
  When pure logic errors are ruled out, look for environmental factors.
75
88
 
@@ -132,69 +145,17 @@ AI coding assistants often fall into specific bad habits when dealing with this
132
145
 
133
146
  ---
134
147
 
135
- **Slash command: `/review` or `/tribunal-full`**
136
- **Active reviewers: `logic-reviewer` · `security-auditor`**
137
-
138
- ### ❌ Forbidden AI Tropes
139
-
140
- 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
141
- 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
142
- 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
143
-
144
- Review these questions before confirming output:
145
-
146
- ```
147
- ✅ Did I rely ONLY on real, verified tools and methods?
148
- ✅ Is this solution appropriately scoped to the user's constraints?
149
- ✅ Did I handle potential failure modes and edge cases?
150
- ✅ Have I avoided generic boilerplate that doesn't add value?
151
- ```
152
-
153
- ### 🛑 Verification-Before-Completion (VBC) Protocol
154
-
155
- **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
156
-
157
- - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
158
- - ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
159
-
160
- ## Pre-Flight Checklist
161
-
162
- - [ ] Have I reviewed the user's specific constraints and requests?
163
- - [ ] Have I checked the environment for relevant existing implementations?
164
-
165
- ## VBC Protocol (Verification-Before-Completion)
166
-
167
- You MUST verify existing code signatures and variables before attempting to modify or call them. No hallucination is permitted.
168
-
169
- ---
170
-
171
- ## 🤖 LLM-Specific Traps
172
-
173
- AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
174
-
175
- 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
176
- 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
177
- 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
178
- 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
179
- 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
180
-
181
- ---
182
-
183
- ## 🏛️ Tribunal Integration (Anti-Hallucination)
148
+ ## 🏛️ Tribunal Verification & Guardrails
184
149
 
185
150
  **Slash command: `/review` or `/tribunal-full`**
186
151
  **Active reviewers: `logic-reviewer` · `security-auditor`**
187
152
 
188
153
  ### ❌ Forbidden AI Tropes
189
-
190
154
  1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
191
155
  2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
192
156
  3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
193
157
 
194
158
  ### ✅ Pre-Flight Self-Audit
195
-
196
- Review these questions before confirming output:
197
-
198
159
  ```
199
160
  ✅ Did I rely ONLY on real, verified tools and methods?
200
161
  ✅ Is this solution appropriately scoped to the user's constraints?
@@ -203,8 +164,6 @@ Review these questions before confirming output:
203
164
  ```
204
165
 
205
166
  ### 🛑 Verification-Before-Completion (VBC) Protocol
206
-
207
167
  **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
208
-
209
168
  - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
210
169
  - ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
@@ -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
@@ -0,0 +1,122 @@
1
+ # Defense-in-Depth Validation
2
+
3
+ ## Overview
4
+
5
+ When you fix a bug caused by invalid data, adding validation at one place feels sufficient. But that single check can be bypassed by different code paths, refactoring, or mocks.
6
+
7
+ **Core principle:** Validate at EVERY layer data passes through. Make the bug structurally impossible.
8
+
9
+ ## Why Multiple Layers
10
+
11
+ Single validation: "We fixed the bug"
12
+ Multiple layers: "We made the bug impossible"
13
+
14
+ Different layers catch different cases:
15
+ - Entry validation catches most bugs
16
+ - Business logic catches edge cases
17
+ - Environment guards prevent context-specific dangers
18
+ - Debug logging helps when other layers fail
19
+
20
+ ## The Four Layers
21
+
22
+ ### Layer 1: Entry Point Validation
23
+ **Purpose:** Reject obviously invalid input at API boundary
24
+
25
+ ```typescript
26
+ function createProject(name: string, workingDirectory: string) {
27
+ if (!workingDirectory || workingDirectory.trim() === '') {
28
+ throw new Error('workingDirectory cannot be empty');
29
+ }
30
+ if (!existsSync(workingDirectory)) {
31
+ throw new Error(`workingDirectory does not exist: ${workingDirectory}`);
32
+ }
33
+ if (!statSync(workingDirectory).isDirectory()) {
34
+ throw new Error(`workingDirectory is not a directory: ${workingDirectory}`);
35
+ }
36
+ // ... proceed
37
+ }
38
+ ```
39
+
40
+ ### Layer 2: Business Logic Validation
41
+ **Purpose:** Ensure data makes sense for this operation
42
+
43
+ ```typescript
44
+ function initializeWorkspace(projectDir: string, sessionId: string) {
45
+ if (!projectDir) {
46
+ throw new Error('projectDir required for workspace initialization');
47
+ }
48
+ // ... proceed
49
+ }
50
+ ```
51
+
52
+ ### Layer 3: Environment Guards
53
+ **Purpose:** Prevent dangerous operations in specific contexts
54
+
55
+ ```typescript
56
+ async function gitInit(directory: string) {
57
+ // In tests, refuse git init outside temp directories
58
+ if (process.env.NODE_ENV === 'test') {
59
+ const normalized = normalize(resolve(directory));
60
+ const tmpDir = normalize(resolve(tmpdir()));
61
+
62
+ if (!normalized.startsWith(tmpDir)) {
63
+ throw new Error(
64
+ `Refusing git init outside temp dir during tests: ${directory}`
65
+ );
66
+ }
67
+ }
68
+ // ... proceed
69
+ }
70
+ ```
71
+
72
+ ### Layer 4: Debug Instrumentation
73
+ **Purpose:** Capture context for forensics
74
+
75
+ ```typescript
76
+ async function gitInit(directory: string) {
77
+ const stack = new Error().stack;
78
+ logger.debug('About to git init', {
79
+ directory,
80
+ cwd: process.cwd(),
81
+ stack,
82
+ });
83
+ // ... proceed
84
+ }
85
+ ```
86
+
87
+ ## Applying the Pattern
88
+
89
+ When you find a bug:
90
+
91
+ 1. **Trace the data flow** - Where does bad value originate? Where used?
92
+ 2. **Map all checkpoints** - List every point data passes through
93
+ 3. **Add validation at each layer** - Entry, business, environment, debug
94
+ 4. **Test each layer** - Try to bypass layer 1, verify layer 2 catches it
95
+
96
+ ## Example from Session
97
+
98
+ Bug: Empty `projectDir` caused `git init` in source code
99
+
100
+ **Data flow:**
101
+ 1. Test setup → empty string
102
+ 2. `Project.create(name, '')`
103
+ 3. `WorkspaceManager.createWorkspace('')`
104
+ 4. `git init` runs in `process.cwd()`
105
+
106
+ **Four layers added:**
107
+ - Layer 1: `Project.create()` validates not empty/exists/writable
108
+ - Layer 2: `WorkspaceManager` validates projectDir not empty
109
+ - Layer 3: `WorktreeManager` refuses git init outside tmpdir in tests
110
+ - Layer 4: Stack trace logging before git init
111
+
112
+ **Result:** All 1847 tests passed, bug impossible to reproduce
113
+
114
+ ## Key Insight
115
+
116
+ All four layers were necessary. During testing, each layer caught bugs the others missed:
117
+ - Different code paths bypassed entry validation
118
+ - Mocks bypassed business logic checks
119
+ - Edge cases on different platforms needed environment guards
120
+ - Debug logging identified structural misuse
121
+
122
+ **Don't stop at one validation point.** Add checks at every layer.
@@ -0,0 +1,169 @@
1
+ # Root Cause Tracing
2
+
3
+ ## Overview
4
+
5
+ Bugs often manifest deep in the call stack (git init in wrong directory, file created in wrong location, database opened with wrong path). Your instinct is to fix where the error appears, but that's treating a symptom.
6
+
7
+ **Core principle:** Trace backward through the call chain until you find the original trigger, then fix at the source.
8
+
9
+ ## When to Use
10
+
11
+ ```dot
12
+ digraph when_to_use {
13
+ "Bug appears deep in stack?" [shape=diamond];
14
+ "Can trace backwards?" [shape=diamond];
15
+ "Fix at symptom point" [shape=box];
16
+ "Trace to original trigger" [shape=box];
17
+ "BETTER: Also add defense-in-depth" [shape=box];
18
+
19
+ "Bug appears deep in stack?" -> "Can trace backwards?" [label="yes"];
20
+ "Can trace backwards?" -> "Trace to original trigger" [label="yes"];
21
+ "Can trace backwards?" -> "Fix at symptom point" [label="no - dead end"];
22
+ "Trace to original trigger" -> "BETTER: Also add defense-in-depth";
23
+ }
24
+ ```
25
+
26
+ **Use when:**
27
+ - Error happens deep in execution (not at entry point)
28
+ - Stack trace shows long call chain
29
+ - Unclear where invalid data originated
30
+ - Need to find which test/code triggers the problem
31
+
32
+ ## The Tracing Process
33
+
34
+ ### 1. Observe the Symptom
35
+ ```
36
+ Error: git init failed in ~/project/packages/core
37
+ ```
38
+
39
+ ### 2. Find Immediate Cause
40
+ **What code directly causes this?**
41
+ ```typescript
42
+ await execFileAsync('git', ['init'], { cwd: projectDir });
43
+ ```
44
+
45
+ ### 3. Ask: What Called This?
46
+ ```typescript
47
+ WorktreeManager.createSessionWorktree(projectDir, sessionId)
48
+ → called by Session.initializeWorkspace()
49
+ → called by Session.create()
50
+ → called by test at Project.create()
51
+ ```
52
+
53
+ ### 4. Keep Tracing Up
54
+ **What value was passed?**
55
+ - `projectDir = ''` (empty string!)
56
+ - Empty string as `cwd` resolves to `process.cwd()`
57
+ - That's the source code directory!
58
+
59
+ ### 5. Find Original Trigger
60
+ **Where did empty string come from?**
61
+ ```typescript
62
+ const context = setupCoreTest(); // Returns { tempDir: '' }
63
+ Project.create('name', context.tempDir); // Accessed before beforeEach!
64
+ ```
65
+
66
+ ## Adding Stack Traces
67
+
68
+ When you can't trace manually, add instrumentation:
69
+
70
+ ```typescript
71
+ // Before the problematic operation
72
+ async function gitInit(directory: string) {
73
+ const stack = new Error().stack;
74
+ console.error('DEBUG git init:', {
75
+ directory,
76
+ cwd: process.cwd(),
77
+ nodeEnv: process.env.NODE_ENV,
78
+ stack,
79
+ });
80
+
81
+ await execFileAsync('git', ['init'], { cwd: directory });
82
+ }
83
+ ```
84
+
85
+ **Critical:** Use `console.error()` in tests (not logger - may not show)
86
+
87
+ **Run and capture:**
88
+ ```bash
89
+ npm test 2>&1 | grep 'DEBUG git init'
90
+ ```
91
+
92
+ **Analyze stack traces:**
93
+ - Look for test file names
94
+ - Find the line number triggering the call
95
+ - Identify the pattern (same test? same parameter?)
96
+
97
+ ## Finding Which Test Causes Pollution
98
+
99
+ If something appears during tests but you don't know which test:
100
+
101
+ Use the bisection script `find-polluter.sh` in this directory:
102
+
103
+ ```bash
104
+ ./find-polluter.sh '.git' 'src/**/*.test.ts'
105
+ ```
106
+
107
+ Runs tests one-by-one, stops at first polluter. See script for usage.
108
+
109
+ ## Real Example: Empty projectDir
110
+
111
+ **Symptom:** `.git` created in `packages/core/` (source code)
112
+
113
+ **Trace chain:**
114
+ 1. `git init` runs in `process.cwd()` ← empty cwd parameter
115
+ 2. WorktreeManager called with empty projectDir
116
+ 3. Session.create() passed empty string
117
+ 4. Test accessed `context.tempDir` before beforeEach
118
+ 5. setupCoreTest() returns `{ tempDir: '' }` initially
119
+
120
+ **Root cause:** Top-level variable initialization accessing empty value
121
+
122
+ **Fix:** Made tempDir a getter that throws if accessed before beforeEach
123
+
124
+ **Also added defense-in-depth:**
125
+ - Layer 1: Project.create() validates directory
126
+ - Layer 2: WorkspaceManager validates not empty
127
+ - Layer 3: NODE_ENV guard refuses git init outside tmpdir
128
+ - Layer 4: Stack trace logging before git init
129
+
130
+ ## Key Principle
131
+
132
+ ```dot
133
+ digraph principle {
134
+ "Found immediate cause" [shape=ellipse];
135
+ "Can trace one level up?" [shape=diamond];
136
+ "Trace backwards" [shape=box];
137
+ "Is this the source?" [shape=diamond];
138
+ "Fix at source" [shape=box];
139
+ "Add validation at each layer" [shape=box];
140
+ "Bug impossible" [shape=doublecircle];
141
+ "NEVER fix just the symptom" [shape=octagon, style=filled, fillcolor=red, fontcolor=white];
142
+
143
+ "Found immediate cause" -> "Can trace one level up?";
144
+ "Can trace one level up?" -> "Trace backwards" [label="yes"];
145
+ "Can trace one level up?" -> "NEVER fix just the symptom" [label="no"];
146
+ "Trace backwards" -> "Is this the source?";
147
+ "Is this the source?" -> "Trace backwards" [label="no - keeps going"];
148
+ "Is this the source?" -> "Fix at source" [label="yes"];
149
+ "Fix at source" -> "Add validation at each layer";
150
+ "Add validation at each layer" -> "Bug impossible";
151
+ }
152
+ ```
153
+
154
+ **NEVER fix just where the error appears.** Trace back to find the original trigger.
155
+
156
+ ## Stack Trace Tips
157
+
158
+ **In tests:** Use `console.error()` not logger - logger may be suppressed
159
+ **Before operation:** Log before the dangerous operation, not after it fails
160
+ **Include context:** Directory, cwd, environment variables, timestamps
161
+ **Capture stack:** `new Error().stack` shows complete call chain
162
+
163
+ ## Real-World Impact
164
+
165
+ From debugging session (2025-10-03):
166
+ - Found root cause through 5-level trace
167
+ - Fixed at source (getter validation)
168
+ - Added 4 layers of defense
169
+ - 1847 tests passed, zero pollution
@@ -2,8 +2,8 @@
2
2
  name: tailwind-patterns
3
3
  description: Tailwind CSS v4+ mastery. CSS-first configuration, @theme directive, container queries, scroll-driven animations, logical properties, clamp(), fluid typography, responsive design, dark mode, custom variants, component extraction, and performance optimization. Use when styling with Tailwind, building design systems, or optimizing CSS output.
4
4
  tools: Read, Grep, Glob, Bash, Edit, Write
5
- version: 3.0.0
6
- last-updated: 2026-07-30
5
+ version: 4.0.0
6
+ last-updated: 2026-09-07
7
7
  skills:
8
8
  - baseline-ui
9
9
  - better-colors
@@ -25,7 +25,11 @@ Before engineering Tailwind CSS styles or themes, you MUST inspect:
25
25
  2. Viewport Height Units (Section 151) → Use `min-h-svh` (small viewport height) or `min-h-dvh` instead of broken mobile `min-h-screen`
26
26
  3. Container Query Prefix (Section 204) → Use `@sm:`, `@md:`, `@lg:` container prefixes for component-level responsiveness rather than viewport `sm:`, `md:`, `lg:`
27
27
 
28
- # Tailwind CSS v4+ — CSS-First Mastery
28
+
29
+ ## Activation Boundaries
30
+
31
+ - **Activate when:** Operating in tasks requiring Tailwind CSS v4+ mastery. CSS-first configuration, @theme directive, container queries, scroll-driven animations, logical properties, clamp(), fluid typography, responsive design, dark mode, custom variants, component extraction, and performance optimization. Use when styling with Tailwind, building design systems, or optimizing CSS output..
32
+ - **DO NOT activate when:** The task falls strictly outside tailwind-patterns domain or belongs to a different dedicated specialist.
29
33
 
30
34
  ---
31
35
 
@@ -602,69 +606,17 @@ AI coding assistants often fall into specific bad habits when dealing with this
602
606
 
603
607
  ---
604
608
 
605
- **Slash command: `/review` or `/tribunal-full`**
606
- **Active reviewers: `logic-reviewer` · `security-auditor`**
607
-
608
- ### ❌ Forbidden AI Tropes
609
-
610
- 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
611
- 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
612
- 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
613
-
614
- Review these questions before confirming output:
615
-
616
- ```
617
- ✅ Did I rely ONLY on real, verified tools and methods?
618
- ✅ Is this solution appropriately scoped to the user's constraints?
619
- ✅ Did I handle potential failure modes and edge cases?
620
- ✅ Have I avoided generic boilerplate that doesn't add value?
621
- ```
622
-
623
- ### 🛑 Verification-Before-Completion (VBC) Protocol
624
-
625
- **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
626
-
627
- - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
628
- - ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
629
-
630
- ## Pre-Flight Checklist
631
-
632
- - [ ] Have I reviewed the user's specific constraints and requests?
633
- - [ ] Have I checked the environment for relevant existing implementations?
634
-
635
- ## VBC Protocol (Verification-Before-Completion)
636
-
637
- You MUST verify existing code signatures and variables before attempting to modify or call them. No hallucination is permitted.
638
-
639
- ---
640
-
641
- ## 🤖 LLM-Specific Traps
642
-
643
- AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
644
-
645
- 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
646
- 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
647
- 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
648
- 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
649
- 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
650
-
651
- ---
652
-
653
- ## 🏛️ Tribunal Integration (Anti-Hallucination)
609
+ ## 🏛️ Tribunal Verification & Guardrails
654
610
 
655
611
  **Slash command: `/review` or `/tribunal-full`**
656
612
  **Active reviewers: `logic-reviewer` · `security-auditor`**
657
613
 
658
614
  ### ❌ Forbidden AI Tropes
659
-
660
615
  1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
661
616
  2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
662
617
  3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
663
618
 
664
619
  ### ✅ Pre-Flight Self-Audit
665
-
666
- Review these questions before confirming output:
667
-
668
620
  ```
669
621
  ✅ Did I rely ONLY on real, verified tools and methods?
670
622
  ✅ Is this solution appropriately scoped to the user's constraints?
@@ -673,8 +625,6 @@ Review these questions before confirming output:
673
625
  ```
674
626
 
675
627
  ### 🛑 Verification-Before-Completion (VBC) Protocol
676
-
677
628
  **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
678
-
679
629
  - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
680
630
  - ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.