tribunal-kit 2.4.6 → 3.1.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 (250) hide show
  1. package/.agent/ARCHITECTURE.md +99 -99
  2. package/.agent/GEMINI.md +52 -52
  3. package/.agent/agents/accessibility-reviewer.md +139 -86
  4. package/.agent/agents/ai-code-reviewer.md +160 -90
  5. package/.agent/agents/backend-specialist.md +164 -127
  6. package/.agent/agents/code-archaeologist.md +115 -73
  7. package/.agent/agents/database-architect.md +130 -110
  8. package/.agent/agents/debugger.md +137 -97
  9. package/.agent/agents/dependency-reviewer.md +78 -30
  10. package/.agent/agents/devops-engineer.md +161 -118
  11. package/.agent/agents/documentation-writer.md +151 -87
  12. package/.agent/agents/explorer-agent.md +117 -99
  13. package/.agent/agents/frontend-reviewer.md +127 -47
  14. package/.agent/agents/frontend-specialist.md +169 -109
  15. package/.agent/agents/game-developer.md +28 -164
  16. package/.agent/agents/logic-reviewer.md +87 -49
  17. package/.agent/agents/mobile-developer.md +151 -103
  18. package/.agent/agents/mobile-reviewer.md +133 -50
  19. package/.agent/agents/orchestrator.md +121 -110
  20. package/.agent/agents/penetration-tester.md +103 -77
  21. package/.agent/agents/performance-optimizer.md +136 -92
  22. package/.agent/agents/performance-reviewer.md +139 -69
  23. package/.agent/agents/product-manager.md +104 -70
  24. package/.agent/agents/product-owner.md +6 -25
  25. package/.agent/agents/project-planner.md +95 -95
  26. package/.agent/agents/qa-automation-engineer.md +174 -87
  27. package/.agent/agents/security-auditor.md +133 -129
  28. package/.agent/agents/seo-specialist.md +160 -99
  29. package/.agent/agents/sql-reviewer.md +132 -44
  30. package/.agent/agents/supervisor-agent.md +137 -109
  31. package/.agent/agents/swarm-worker-contracts.md +17 -17
  32. package/.agent/agents/swarm-worker-registry.md +46 -46
  33. package/.agent/agents/test-coverage-reviewer.md +132 -53
  34. package/.agent/agents/test-engineer.md +0 -21
  35. package/.agent/agents/type-safety-reviewer.md +143 -33
  36. package/.agent/patterns/generator.md +9 -9
  37. package/.agent/patterns/inversion.md +12 -12
  38. package/.agent/patterns/pipeline.md +9 -9
  39. package/.agent/patterns/reviewer.md +13 -13
  40. package/.agent/patterns/tool-wrapper.md +9 -9
  41. package/.agent/rules/GEMINI.md +63 -63
  42. package/.agent/scripts/__pycache__/auto_preview.cpython-311.pyc +0 -0
  43. package/.agent/scripts/__pycache__/bundle_analyzer.cpython-311.pyc +0 -0
  44. package/.agent/scripts/__pycache__/checklist.cpython-311.pyc +0 -0
  45. package/.agent/scripts/__pycache__/dependency_analyzer.cpython-311.pyc +0 -0
  46. package/.agent/scripts/__pycache__/security_scan.cpython-311.pyc +0 -0
  47. package/.agent/scripts/__pycache__/session_manager.cpython-311.pyc +0 -0
  48. package/.agent/scripts/__pycache__/skill_integrator.cpython-311.pyc +0 -0
  49. package/.agent/scripts/__pycache__/swarm_dispatcher.cpython-311.pyc +0 -0
  50. package/.agent/scripts/__pycache__/test_runner.cpython-311.pyc +0 -0
  51. package/.agent/scripts/__pycache__/verify_all.cpython-311.pyc +0 -0
  52. package/.agent/scripts/compress_skills.py +167 -0
  53. package/.agent/scripts/consolidate_skills.py +173 -0
  54. package/.agent/scripts/deep_compress.py +202 -0
  55. package/.agent/scripts/minify_context.py +80 -0
  56. package/.agent/scripts/security_scan.py +1 -1
  57. package/.agent/scripts/strip_tribunal.py +41 -0
  58. package/.agent/skills/agent-organizer/SKILL.md +60 -100
  59. package/.agent/skills/agentic-patterns/SKILL.md +0 -70
  60. package/.agent/skills/ai-prompt-injection-defense/SKILL.md +108 -53
  61. package/.agent/skills/api-patterns/SKILL.md +197 -257
  62. package/.agent/skills/api-security-auditor/SKILL.md +125 -57
  63. package/.agent/skills/app-builder/SKILL.md +326 -50
  64. package/.agent/skills/app-builder/templates/SKILL.md +13 -15
  65. package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +16 -16
  66. package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +22 -22
  67. package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +18 -18
  68. package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +20 -20
  69. package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +17 -17
  70. package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +18 -18
  71. package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +21 -21
  72. package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +19 -19
  73. package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +26 -26
  74. package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +26 -26
  75. package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +19 -19
  76. package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +18 -18
  77. package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +20 -20
  78. package/.agent/skills/appflow-wireframe/SKILL.md +71 -98
  79. package/.agent/skills/architecture/SKILL.md +161 -200
  80. package/.agent/skills/authentication-best-practices/SKILL.md +121 -54
  81. package/.agent/skills/bash-linux/SKILL.md +71 -166
  82. package/.agent/skills/behavioral-modes/SKILL.md +8 -69
  83. package/.agent/skills/brainstorming/SKILL.md +345 -127
  84. package/.agent/skills/building-native-ui/SKILL.md +125 -57
  85. package/.agent/skills/clean-code/SKILL.md +266 -149
  86. package/.agent/skills/code-review-checklist/SKILL.md +0 -62
  87. package/.agent/skills/config-validator/SKILL.md +73 -131
  88. package/.agent/skills/csharp-developer/SKILL.md +434 -73
  89. package/.agent/skills/database-design/SKILL.md +190 -275
  90. package/.agent/skills/deployment-procedures/SKILL.md +81 -158
  91. package/.agent/skills/devops-engineer/SKILL.md +255 -94
  92. package/.agent/skills/devops-incident-responder/SKILL.md +50 -69
  93. package/.agent/skills/doc.md +5 -5
  94. package/.agent/skills/documentation-templates/SKILL.md +19 -63
  95. package/.agent/skills/edge-computing/SKILL.md +75 -165
  96. package/.agent/skills/extract-design-system/SKILL.md +84 -58
  97. package/.agent/skills/framer-motion-expert/SKILL.md +195 -0
  98. package/.agent/skills/frontend-design/SKILL.md +151 -499
  99. package/.agent/skills/game-design-expert/SKILL.md +71 -0
  100. package/.agent/skills/game-engineering-expert/SKILL.md +88 -0
  101. package/.agent/skills/geo-fundamentals/SKILL.md +52 -178
  102. package/.agent/skills/github-operations/SKILL.md +197 -272
  103. package/.agent/skills/gsap-expert/SKILL.md +194 -0
  104. package/.agent/skills/i18n-localization/SKILL.md +60 -172
  105. package/.agent/skills/intelligent-routing/SKILL.md +123 -103
  106. package/.agent/skills/lint-and-validate/SKILL.md +8 -52
  107. package/.agent/skills/llm-engineering/SKILL.md +281 -195
  108. package/.agent/skills/local-first/SKILL.md +76 -159
  109. package/.agent/skills/mcp-builder/SKILL.md +48 -188
  110. package/.agent/skills/mobile-design/SKILL.md +213 -219
  111. package/.agent/skills/motion-engineering/SKILL.md +184 -0
  112. package/.agent/skills/nextjs-react-expert/SKILL.md +184 -203
  113. package/.agent/skills/nodejs-best-practices/SKILL.md +403 -185
  114. package/.agent/skills/observability/SKILL.md +211 -203
  115. package/.agent/skills/parallel-agents/SKILL.md +53 -146
  116. package/.agent/skills/performance-profiling/SKILL.md +171 -151
  117. package/.agent/skills/plan-writing/SKILL.md +49 -153
  118. package/.agent/skills/platform-engineer/SKILL.md +57 -103
  119. package/.agent/skills/playwright-best-practices/SKILL.md +110 -63
  120. package/.agent/skills/powershell-windows/SKILL.md +61 -179
  121. package/.agent/skills/python-patterns/SKILL.md +7 -35
  122. package/.agent/skills/python-pro/SKILL.md +273 -114
  123. package/.agent/skills/react-specialist/SKILL.md +227 -108
  124. package/.agent/skills/readme-builder/SKILL.md +15 -85
  125. package/.agent/skills/realtime-patterns/SKILL.md +216 -243
  126. package/.agent/skills/red-team-tactics/SKILL.md +10 -51
  127. package/.agent/skills/rust-pro/SKILL.md +525 -142
  128. package/.agent/skills/seo-fundamentals/SKILL.md +92 -153
  129. package/.agent/skills/server-management/SKILL.md +110 -166
  130. package/.agent/skills/shadcn-ui-expert/SKILL.md +154 -55
  131. package/.agent/skills/skill-creator/SKILL.md +18 -58
  132. package/.agent/skills/sql-pro/SKILL.md +543 -68
  133. package/.agent/skills/supabase-postgres-best-practices/SKILL.md +28 -68
  134. package/.agent/skills/swiftui-expert/SKILL.md +124 -57
  135. package/.agent/skills/systematic-debugging/SKILL.md +49 -151
  136. package/.agent/skills/tailwind-patterns/SKILL.md +433 -149
  137. package/.agent/skills/tdd-workflow/SKILL.md +63 -169
  138. package/.agent/skills/test-result-analyzer/SKILL.md +33 -73
  139. package/.agent/skills/testing-patterns/SKILL.md +437 -130
  140. package/.agent/skills/trend-researcher/SKILL.md +30 -71
  141. package/.agent/skills/ui-ux-pro-max/SKILL.md +0 -41
  142. package/.agent/skills/ui-ux-researcher/SKILL.md +51 -91
  143. package/.agent/skills/vue-expert/SKILL.md +225 -119
  144. package/.agent/skills/vulnerability-scanner/SKILL.md +264 -226
  145. package/.agent/skills/web-accessibility-auditor/SKILL.md +141 -58
  146. package/.agent/skills/web-design-guidelines/SKILL.md +17 -61
  147. package/.agent/skills/webapp-testing/SKILL.md +71 -196
  148. package/.agent/skills/whimsy-injector/SKILL.md +58 -132
  149. package/.agent/skills/workflow-optimizer/SKILL.md +28 -68
  150. package/.agent/workflows/api-tester.md +96 -224
  151. package/.agent/workflows/audit.md +81 -122
  152. package/.agent/workflows/brainstorm.md +69 -105
  153. package/.agent/workflows/changelog.md +65 -97
  154. package/.agent/workflows/create.md +73 -88
  155. package/.agent/workflows/debug.md +80 -111
  156. package/.agent/workflows/deploy.md +119 -92
  157. package/.agent/workflows/enhance.md +80 -91
  158. package/.agent/workflows/fix.md +68 -97
  159. package/.agent/workflows/generate.md +165 -164
  160. package/.agent/workflows/migrate.md +106 -109
  161. package/.agent/workflows/orchestrate.md +103 -86
  162. package/.agent/workflows/performance-benchmarker.md +77 -268
  163. package/.agent/workflows/plan.md +120 -98
  164. package/.agent/workflows/preview.md +39 -96
  165. package/.agent/workflows/refactor.md +105 -97
  166. package/.agent/workflows/review-ai.md +63 -102
  167. package/.agent/workflows/review.md +71 -110
  168. package/.agent/workflows/session.md +53 -113
  169. package/.agent/workflows/status.md +42 -88
  170. package/.agent/workflows/strengthen-skills.md +90 -51
  171. package/.agent/workflows/swarm.md +114 -129
  172. package/.agent/workflows/test.md +125 -102
  173. package/.agent/workflows/tribunal-backend.md +60 -78
  174. package/.agent/workflows/tribunal-database.md +62 -100
  175. package/.agent/workflows/tribunal-frontend.md +62 -82
  176. package/.agent/workflows/tribunal-full.md +56 -100
  177. package/.agent/workflows/tribunal-mobile.md +65 -94
  178. package/.agent/workflows/tribunal-performance.md +62 -105
  179. package/.agent/workflows/ui-ux-pro-max.md +72 -121
  180. package/README.md +11 -15
  181. package/package.json +1 -1
  182. package/.agent/skills/api-patterns/api-style.md +0 -42
  183. package/.agent/skills/api-patterns/auth.md +0 -24
  184. package/.agent/skills/api-patterns/documentation.md +0 -26
  185. package/.agent/skills/api-patterns/graphql.md +0 -41
  186. package/.agent/skills/api-patterns/rate-limiting.md +0 -31
  187. package/.agent/skills/api-patterns/response.md +0 -37
  188. package/.agent/skills/api-patterns/rest.md +0 -40
  189. package/.agent/skills/api-patterns/security-testing.md +0 -122
  190. package/.agent/skills/api-patterns/trpc.md +0 -41
  191. package/.agent/skills/api-patterns/versioning.md +0 -22
  192. package/.agent/skills/app-builder/agent-coordination.md +0 -71
  193. package/.agent/skills/app-builder/feature-building.md +0 -53
  194. package/.agent/skills/app-builder/project-detection.md +0 -34
  195. package/.agent/skills/app-builder/scaffolding.md +0 -118
  196. package/.agent/skills/app-builder/tech-stack.md +0 -40
  197. package/.agent/skills/architecture/context-discovery.md +0 -43
  198. package/.agent/skills/architecture/examples.md +0 -94
  199. package/.agent/skills/architecture/pattern-selection.md +0 -68
  200. package/.agent/skills/architecture/patterns-reference.md +0 -50
  201. package/.agent/skills/architecture/trade-off-analysis.md +0 -77
  202. package/.agent/skills/brainstorming/dynamic-questioning.md +0 -360
  203. package/.agent/skills/database-design/database-selection.md +0 -43
  204. package/.agent/skills/database-design/indexing.md +0 -39
  205. package/.agent/skills/database-design/migrations.md +0 -48
  206. package/.agent/skills/database-design/optimization.md +0 -36
  207. package/.agent/skills/database-design/orm-selection.md +0 -30
  208. package/.agent/skills/database-design/schema-design.md +0 -56
  209. package/.agent/skills/dotnet-core-expert/SKILL.md +0 -103
  210. package/.agent/skills/framer-motion-animations/SKILL.md +0 -74
  211. package/.agent/skills/frontend-design/animation-guide.md +0 -331
  212. package/.agent/skills/frontend-design/color-system.md +0 -329
  213. package/.agent/skills/frontend-design/decision-trees.md +0 -418
  214. package/.agent/skills/frontend-design/motion-graphics.md +0 -306
  215. package/.agent/skills/frontend-design/typography-system.md +0 -363
  216. package/.agent/skills/frontend-design/ux-psychology.md +0 -1116
  217. package/.agent/skills/frontend-design/visual-effects.md +0 -383
  218. package/.agent/skills/game-development/2d-games/SKILL.md +0 -119
  219. package/.agent/skills/game-development/3d-games/SKILL.md +0 -135
  220. package/.agent/skills/game-development/SKILL.md +0 -236
  221. package/.agent/skills/game-development/game-art/SKILL.md +0 -185
  222. package/.agent/skills/game-development/game-audio/SKILL.md +0 -190
  223. package/.agent/skills/game-development/game-design/SKILL.md +0 -129
  224. package/.agent/skills/game-development/mobile-games/SKILL.md +0 -108
  225. package/.agent/skills/game-development/multiplayer/SKILL.md +0 -132
  226. package/.agent/skills/game-development/pc-games/SKILL.md +0 -144
  227. package/.agent/skills/game-development/vr-ar/SKILL.md +0 -123
  228. package/.agent/skills/game-development/web-games/SKILL.md +0 -150
  229. package/.agent/skills/intelligent-routing/router-manifest.md +0 -65
  230. package/.agent/skills/mobile-design/decision-trees.md +0 -516
  231. package/.agent/skills/mobile-design/mobile-backend.md +0 -491
  232. package/.agent/skills/mobile-design/mobile-color-system.md +0 -420
  233. package/.agent/skills/mobile-design/mobile-debugging.md +0 -122
  234. package/.agent/skills/mobile-design/mobile-design-thinking.md +0 -357
  235. package/.agent/skills/mobile-design/mobile-navigation.md +0 -458
  236. package/.agent/skills/mobile-design/mobile-performance.md +0 -767
  237. package/.agent/skills/mobile-design/mobile-testing.md +0 -356
  238. package/.agent/skills/mobile-design/mobile-typography.md +0 -433
  239. package/.agent/skills/mobile-design/platform-android.md +0 -666
  240. package/.agent/skills/mobile-design/platform-ios.md +0 -561
  241. package/.agent/skills/mobile-design/touch-psychology.md +0 -537
  242. package/.agent/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +0 -312
  243. package/.agent/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +0 -240
  244. package/.agent/skills/nextjs-react-expert/3-server-server-side-performance.md +0 -490
  245. package/.agent/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +0 -264
  246. package/.agent/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +0 -581
  247. package/.agent/skills/nextjs-react-expert/6-rendering-rendering-performance.md +0 -432
  248. package/.agent/skills/nextjs-react-expert/7-js-javascript-performance.md +0 -684
  249. package/.agent/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +0 -150
  250. package/.agent/skills/vulnerability-scanner/checklists.md +0 -121
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Debugging command. Activates DEBUG mode for systematic problem investigation. No fix is suggested until the root cause is confirmed.
2
+ description: Debugging command. Activates DEBUG mode for systematic problem investigation using the 4-phase methodology (Collect → Hypothesize → Test → Fix). No fix is suggested until the root cause is confirmed and tested. No random changes. No guessing.
3
3
  ---
4
4
 
5
5
  # /debug — Root Cause Investigation
@@ -8,102 +8,98 @@ $ARGUMENTS
8
8
 
9
9
  ---
10
10
 
11
- This command switches the AI into **investigation mode**. No fixes are suggested until the root cause is identified and confirmed. No random changes. No guessing.
12
-
13
- ---
14
-
15
11
  ## The Investigation Contract
16
12
 
17
- > "A fix without a root cause is a patch on a symptom. It will fail again."
13
+ "A fix without a root cause is a patch on a symptom. It will fail again."
18
14
 
19
15
  The `debugger` agent follows this sequence **without skipping steps**:
20
16
 
21
- 1. Collect evidence
22
- 2. Generate hypotheses
23
- 3. Test hypotheses one at a time
24
- 4. Identify root cause
25
- 5. Apply targeted fix
26
- 6. Verify the fix and prevent recurrence
17
+ 1. Collect all evidence first
18
+ 2. Generate ranked hypotheses
19
+ 3. Test exactly one hypothesis at a time
20
+ 4. Confirm root cause with evidence
21
+ 5. Apply the minimum targeted fix
22
+ 6. Add a regression test to prevent recurrence
27
23
 
28
24
  ---
29
25
 
30
- ## When to Use /debug vs Other Commands
26
+ ## When to Use /debug
31
27
 
32
- | Use `/debug` when... | Use something else when... |
33
- |---|---|
34
- | There's a specific error or unexpected behavior | Code needs to be written from scratch → `/generate` |
35
- | You have a stack trace or error message | Code quality needs improvement → `/refactor` |
36
- | Production is broken right now | You want to add tests → `/test` |
37
- | A bug reappears after being "fixed" | You want a full project health check → `/audit` |
28
+ |Use `/debug` when...|Use something else when...|
29
+ |:---|:---|
30
+ |There's a specific error or unexpected behavior|Code needs to be written → `/generate`|
31
+ |You have a stack trace or error message|Code quality needs improving → `/refactor`|
32
+ |Production is broken right now|Missing test coverage → `/test`|
33
+ |A bug reappears after being "fixed"|Full health check needed → `/audit`|
38
34
 
39
35
  ---
40
36
 
41
- ## Step 1 — Evidence Collection
42
-
43
- **Collect these before forming any hypothesis:**
37
+ ## Step 1 — Evidence Collection (Collect All Before Hypothesizing)
44
38
 
45
39
  ```
46
- □ Exact error text — full stack trace, not a summary
40
+ □ Exact error text — full stack trace, not a paraphrase
47
41
  □ Minimum reproduction steps — fewest actions that trigger the bug
48
42
  □ Last known-good state — commit hash, date, or config snapshot
49
- □ Recent changes — code, dependency updates, env vars, infra
50
- □ Environment — local / staging / production, OS, Node version, etc.
51
- □ Frequency — always / sometimes / only under load / only in prod
43
+ □ Recent changes — code, deps, env vars, infra, config changes
44
+ □ Environment — local/staging/prod, OS, Node version, browser, runtime
45
+ □ Frequency — always / intermittent / only under load / production only
52
46
  ```
53
47
 
54
- > ⚠️ If the error is intermittent, collect timing data before hypothesizing.
48
+ > ⚠️ If the error is intermittent: collect timing patterns before hypothesizing.
49
+
50
+ ### Priority Investigation Order (Most Likely Root Cause First)
51
+
52
+ ```
53
+ 1. Recent deployments — 90% of outages are caused by recent changes
54
+ 2. Environment variables — rotated/missing secrets are common silent failures
55
+ 3. Dependency updates — a package update can break APIs without errors
56
+ 4. Infrastructure — firewall, Security Groups, DB connection limits
57
+ 5. Application code — last to check, easiest to blame prematurely
58
+ ```
55
59
 
56
60
  ---
57
61
 
58
- ## Step 2 — Hypothesis Generation
62
+ ## Step 2 — Hypothesis Formation
59
63
 
60
- Map possible causes label each honestly:
64
+ Map all possible causes with explicit likelihood labels:
61
65
 
62
66
  ```
63
- Cause A: [what it is] — Likelihood: High / Medium / Low — Evidence: [what points to it]
64
- Cause B: [what it is] — Likelihood: High / Medium / Low — Evidence: [what points to it]
65
- Cause C: [what it is] Likelihood: High / Medium / Low — Evidence: [what points to it]
67
+ ROOT CAUSE CANDIDATES
68
+ ━━━━━━━━━━━━━━━━━━━━━
69
+ H1 [High] [cause] — Evidence: [what points to this]
70
+ H2 [Medium] — [cause] — Evidence: [what is consistent with this]
71
+ H3 [Low] — [cause] — Evidence: [theoretically possible]
66
72
  ```
67
73
 
68
- Every entry is labeled as a **hypothesis**, never as a confirmed fact.
69
-
70
- **Hypothesis ranking rules:**
71
- - High likelihood: directly supported by evidence or error message
72
- - Medium likelihood: consistent with the error but no direct evidence
73
- - Low likelihood: possible but requires unusual conditions
74
+ **Never state a hypothesis as confirmed fact until Step 3 proves it.**
74
75
 
75
76
  ---
76
77
 
77
78
  ## Step 3 — Single-Hypothesis Testing
78
79
 
79
- Test causes **one at a time**. Never test two simultaneously — it makes the result ambiguous.
80
+ Test **one at a time**. Never test two simultaneously — results become ambiguous.
80
81
 
81
82
  ```
82
- H1 tested: [what was examined + how]
83
- Result: ✅ Confirmed root cause | ❌ Ruled out — [reason]
83
+ H1 tested: [how it was investigated]
84
+ Result: ✅ Confirmed | ❌ Ruled out — [specific evidence against]
84
85
 
85
- H2 tested: [what was examined + how]
86
- Result: ✅ Confirmed root cause | ❌ Ruled out — [reason]
86
+ H2 tested: [how it was investigated]
87
+ Result: ✅ Confirmed | ❌ Ruled out — [reason]
87
88
  ```
88
89
 
89
- Stop when the first hypothesis is confirmed. Do not continue testing eliminated causes.
90
+ Stop when the first hypothesis is confirmed. Do not continue investigating eliminated causes.
90
91
 
91
92
  ---
92
93
 
93
94
  ## Step 4 — Root Cause Statement
94
95
 
95
- The root cause is the **single thing** that, if changed, prevents the entire failure chain.
96
-
97
- Format:
96
+ The root cause is one sentence: **WHY this happened**, not WHAT happened.
98
97
 
99
98
  ```
100
- Root Cause: [One sentence WHY this happened, not WHAT happened]
101
-
102
- Example:
103
- ✅ "JWT verification was skipped when the Authorization header used 'bearer' (lowercase),
104
- because the header check was case-sensitive."
99
+ "JWT verification was skipped when Authorization header used lowercase 'bearer'
100
+ because the header check was case-sensitive"
105
101
 
106
- ❌ "The login returned 401." (This is the symptom, not the cause)
102
+ ❌ "The API returned 401" This is the symptom, not the root cause
107
103
  ```
108
104
 
109
105
  ---
@@ -111,86 +107,59 @@ Example:
111
107
  ## Step 5 — Fix + Regression Prevention
112
108
 
113
109
  ```
114
- Targeted fix: One change — the minimum required to resolve the root cause
115
- Regression test: A specific test added to catch this exact failure if it ever returns
116
- Similar patterns: Any other locations in the codebase where this pattern exists
110
+ Targeted fix: The minimum change that eliminates the root cause
111
+ Regression test: A specific test that will catch this exact failure if it returns
112
+ Similar patterns: Other locations in the codebase to audit for the same issue
113
+ Debug cleanup: All console.log/temporary changes removed from proposed fix
117
114
  ```
118
115
 
119
- > ⚠️ All debug logging added during investigation must be removed before the fix is presented.
120
-
121
116
  ---
122
117
 
123
118
  ## Debug Report Format
124
119
 
125
120
  ```
126
- ━━━ Debug Report ━━━━━━━━━━━━━━━━━━━━━━━
121
+ ━━━ Debug Report ━━━━━━━━━━━━━━━━━━━━━━━━━━
127
122
 
128
- Symptom: [what the user sees]
129
- Error: [exact message or trace]
123
+ Symptom: [what the user observes]
124
+ Error: [exact message / stack trace]
130
125
  Reproduced: Yes | No | Sometimes — [conditions]
131
- Environment: [runtime, version, OS]
132
- Last working: [commit / date / known-good state]
133
-
134
- ━━━ Evidence Collected ━━━━━━━━━━━━━━━━
126
+ Environment: [Node v22, Next.js 15, PostgreSQL 16]
127
+ Last working: [commit hash / date]
135
128
 
129
+ ━━━ Evidence ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
136
130
  - [specific observation 1]
137
131
  - [specific observation 2]
138
132
 
139
- ━━━ Hypotheses ━━━━━━━━━━━━━━━━━━━━━━━
140
-
141
- H1 [High] — [cause and why it's likely]
142
- H2 [Medium] — [cause and why it's possible]
143
- H3 [Low] — [cause and why it's a stretch]
133
+ ━━━ Hypotheses ━━━━━━━━━━━━━━━━━━━━━━━━━━
134
+ H1 [High] — [cause and reasoning]
135
+ H2 [Medium] — [cause and reasoning]
144
136
 
145
- ━━━ Investigation ━━━━━━━━━━━━━━━━━━━
137
+ ━━━ Investigation ━━━━━━━━━━━━━━━━━━━━━━━
138
+ H1: [what was tested] → ✅ Confirmed root cause
139
+ H2: [what was tested] → ❌ Ruled out — [reason]
146
140
 
147
- H1: checked [what was examined] → ✅ Confirmed root cause
148
- H2: ruled out[evidence against it]
141
+ ━━━ Root Cause ━━━━━━━━━━━━━━━━━━━━━━━━━
142
+ [Single sentence WHYnot WHAT]
149
143
 
150
- ━━━ Root Cause ━━━━━━━━━━━━━━━━━━━━━
144
+ ━━━ Fix ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
145
+ Before: [original code]
146
+ After: [corrected code]
151
147
 
152
- [Single sentence WHY this happened]
153
-
154
- ━━━ Fix ━━━━━━━━━━━━━━━━━━━━━━━━━━━━
155
-
156
- Before: [original code]
157
- After: [corrected code]
158
-
159
- Regression test: [what test prevents this from recurring]
160
- Similar patterns: [any other locations to check in the codebase]
148
+ Regression test: [test preventing recurrence]
149
+ Similar patterns: [other locations to check]
161
150
  ```
162
151
 
163
152
  ---
164
153
 
165
154
  ## Hallucination Guard
166
155
 
167
- - Every hypothesis is **explicitly labeled as a hypothesis** — never as confirmed fact until evidence backs it
168
- - Proposed fixes only use **real, documented APIs** — `// VERIFY: check method exists` on any uncertain call
169
- - **One change per fix** — multi-file rewrites presented as "a debug session" are a red flag
170
- - Debug logging added during investigation must be **removed** before the fix is presented
171
- - **Never assume the error message is accurate** — verify it matches actual behavior
172
-
173
- ---
174
-
175
- ## Cross-Workflow Navigation
176
-
177
- | After /debug reveals... | Go to |
178
- |---|---|
179
- | Root cause confirmed, fix ready | `/generate` to write the fix safely through Tribunal |
180
- | Multiple files need changing | `/enhance` for impact-zone analysis + callers update |
181
- | Missing test allowed the bug in | `/test` to add regression coverage |
182
- | Performance was the root cause | `/tribunal-performance` for full optimization review |
183
- | Security vulnerability found | `/audit` to check if it exists elsewhere |
184
-
185
- ---
186
-
187
- ## Usage
188
-
189
156
  ```
190
- /debug TypeError: Cannot read properties of undefined reading 'id'
191
- /debug API returns 500 only in production
192
- /debug useEffect runs on every render instead of once
193
- /debug login works locally but fails in CI
194
- /debug memory usage grows unbounded over 24h in the worker process
195
- /debug race condition in the payment confirmation handler
157
+ Never propose a fix before root cause is confirmed with evidence
158
+ Never test two hypotheses simultaneously
159
+ Never propose a "rewrite" as a debug session
160
+ Never leave console.log in the proposed fix
161
+ Never assume the error message accurately describes the actual cause
162
+ Never use real API methods without verifying they exist in this version
196
163
  ```
164
+
165
+ ---
@@ -1,153 +1,180 @@
1
1
  ---
2
- description: Deployment command for production releases. Pre-flight checks and deployment execution.
2
+ description: Production deployment command. Runs pre-flight safety checks (tests, type-check, lint, security, build), creates a rollback baseline, confirms Human Gate, then executes deployment. Requires explicit human approval before going live.
3
3
  ---
4
4
 
5
- # /deploy — Production Release
5
+ # /deploy — Production Deployment
6
6
 
7
7
  $ARGUMENTS
8
8
 
9
9
  ---
10
10
 
11
- This command runs a structured, gate-enforced deployment sequence. **Nothing reaches production without passing all three gates.**
11
+ ## The Deployment Contract
12
+
13
+ "Production is the only environment that matters. Every deployment is a risk event."
14
+ Every step is logged. Every step has a rollback path. No surprises.
12
15
 
13
16
  ---
14
17
 
15
- ## The Non-Negotiable Rule
18
+ ## When to Use /deploy
16
19
 
17
- > **The Human Gate is never skipped.**
18
- > Even if every automated gate passes, a human sees the deployment summary and explicitly approves before anything executes.
20
+ |Use `/deploy` when...|Do NOT deploy when...|
21
+ |:---|:---|
22
+ |All pre-flight checks pass|Any pre-flight check fails|
23
+ |Changes are reviewed and approved|In the middle of a debug session|
24
+ |You have a rollback plan|No tests run since last change|
25
+ |Non-peak traffic hours (if possible)|Security audit shows critical issues|
19
26
 
20
27
  ---
21
28
 
22
- ## Before Running /deploy
29
+ ## Phase 1 — Pre-Flight Checks (ALL Must Pass)
23
30
 
24
- Confirm the following checklist manually:
31
+ **If ANY check in Phase 1 fails → deployment is BLOCKED.**
25
32
 
26
- ```
27
- /audit passed with no CRITICAL or HIGH issues
28
- □ All tests pass on the current commit
29
- □ CHANGELOG.md is updated
30
- □ Environment variables are confirmed in the target environment
31
- □ Database migrations (if any) have a rollback plan
32
- □ Rollback target (tag or SHA) is documented
33
- ```
33
+ ```bash
34
+ # T-minus safety sequence (in exact order)
34
35
 
35
- ---
36
+ # 1. Security: halt on critical
37
+ python .agent/scripts/security_scan.py . --level=critical
36
38
 
37
- ## Three-Gate Sequence
39
+ # 2. Dependencies: no exploitable CVEs
40
+ npm audit --audit-level=high
38
41
 
39
- ### Gate 1 Security Sweep
42
+ # 3. Type safety: zero errors allowed
43
+ npx tsc --noEmit
40
44
 
41
- `security-auditor` scans all files in the deployment diff:
45
+ # 4. Tests: all must pass
46
+ npm test
42
47
 
43
- ```
44
- Expected clean state:
45
- ✅ No secrets or credentials in any changed file
46
- No unparameterized query introduced
47
- No new CVE-affected dependency
48
- ✅ No debug endpoints left active
49
- ✅ No `console.log` with sensitive data
48
+ # 5. Build: production build must succeed
49
+ npm run build
50
+
51
+ # 6. Lint: blocking errors halt deployment
52
+ npm run lint --max-warnings=0
50
53
  ```
51
54
 
52
- ```bash
53
- // turbo
54
- python .agent/scripts/security_scan.py .
55
+ **Pre-Flight Report:**
56
+
57
+ ```
58
+ ━━━ Pre-Flight Status ━━━━━━━━━━━━━━━━━━━━━
59
+
60
+ Security: ✅ CLEAR | ❌ BLOCKED ([finding])
61
+ npm audit: ✅ CLEAR | ❌ BLOCKED ([CVE])
62
+ TypeScript: ✅ ZERO ERRORS | ❌ BLOCKED (N errors)
63
+ Tests: ✅ ALL PASS | ❌ BLOCKED (N failing)
64
+ Build: ✅ SUCCESS | ❌ BLOCKED (build error)
65
+ Linting: ✅ CLEAN | ⚠️ WARNINGS (N) | ❌ BLOCKING ERRORS (N)
55
66
  ```
56
67
 
57
- **If any CRITICAL or HIGH issue → deployment is blocked.** Fix and re-scan before proceeding.
68
+ ---
58
69
 
59
- ### Gate 2 — Tribunal Verification
70
+ ## Phase 2 — Rollback Baseline
60
71
 
61
- Run `/tribunal-full` on all changed code:
72
+ Before deployment, capture the rollback state:
62
73
 
63
74
  ```bash
64
- # Run full check suite
65
- // turbo
66
- python .agent/scripts/verify_all.py
67
- ```
75
+ # Option A: Git baseline
76
+ git rev-parse HEAD # Record current commit hash
77
+ # Rollback: git revert HEAD or git reset --hard [hash]
68
78
 
69
- ```
70
- logic-reviewer: APPROVED
71
- security-auditor: APPROVED
72
- ✅ dependency-reviewer: APPROVED
73
- type-safety-reviewer: APPROVED
79
+ # Option B: Tag the current release
80
+ git tag release-$(date +%Y%m%d-%H%M%S)
81
+ git push origin --tags
82
+
83
+ # Option C: Database snapshot (if schema changed)
84
+ pg_dump $DATABASE_URL > backup-$(date +%Y%m%d-%H%M%S).sql
74
85
  ```
75
86
 
76
- **Any REJECTED verdict deployment blocked.** Fix and re-review.
87
+ **Rollback baseline must be confirmed before deployment begins.**
77
88
 
78
- ### Gate 3 — Human Approval
89
+ ---
79
90
 
80
- A deployment summary is shown before execution:
91
+ ## Phase 3 Human Gate (Non-Negotiable)
92
+
93
+ After pre-flight passes, present to the deployer:
81
94
 
82
95
  ```
83
- ━━━ Release Summary ━━━━━━━━━━━━━━━━━━━━━━━━
84
- Target: [staging | production]
85
- Commit: [SHA — first 8 chars]
86
- Files changed: [N] — view diff?
87
- Security gate: ✅ Passed (no CRITICAL/HIGH issues)
88
- Tribunal gate: ✅ All reviewers APPROVED
89
- Tests: ✅ [N] passed, [0] failed
90
-
91
- Rollback to: [previous tag or commit SHA]
92
- Rollback time: [estimate in minutes]
93
- DB migration: [None | ⚠️ IRREVERSIBLE | ✅ Reversible]
94
- DB backup: [Confirmed | Not confirmed — deployment blocked]
95
-
96
- Proceed with deployment? Y = execute | N = cancel
97
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
98
- ```
96
+ ━━━ Deployment Approval Required ━━━━━━━━━━━━━━
99
97
 
100
- ---
98
+ Target environment: [production | staging]
99
+ Changes in this deploy:
100
+ [commit summary: feat/fix/chore + description]
101
+ [number of files changed]
101
102
 
102
- ## Rollback is a Prerequisite
103
+ Database changes: [Yes: describe migration | None]
104
+ Breaking changes: [Yes: describe | None]
103
105
 
104
- Before any deployment executes, a rollback plan must exist:
106
+ Pre-flight: ✅ ALL CHECKS PASSED
105
107
 
106
- ```
107
- What does this roll back to? → [tag or SHA]
108
- How long will rollback take? → [estimate]
109
- Is the DB migration reversible? → Yes | No if No, is backup confirmed?
110
- Who gets notified on rollback? → [name or Slack channel]
108
+ Rollback baseline: Commit [hash] tagged as [release-name]
109
+ Rollback command: git reset --hard [hash]
110
+
111
+ Deploy? Y = proceed | N = abort | W = wait (deploy later)
111
112
  ```
112
113
 
113
- **No rollback plan = no deployment.** This is not optional.
114
+ **Nothing is deployed without explicit "Y" from the human.**
114
115
 
115
116
  ---
116
117
 
117
- ## Environment-Specific Rules
118
+ ## Phase 4 — Deployment Execution
119
+
120
+ ```bash
121
+ # Deploy (platform-specific — auto-detected from project config)
122
+
123
+ # → Render + GitHub Actions:
124
+ git push origin main # CI/CD deploys automatically
118
125
 
119
- | Target | Extra Requirements |
120
- |---|---|
121
- | Staging | Rollback optional, tests required, git tag optional |
122
- | Production | All requirements above + git tag required |
123
- | Hotfix | Security gate required, Human Gate required |
126
+ # Manual Fly.io:
127
+ flyctl deploy --strategy rolling
128
+
129
+ # Manual Kubernetes:
130
+ kubectl set image deployment/api api=[registry]/app:[commit-sha]
131
+ kubectl rollout status deployment/api
132
+ ```
124
133
 
125
134
  ---
126
135
 
127
- ## Hallucination Guard
136
+ ## Phase 5 — Post-Deploy Verification
128
137
 
129
- - **No invented CLI flags** — `# VERIFY: check docs for this flag` on any uncertain command
130
- - **All secrets via environment variables** — never hardcoded in deploy configs or scripts
131
- - **All images tagged with a specific version** — `latest` is forbidden in production configs
132
- - **Never generate deployment steps without reading the existing deploy scripts** — read before writing
138
+ Within 5 minutes of deployment completing:
139
+
140
+ ```bash
141
+ # Health check
142
+ curl -f https://api.yoursite.com/health # Must return 200
143
+ curl -f https://yoursite.com # Must load
144
+ curl -f https://yoursite.com/api/auth/session # Auth must work
145
+
146
+ # Monitor error rate (5 minutes)
147
+ # If error rate > 1% above baseline → initiate rollback immediately
148
+ ```
133
149
 
134
150
  ---
135
151
 
136
- ## Cross-Workflow Navigation
152
+ ## Rollback Decision Tree
137
153
 
138
- | Before /deploy... | Go to |
139
- |---|---|
140
- | Security audit not run yet | `/audit` first |
141
- | Tests broken | `/debug` to fix, then `/test` to verify |
142
- | Changelog outdated | `/changelog` to update first |
143
- | DB migration needed | `/migrate` with rollback plan documented |
154
+ ```
155
+ After deploy, within 5 minutes:
156
+ ├── Error rate normal + health checks pass ✅ Deployment successful
157
+ ├── Error rate elevated but < 1% above baseline ⚠️ Monitor for 10 more minutes
158
+ ├── Error rate > 1% above baseline ❌ ROLLBACK IMMEDIATELY
159
+ └── Health check fails ROLLBACK IMMEDIATELY
160
+
161
+ Rollback command:
162
+ git reset --hard [baseline-commit]
163
+ git push origin main --force-with-lease
164
+ ```
144
165
 
145
166
  ---
146
167
 
147
- ## Usage
168
+ ## Schema Change Deployment Pattern
169
+
170
+ If this deploy includes database migrations:
148
171
 
149
172
  ```
150
- /deploy to staging
151
- /deploy to production after staging validation
152
- /deploy hotfix for the auth regression
173
+ 1. Deploy migration in isolation (no application code change)
174
+ 2. Verify migration succeeded and DB is healthy
175
+ 3. THEN deploy application code that uses new schema
153
176
  ```
177
+
178
+ **Never deploy application code and schema changes in the same deployment.**
179
+
180
+ ---