tribunal-kit 3.0.0 → 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 (226) hide show
  1. package/.agent/ARCHITECTURE.md +99 -99
  2. package/.agent/GEMINI.md +52 -52
  3. package/.agent/agents/accessibility-reviewer.md +187 -220
  4. package/.agent/agents/ai-code-reviewer.md +199 -233
  5. package/.agent/agents/backend-specialist.md +215 -238
  6. package/.agent/agents/code-archaeologist.md +161 -181
  7. package/.agent/agents/database-architect.md +184 -207
  8. package/.agent/agents/debugger.md +191 -218
  9. package/.agent/agents/dependency-reviewer.md +103 -136
  10. package/.agent/agents/devops-engineer.md +218 -238
  11. package/.agent/agents/documentation-writer.md +201 -221
  12. package/.agent/agents/explorer-agent.md +160 -180
  13. package/.agent/agents/frontend-reviewer.md +160 -194
  14. package/.agent/agents/frontend-specialist.md +248 -237
  15. package/.agent/agents/game-developer.md +48 -52
  16. package/.agent/agents/logic-reviewer.md +116 -149
  17. package/.agent/agents/mobile-developer.md +200 -223
  18. package/.agent/agents/mobile-reviewer.md +162 -195
  19. package/.agent/agents/orchestrator.md +181 -211
  20. package/.agent/agents/penetration-tester.md +157 -174
  21. package/.agent/agents/performance-optimizer.md +183 -203
  22. package/.agent/agents/performance-reviewer.md +178 -211
  23. package/.agent/agents/product-manager.md +142 -162
  24. package/.agent/agents/product-owner.md +6 -25
  25. package/.agent/agents/project-planner.md +142 -162
  26. package/.agent/agents/qa-automation-engineer.md +225 -242
  27. package/.agent/agents/security-auditor.md +174 -194
  28. package/.agent/agents/seo-specialist.md +193 -213
  29. package/.agent/agents/sql-reviewer.md +161 -194
  30. package/.agent/agents/supervisor-agent.md +184 -203
  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 +160 -193
  34. package/.agent/agents/test-engineer.md +0 -21
  35. package/.agent/agents/type-safety-reviewer.md +175 -208
  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/compress_skills.py +167 -0
  43. package/.agent/scripts/consolidate_skills.py +173 -0
  44. package/.agent/scripts/deep_compress.py +202 -0
  45. package/.agent/scripts/minify_context.py +80 -0
  46. package/.agent/scripts/security_scan.py +1 -1
  47. package/.agent/scripts/strip_tribunal.py +41 -0
  48. package/.agent/skills/agent-organizer/SKILL.md +92 -126
  49. package/.agent/skills/agentic-patterns/SKILL.md +0 -70
  50. package/.agent/skills/ai-prompt-injection-defense/SKILL.md +126 -160
  51. package/.agent/skills/api-patterns/SKILL.md +123 -215
  52. package/.agent/skills/api-security-auditor/SKILL.md +143 -177
  53. package/.agent/skills/app-builder/SKILL.md +326 -50
  54. package/.agent/skills/app-builder/templates/SKILL.md +13 -15
  55. package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +16 -16
  56. package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +22 -22
  57. package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +18 -18
  58. package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +20 -20
  59. package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +17 -17
  60. package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +18 -18
  61. package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +21 -21
  62. package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +19 -19
  63. package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +26 -26
  64. package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +26 -26
  65. package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +19 -19
  66. package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +18 -18
  67. package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +20 -20
  68. package/.agent/skills/appflow-wireframe/SKILL.md +87 -121
  69. package/.agent/skills/architecture/SKILL.md +82 -252
  70. package/.agent/skills/authentication-best-practices/SKILL.md +139 -173
  71. package/.agent/skills/bash-linux/SKILL.md +120 -154
  72. package/.agent/skills/behavioral-modes/SKILL.md +8 -69
  73. package/.agent/skills/brainstorming/SKILL.md +428 -104
  74. package/.agent/skills/building-native-ui/SKILL.md +143 -174
  75. package/.agent/skills/clean-code/SKILL.md +323 -360
  76. package/.agent/skills/code-review-checklist/SKILL.md +0 -62
  77. package/.agent/skills/config-validator/SKILL.md +107 -141
  78. package/.agent/skills/csharp-developer/SKILL.md +468 -528
  79. package/.agent/skills/database-design/SKILL.md +104 -369
  80. package/.agent/skills/deployment-procedures/SKILL.md +111 -145
  81. package/.agent/skills/devops-engineer/SKILL.md +295 -332
  82. package/.agent/skills/devops-incident-responder/SKILL.md +79 -113
  83. package/.agent/skills/doc.md +5 -5
  84. package/.agent/skills/documentation-templates/SKILL.md +19 -63
  85. package/.agent/skills/edge-computing/SKILL.md +123 -157
  86. package/.agent/skills/extract-design-system/SKILL.md +100 -134
  87. package/.agent/skills/framer-motion-expert/SKILL.md +111 -855
  88. package/.agent/skills/frontend-design/SKILL.md +151 -499
  89. package/.agent/skills/game-design-expert/SKILL.md +71 -105
  90. package/.agent/skills/game-engineering-expert/SKILL.md +88 -122
  91. package/.agent/skills/geo-fundamentals/SKILL.md +89 -124
  92. package/.agent/skills/github-operations/SKILL.md +279 -314
  93. package/.agent/skills/gsap-expert/SKILL.md +119 -826
  94. package/.agent/skills/i18n-localization/SKILL.md +104 -138
  95. package/.agent/skills/intelligent-routing/SKILL.md +159 -127
  96. package/.agent/skills/lint-and-validate/SKILL.md +8 -52
  97. package/.agent/skills/llm-engineering/SKILL.md +344 -357
  98. package/.agent/skills/local-first/SKILL.md +120 -154
  99. package/.agent/skills/mcp-builder/SKILL.md +84 -118
  100. package/.agent/skills/mobile-design/SKILL.md +213 -219
  101. package/.agent/skills/motion-engineering/SKILL.md +184 -0
  102. package/.agent/skills/nextjs-react-expert/SKILL.md +99 -698
  103. package/.agent/skills/nodejs-best-practices/SKILL.md +498 -559
  104. package/.agent/skills/observability/SKILL.md +293 -330
  105. package/.agent/skills/parallel-agents/SKILL.md +88 -122
  106. package/.agent/skills/performance-profiling/SKILL.md +217 -254
  107. package/.agent/skills/plan-writing/SKILL.md +84 -118
  108. package/.agent/skills/platform-engineer/SKILL.md +89 -123
  109. package/.agent/skills/playwright-best-practices/SKILL.md +128 -162
  110. package/.agent/skills/powershell-windows/SKILL.md +112 -146
  111. package/.agent/skills/python-patterns/SKILL.md +7 -35
  112. package/.agent/skills/python-pro/SKILL.md +148 -754
  113. package/.agent/skills/react-specialist/SKILL.md +123 -827
  114. package/.agent/skills/readme-builder/SKILL.md +15 -85
  115. package/.agent/skills/realtime-patterns/SKILL.md +269 -304
  116. package/.agent/skills/red-team-tactics/SKILL.md +10 -51
  117. package/.agent/skills/rust-pro/SKILL.md +623 -701
  118. package/.agent/skills/seo-fundamentals/SKILL.md +120 -154
  119. package/.agent/skills/server-management/SKILL.md +156 -190
  120. package/.agent/skills/shadcn-ui-expert/SKILL.md +172 -206
  121. package/.agent/skills/skill-creator/SKILL.md +18 -58
  122. package/.agent/skills/sql-pro/SKILL.md +579 -633
  123. package/.agent/skills/supabase-postgres-best-practices/SKILL.md +28 -68
  124. package/.agent/skills/swiftui-expert/SKILL.md +142 -176
  125. package/.agent/skills/systematic-debugging/SKILL.md +84 -118
  126. package/.agent/skills/tailwind-patterns/SKILL.md +516 -576
  127. package/.agent/skills/tdd-workflow/SKILL.md +103 -137
  128. package/.agent/skills/test-result-analyzer/SKILL.md +33 -73
  129. package/.agent/skills/testing-patterns/SKILL.md +512 -573
  130. package/.agent/skills/trend-researcher/SKILL.md +30 -71
  131. package/.agent/skills/ui-ux-pro-max/SKILL.md +0 -41
  132. package/.agent/skills/ui-ux-researcher/SKILL.md +51 -91
  133. package/.agent/skills/vue-expert/SKILL.md +127 -866
  134. package/.agent/skills/vulnerability-scanner/SKILL.md +354 -269
  135. package/.agent/skills/web-accessibility-auditor/SKILL.md +159 -193
  136. package/.agent/skills/web-design-guidelines/SKILL.md +17 -61
  137. package/.agent/skills/webapp-testing/SKILL.md +111 -145
  138. package/.agent/skills/whimsy-injector/SKILL.md +58 -132
  139. package/.agent/skills/workflow-optimizer/SKILL.md +28 -68
  140. package/.agent/workflows/api-tester.md +151 -151
  141. package/.agent/workflows/audit.md +127 -138
  142. package/.agent/workflows/brainstorm.md +110 -110
  143. package/.agent/workflows/changelog.md +112 -112
  144. package/.agent/workflows/create.md +124 -124
  145. package/.agent/workflows/debug.md +165 -189
  146. package/.agent/workflows/deploy.md +180 -189
  147. package/.agent/workflows/enhance.md +128 -151
  148. package/.agent/workflows/fix.md +114 -135
  149. package/.agent/workflows/generate.md +12 -4
  150. package/.agent/workflows/migrate.md +160 -160
  151. package/.agent/workflows/orchestrate.md +168 -168
  152. package/.agent/workflows/performance-benchmarker.md +114 -123
  153. package/.agent/workflows/plan.md +173 -173
  154. package/.agent/workflows/preview.md +80 -80
  155. package/.agent/workflows/refactor.md +161 -183
  156. package/.agent/workflows/review-ai.md +101 -129
  157. package/.agent/workflows/review.md +116 -116
  158. package/.agent/workflows/session.md +94 -94
  159. package/.agent/workflows/status.md +79 -79
  160. package/.agent/workflows/strengthen-skills.md +138 -139
  161. package/.agent/workflows/swarm.md +179 -179
  162. package/.agent/workflows/test.md +189 -211
  163. package/.agent/workflows/tribunal-backend.md +93 -113
  164. package/.agent/workflows/tribunal-database.md +94 -115
  165. package/.agent/workflows/tribunal-frontend.md +95 -118
  166. package/.agent/workflows/tribunal-full.md +92 -133
  167. package/.agent/workflows/tribunal-mobile.md +94 -119
  168. package/.agent/workflows/tribunal-performance.md +109 -133
  169. package/.agent/workflows/ui-ux-pro-max.md +122 -143
  170. package/package.json +1 -1
  171. package/.agent/skills/api-patterns/api-style.md +0 -42
  172. package/.agent/skills/api-patterns/auth.md +0 -24
  173. package/.agent/skills/api-patterns/documentation.md +0 -26
  174. package/.agent/skills/api-patterns/graphql.md +0 -41
  175. package/.agent/skills/api-patterns/rate-limiting.md +0 -31
  176. package/.agent/skills/api-patterns/response.md +0 -37
  177. package/.agent/skills/api-patterns/rest.md +0 -40
  178. package/.agent/skills/api-patterns/security-testing.md +0 -122
  179. package/.agent/skills/api-patterns/trpc.md +0 -41
  180. package/.agent/skills/api-patterns/versioning.md +0 -22
  181. package/.agent/skills/app-builder/agent-coordination.md +0 -71
  182. package/.agent/skills/app-builder/feature-building.md +0 -53
  183. package/.agent/skills/app-builder/project-detection.md +0 -34
  184. package/.agent/skills/app-builder/scaffolding.md +0 -118
  185. package/.agent/skills/app-builder/tech-stack.md +0 -40
  186. package/.agent/skills/architecture/context-discovery.md +0 -43
  187. package/.agent/skills/architecture/examples.md +0 -94
  188. package/.agent/skills/architecture/pattern-selection.md +0 -68
  189. package/.agent/skills/architecture/patterns-reference.md +0 -50
  190. package/.agent/skills/architecture/trade-off-analysis.md +0 -77
  191. package/.agent/skills/brainstorming/dynamic-questioning.md +0 -360
  192. package/.agent/skills/database-design/database-selection.md +0 -43
  193. package/.agent/skills/database-design/indexing.md +0 -39
  194. package/.agent/skills/database-design/migrations.md +0 -48
  195. package/.agent/skills/database-design/optimization.md +0 -36
  196. package/.agent/skills/database-design/orm-selection.md +0 -30
  197. package/.agent/skills/database-design/schema-design.md +0 -56
  198. package/.agent/skills/frontend-design/animation-guide.md +0 -331
  199. package/.agent/skills/frontend-design/color-system.md +0 -329
  200. package/.agent/skills/frontend-design/decision-trees.md +0 -418
  201. package/.agent/skills/frontend-design/motion-graphics.md +0 -306
  202. package/.agent/skills/frontend-design/typography-system.md +0 -363
  203. package/.agent/skills/frontend-design/ux-psychology.md +0 -1116
  204. package/.agent/skills/frontend-design/visual-effects.md +0 -383
  205. package/.agent/skills/intelligent-routing/router-manifest.md +0 -65
  206. package/.agent/skills/mobile-design/decision-trees.md +0 -516
  207. package/.agent/skills/mobile-design/mobile-backend.md +0 -491
  208. package/.agent/skills/mobile-design/mobile-color-system.md +0 -420
  209. package/.agent/skills/mobile-design/mobile-debugging.md +0 -122
  210. package/.agent/skills/mobile-design/mobile-design-thinking.md +0 -357
  211. package/.agent/skills/mobile-design/mobile-navigation.md +0 -458
  212. package/.agent/skills/mobile-design/mobile-performance.md +0 -767
  213. package/.agent/skills/mobile-design/mobile-testing.md +0 -356
  214. package/.agent/skills/mobile-design/mobile-typography.md +0 -433
  215. package/.agent/skills/mobile-design/platform-android.md +0 -666
  216. package/.agent/skills/mobile-design/platform-ios.md +0 -561
  217. package/.agent/skills/mobile-design/touch-psychology.md +0 -537
  218. package/.agent/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +0 -312
  219. package/.agent/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +0 -240
  220. package/.agent/skills/nextjs-react-expert/3-server-server-side-performance.md +0 -490
  221. package/.agent/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +0 -264
  222. package/.agent/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +0 -581
  223. package/.agent/skills/nextjs-react-expert/6-rendering-rendering-performance.md +0 -432
  224. package/.agent/skills/nextjs-react-expert/7-js-javascript-performance.md +0 -684
  225. package/.agent/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +0 -150
  226. package/.agent/skills/vulnerability-scanner/checklists.md +0 -121
@@ -4,8 +4,8 @@ trigger: always_on
4
4
 
5
5
  # Tribunal Agent Kit — Master Rules
6
6
 
7
- > These rules are always active. Every agent, every request, every response.
8
- > Rule priority: this file (P0) > agent .md file (P1) > skill SKILL.md (P2)
7
+ These rules are always active. Every agent, every request, every response.
8
+ Rule priority: this file (P0) agent .md file (P1) skill SKILL.md (P2)
9
9
 
10
10
  ---
11
11
 
@@ -13,14 +13,14 @@ trigger: always_on
13
13
 
14
14
  Before any action, identify request type:
15
15
 
16
- | Type | Keywords | What Happens |
16
+ |Type|Keywords|What Happens|
17
17
  |---|---|---|
18
- | **Question** | "what is", "how does", "explain", "why" | Text answer only — no agents, no files |
19
- | **Survey** | "analyze", "list", "overview", "scan" | Read + report — no code written |
20
- | **Simple edit** | "fix", "change", "update" (single file) | Direct edit — no plan required |
21
- | **Complex build** | "build", "create", "implement", "refactor" | Requires plan file + agent routing |
22
- | **Design/UI** | "design", "UI", "page", "dashboard" | Requires design agent + plan file |
23
- | **Slash command** | starts with `/` | Route to matching workflow file |
18
+ |**Question**|"what is", "how does", "explain", "why"|Text answer only — no agents, no files|
19
+ |**Survey**|"analyze", "list", "overview", "scan"|Read + report — no code written|
20
+ |**Simple edit**|"fix", "change", "update" (single file)|Direct edit — no plan required|
21
+ |**Complex build**|"build", "create", "implement", "refactor"|Requires plan file + agent routing|
22
+ |**Design/UI**|"design", "UI", "page", "dashboard"|Requires design agent + plan file|
23
+ |**Slash command**|starts with `/`|Route to matching workflow file|
24
24
 
25
25
  ---
26
26
 
@@ -30,26 +30,26 @@ Every code or design request activates an agent. This is not optional.
30
30
 
31
31
  **Auto-routing rules:**
32
32
 
33
- | Domain | Primary Agent / Skill |
33
+ |Domain|Primary Agent / Skill|
34
34
  |---|---|
35
- | API / server / backend | `backend-specialist` |
36
- | C# / .NET / Blazor | `dotnet-core-expert` |
37
- | Python / FastAPI / Django | `python-pro` |
38
- | Database / schema / SQL | `database-architect` |
39
- | Advanced SQL queries | `sql-pro` |
40
- | React / Next.js / UI | `frontend-specialist` |
41
- | Advanced React architecture | `react-specialist` |
42
- | Vue / Nuxt | `vue-expert` |
43
- | Mobile (RN / Flutter) | `mobile-developer` |
44
- | Debugging / errors | `debugger` |
45
- | Security / vulnerabilities | `security-auditor` |
46
- | Performance / optimization | `performance-optimizer` |
47
- | DevOps / CI-CD / Docker | `devops-engineer` |
48
- | Production incidents | `devops-incident-responder` |
49
- | Platform / Infrastructure | `platform-engineer` |
50
- | Multi-agent architecture | `agent-organizer` |
51
- | Multi-domain (2+ areas) | `orchestrator` |
52
- | Unknown codebase | `explorer-agent` |
35
+ |API / server / backend|`backend-specialist`|
36
+ |C# / .NET / Blazor|`dotnet-core-expert`|
37
+ |Python / FastAPI / Django|`python-pro`|
38
+ |Database / schema / SQL|`database-architect`|
39
+ |Advanced SQL queries|`sql-pro`|
40
+ |React / Next.js / UI|`frontend-specialist`|
41
+ |Advanced React architecture|`react-specialist`|
42
+ |Vue / Nuxt|`vue-expert`|
43
+ |Mobile (RN / Flutter)|`mobile-developer`|
44
+ |Debugging / errors|`debugger`|
45
+ |Security / vulnerabilities|`security-auditor`|
46
+ |Performance / optimization|`performance-optimizer`|
47
+ |DevOps / CI-CD / Docker|`devops-engineer`|
48
+ |Production incidents|`devops-incident-responder`|
49
+ |Platform / Infrastructure|`platform-engineer`|
50
+ |Multi-agent architecture|`agent-organizer`|
51
+ |Multi-domain (2+ areas)|`orchestrator`|
52
+ |Unknown codebase|`explorer-agent`|
53
53
 
54
54
  **When activated, announce the agent:**
55
55
 
@@ -76,12 +76,12 @@ For any complex build, new feature, or unclear request — stop and ask before w
76
76
 
77
77
  **Required questions by type:**
78
78
 
79
- | Request | Minimum Questions |
79
+ |Request|Minimum Questions|
80
80
  |---|---|
81
- | New feature or build | 3+ strategic questions about goal, stack, scope |
82
- | Code edit or bug fix | Confirm understanding + ask about impact |
83
- | Vague request | Ask about purpose, users, and scope |
84
- | Full orchestration | Block all subagents until plan is confirmed |
81
+ |New feature or build|3+ strategic questions about goal, stack, scope|
82
+ |Code edit or bug fix|Confirm understanding + ask about impact|
83
+ |Vague request|Ask about purpose, users, and scope|
84
+ |Full orchestration|Block all subagents until plan is confirmed|
85
85
 
86
86
  **Rules:**
87
87
  - Never assume. If even 1% is unclear → ask.
@@ -136,14 +136,14 @@ The Human Gate is never skipped. No code is written to a file without explicit u
136
136
 
137
137
  **Reviewer assignment by domain:**
138
138
 
139
- | Code type | Reviewers |
139
+ |Code type|Reviewers|
140
140
  |---|---|
141
- | Backend/API | logic + security + dependency + type-safety |
142
- | Frontend/React | logic + security + frontend + type-safety |
143
- | Database/SQL | logic + security + sql |
144
- | Mobile/Cross-platform | logic + security + mobile-reviewer + type-safety |
145
- | Any domain | + performance (if optimization) |
146
- | Before merge | /tribunal-full (all 9) |
141
+ |Backend/API|logic + security + dependency + type-safety|
142
+ |Frontend/React|logic + security + frontend + type-safety|
143
+ |Database/SQL|logic + security + sql|
144
+ |Mobile/Cross-platform|logic + security + mobile-reviewer + type-safety|
145
+ |Any domain|+ performance (if optimization)|
146
+ |Before merge|/tribunal-full (all 9)|
147
147
 
148
148
  ---
149
149
 
@@ -200,21 +200,21 @@ Script crashes → Catch exception, report stack trace, continue
200
200
 
201
201
  These scripts live in `.agent/scripts/`. Agents and skills can invoke them:
202
202
 
203
- | Script | Purpose | When |
203
+ |Script|Purpose|When|
204
204
  |---|---|---|
205
- | `checklist.py` | Priority audit: Security→Lint→Schema→Tests→UX→SEO | Before/after any major change |
206
- | `verify_all.py` | Full pre-deploy validation suite | Pre-deploy |
207
- | `auto_preview.py` | Start/stop/restart local dev server | After /create or /enhance |
208
- | `session_manager.py` | Track session state between conversations | Multi-session work |
209
- | `lint_runner.py` | Standalone lint runner (ESLint, Prettier, Ruff) | Every code change |
210
- | `test_runner.py` | Standalone test runner (Jest, Vitest, pytest, Go) | After logic changes |
211
- | `security_scan.py` | Deep OWASP-aware source code security scan | Always on deploy, /audit |
212
- | `dependency_analyzer.py` | Unused/phantom deps, npm audit | Weekly, /audit |
213
- | `schema_validator.py` | Database schema validation (Prisma, SQL) | After DB changes |
214
- | `bundle_analyzer.py` | JS/TS bundle size analysis | Before deploy |
215
- | `skill_integrator.py` | Maps active skills to their executable scripts | Automatically when skills are invoked |
216
- | `swarm_dispatcher.py` | Validate Orchestrator micro-worker JSON payloads | After /orchestrate, before dispatching agents |
217
- | `test_swarm_dispatcher.py` | Unit tests for swarm_dispatcher | After modifying swarm_dispatcher.py |
205
+ |`checklist.py`|Priority audit: Security→Lint→Schema→Tests→UX→SEO|Before/after any major change|
206
+ |`verify_all.py`|Full pre-deploy validation suite|Pre-deploy|
207
+ |`auto_preview.py`|Start/stop/restart local dev server|After /create or /enhance|
208
+ |`session_manager.py`|Track session state between conversations|Multi-session work|
209
+ |`lint_runner.py`|Standalone lint runner (ESLint, Prettier, Ruff)|Every code change|
210
+ |`test_runner.py`|Standalone test runner (Jest, Vitest, pytest, Go)|After logic changes|
211
+ |`security_scan.py`|Deep OWASP-aware source code security scan|Always on deploy, /audit|
212
+ |`dependency_analyzer.py`|Unused/phantom deps, npm audit|Weekly, /audit|
213
+ |`schema_validator.py`|Database schema validation (Prisma, SQL)|After DB changes|
214
+ |`bundle_analyzer.py`|JS/TS bundle size analysis|Before deploy|
215
+ |`skill_integrator.py`|Maps active skills to their executable scripts|Automatically when skills are invoked|
216
+ |`swarm_dispatcher.py`|Validate Orchestrator micro-worker JSON payloads|After /orchestrate, before dispatching agents|
217
+ |`test_swarm_dispatcher.py`|Unit tests for swarm_dispatcher|After modifying swarm_dispatcher.py|
218
218
 
219
219
  **Run pattern:**
220
220
  ```
@@ -235,11 +235,11 @@ python .agent/scripts/test_swarm_dispatcher.py
235
235
 
236
236
  ## Mode Behavior
237
237
 
238
- | Mode | Active Agent | Rules |
238
+ |Mode|Active Agent|Rules|
239
239
  |---|---|---|
240
- | `plan` | `project-planner` | 4-phase: Analyze → Plan → Solution → Implement. NO CODE before Phase 4. |
241
- | `ask` | none | Answer only — no implementation |
242
- | `edit` | `orchestrator` | Execute. Check `{task-slug}.md` first if multi-file. |
240
+ |`plan`|`project-planner`|4-phase: Analyze → Plan → Solution → Implement. NO CODE before Phase 4.|
241
+ |`ask`|none|Answer only — no implementation|
242
+ |`edit`|`orchestrator`|Execute. Check `{task-slug}.md` first if multi-file.|
243
243
 
244
244
  **Plan Mode phases:**
245
245
  1. Analyze → research and questions
@@ -273,12 +273,12 @@ AI agents have a finite context window. Poorly managed context causes truncation
273
273
 
274
274
  **Context discipline by task type:**
275
275
 
276
- | Task Type | Attach | Never Attach |
276
+ |Task Type|Attach|Never Attach|
277
277
  |---|---|---|
278
- | Bug fix in one function | That function + its callers | Entire file |
279
- | Schema migration | Schema file + migration history | Unrelated models |
280
- | Orchestrator dispatch | context_summary per worker | Full conversation |
281
- | Code review | File under review | Project-wide context |
278
+ |Bug fix in one function|That function + its callers|Entire file|
279
+ |Schema migration|Schema file + migration history|Unrelated models|
280
+ |Orchestrator dispatch|context_summary per worker|Full conversation|
281
+ |Code review|File under review|Project-wide context|
282
282
 
283
283
  ---
284
284
 
@@ -0,0 +1,167 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ compress_skills.py - Aggressive token reduction for .agent/skills/**/*.md files
4
+ WHAT IT DOES:
5
+ 1. Strips ## šŸ›ļø Tribunal Integration sections (in GEMINI.md globally)
6
+ 2. Strips ## āœ… Pre-Flight Self-Audit sections (duplication)
7
+ 3. Strips ## Cross-Workflow Navigation sections
8
+ 4. Strips ## Output Format sections
9
+ 5. Strips inline comment blocks inside code (// Description of obvious stuff)
10
+ 6. Collapses 3+ empty lines → 1
11
+ 7. Removes chatty intro paragraphs (patterns like "X is Y. If you Z, you're Z.")
12
+ """
13
+
14
+ import os, re, sys
15
+
16
+ # ─── Section strippers ──────────────────────────────────────────────────────
17
+
18
+ SECTION_PATTERNS = [
19
+ # Tribunal / pre-flight boilerplate (global in GEMINI.md)
20
+ r'(?m)^## šŸ›ļø Tribunal Integration[\s\S]*?(?=\n## |\n# |\Z)',
21
+ r'(?m)^## Tribunal Integration[\s\S]*?(?=\n## |\n# |\Z)',
22
+ r'(?m)^### āœ… Pre-Flight Self-Audit[\s\S]*?(?=\n## |\n### |\n# |\Z)',
23
+ r'(?m)^## Pre-Flight Self-Audit[\s\S]*?(?=\n## |\n# |\Z)',
24
+ r'(?m)^## Cross-Workflow Navigation[\s\S]*?(?=\n## |\n# |\Z)',
25
+ r'(?m)^## Output Format\s*\n```[\s\S]*?```\s*\n',
26
+ r'(?m)^## VBC Protocol[\s\S]*?(?=\n## |\n# |\Z)',
27
+ r'(?m)^## LLM Traps[\s\S]*?(?=\n## |\n# |\Z)',
28
+ ]
29
+
30
+ # ─── Chatty intro line patterns ───────────────────────────────────────────
31
+ # e.g. "React 19 is a paradigm shift. Server Components are the default."
32
+ # These are after the frontmatter H1 title — motivational filler.
33
+ CHATTY_INTRO = re.compile(
34
+ r'(?m)^(# .+\n)\n[A-Z][^#\n]{60,}\n[A-Z][^#\n]{40,}\n\n---',
35
+ )
36
+
37
+ def strip_chatty_intro(content):
38
+ def replace(m):
39
+ return m.group(1) + '\n---'
40
+ return CHATTY_INTRO.sub(replace, content)
41
+
42
+ # ─── Trim verbose inline comments in code blocks ─────────────────────────
43
+ # Removes "// comment that just restates the surrounding code name"
44
+ OBVIOUS_COMMENT = re.compile(
45
+ r'(?m)^(\s*)(// (default for most properties|shorthand|number of repeats|default: \d+|spring tension|resistance|weight|approximate duration|deceleration rate)[^\n]*)\n'
46
+ )
47
+
48
+ def strip_obvious_comments(content):
49
+ return OBVIOUS_COMMENT.sub('', content)
50
+
51
+ # ─── Long repetitive āœ…/āŒ rule blocks that repeat main section ────────────
52
+ # These are usually "Performance Rules" text blocks restating code above
53
+ PERF_TEXT_BLOCK = re.compile(
54
+ r'(?m)^```\n(āœ… Use \w[^\n]*\n → [^\n]*\n\n?){3,}```\n'
55
+ )
56
+ def compress_perf_blocks(content):
57
+ def to_bullets(m):
58
+ text = m.group(0)
59
+ lines = text.strip('`\n').splitlines()
60
+ bullets = []
61
+ for line in lines:
62
+ stripped = line.strip()
63
+ if stripped.startswith('āœ…') or stripped.startswith('āŒ'):
64
+ bullets.append(f'- {stripped}')
65
+ elif stripped.startswith('→'):
66
+ bullets[-1] += f' ({stripped[1:].strip()})'
67
+ return '\n'.join(bullets) + '\n'
68
+ return PERF_TEXT_BLOCK.sub(to_bullets, content)
69
+
70
+ # ─── Collapse empty lines ────────────────────────────────────────────────
71
+ def collapse_blanks(content):
72
+ return re.sub(r'\n{3,}', '\n\n', content)
73
+
74
+ # ─── Remove "This is X — not Y" filler sentences before the first ## ─────
75
+ FILLER_BEFORE_SECTION = re.compile(
76
+ r'(?m)(^# .+\n\n)([A-Z][^\n]+\n){1,4}(\n---\n)',
77
+ re.MULTILINE
78
+ )
79
+ def remove_filler_between_title_and_hr(content):
80
+ def replacement(m):
81
+ return m.group(1) + m.group(3)
82
+ return FILLER_BEFORE_SECTION.sub(replacement, content)
83
+
84
+ # ─── Strip redundant version comment banners ────────────────────────────
85
+ # e.g. "// motion.div, motion.span, motion.button, motion.svg, motion.path, etc."
86
+ # "// Any HTML or SVG element can be prefixed with `motion.`" - obvious
87
+ REDUNDANT_NOTE = re.compile(r'(?m)^// (motion\.\w+|Any HTML|Note:|Variant names propagate|// )[^\n]*\n')
88
+
89
+ def strip_redundant_notes(content):
90
+ return REDUNDANT_NOTE.sub('', content)
91
+
92
+ # ─── Main pipeline ────────────────────────────────────────────────────────
93
+
94
+ def compress_file(path):
95
+ with open(path, 'r', encoding='utf-8', errors='ignore') as f:
96
+ original = f.read()
97
+
98
+ content = original
99
+
100
+ # 1. Strip global boilerplate sections
101
+ for pattern in SECTION_PATTERNS:
102
+ content = re.sub(pattern, '', content)
103
+
104
+ # 2. Remove chatty intro paragraphs
105
+ content = strip_chatty_intro(content)
106
+
107
+ # 3. Remove filler between title and first ---
108
+ content = remove_filler_between_title_and_hr(content)
109
+
110
+ # 4. Strip obvious inline comments from code
111
+ content = strip_obvious_comments(content)
112
+
113
+ # 5. Strip redundant notes
114
+ content = strip_redundant_notes(content)
115
+
116
+ # 6. Compress verbose perf rule text blocks to bullet lists
117
+ content = compress_perf_blocks(content)
118
+
119
+ # 7. Collapse 3+ blank lines
120
+ content = collapse_blanks(content)
121
+
122
+ # Write back
123
+ with open(path, 'w', encoding='utf-8') as f:
124
+ f.write(content.strip() + '\n')
125
+
126
+ saved = len(original) - len(content)
127
+ return len(original), len(content), saved
128
+
129
+ def main():
130
+ base = '.agent/skills'
131
+ if not os.path.exists(base):
132
+ print(f"ERROR: '{base}' not found. Run from tribunal-kit root.", file=sys.stderr)
133
+ sys.exit(1)
134
+
135
+ total_orig = 0
136
+ total_new = 0
137
+ results = []
138
+
139
+ for root, _, files in os.walk(base):
140
+ for fname in files:
141
+ if fname.endswith('.md'):
142
+ path = os.path.join(root, fname)
143
+ orig, new, saved = compress_file(path)
144
+ total_orig += orig
145
+ total_new += new
146
+ if saved > 0:
147
+ results.append((saved, path))
148
+
149
+ results.sort(reverse=True)
150
+
151
+ print(f"\n{'='*55}")
152
+ print(f" Skill Compression Complete")
153
+ print(f"{'='*55}")
154
+ print(f" Original : {total_orig:,} bytes ({total_orig//1024}KB)")
155
+ print(f" After : {total_new:,} bytes ({total_new//1024}KB)")
156
+ saved_total = total_orig - total_new
157
+ pct = saved_total / total_orig * 100 if total_orig else 0
158
+ print(f" Saved : {saved_total:,} bytes ({saved_total//1024}KB) — {pct:.1f}%")
159
+ print(f"\n Top savings:")
160
+ for saved, path in results[:15]:
161
+ skill = os.path.basename(os.path.dirname(path))
162
+ fname = os.path.basename(path)
163
+ print(f" -{saved//1024:2}KB {skill}/{fname}")
164
+ print()
165
+
166
+ if __name__ == '__main__':
167
+ main()
@@ -0,0 +1,173 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ consolidate_skills.py
4
+ Merges all sub-files in skill directories into the main SKILL.md.
5
+ Strips: verbose intros, output format blocks, run scripts tables,
6
+ mandatory read tables, empty headers, redundant boilerplate.
7
+ Keeps: all code blocks, hallucination traps, checklist items.
8
+
9
+ Usage:
10
+ python .agent/scripts/consolidate_skills.py [skill_name]
11
+ python .agent/scripts/consolidate_skills.py # all skills
12
+ """
13
+
14
+ import os, re, sys
15
+
16
+ BASE = '.agent/skills'
17
+
18
+ # These patterns are global (GEMINI.md) — strip from sub-files before merge
19
+ STRIP_PATTERNS = [
20
+ r'(?ms)^## šŸ›ļø Tribunal Integration.*?(?=^## |\Z)',
21
+ r'(?ms)^## Tribunal Integration.*?(?=^## |\Z)',
22
+ r'(?ms)^### āœ… Pre-Flight Self-Audit.*?(?=^###|^## |\Z)',
23
+ r'(?ms)^## Pre-Flight Self-Audit.*?(?=^## |\Z)',
24
+ r'(?ms)^## Output Format\b.*?(?=^## |\Z)',
25
+ r'(?ms)^## šŸ”§ Runtime Scripts.*?(?=^## |\Z)',
26
+ r'(?ms)^## šŸ”“ MANDATORY.*?(?=^## |\Z)',
27
+ r'(?ms)^## āš ļø CRITICAL: ASK BEFORE ASSUMING.*?(?=^## |\Z)',
28
+ r'(?ms)^## šŸ“ CHECKPOINT \(MANDATORY.*?(?=^## |\Z)',
29
+ r'(?ms)^## Output Format.*?```\n[^`]*```\n?(?=^## |\Z)',
30
+ r'(?ms)^\*\*Execute these for validation.*?---\n',
31
+ r'(?ms)^\*\*VBC \(Verification-Before-Completion\).*?\n',
32
+ # MANDATORY read tables
33
+ r'(?ms)^\*\*ā›” DO NOT start.*?---\n?',
34
+ r'(?ms)^> 🧠 \*\*mobile-design.*?\n',
35
+ r'(?ms)^> \*\*STOP.*?\n',
36
+ ]
37
+
38
+ # Heading level adjustment (sub-files use H1 — convert to H2 in merged output)
39
+ def adjust_headings(content, offset=1):
40
+ """Promote headings by adding # chars"""
41
+ lines = content.split('\n')
42
+ out = []
43
+ for line in lines:
44
+ m = re.match(r'^(#{1,5}) ', line)
45
+ if m:
46
+ level = len(m.group(1))
47
+ new_level = min(level + offset, 6)
48
+ line = '#' * new_level + line[level:]
49
+ out.append(line)
50
+ return '\n'.join(out)
51
+
52
+ def clean_content(content):
53
+ """Apply strip patterns"""
54
+ for p in STRIP_PATTERNS:
55
+ content = re.sub(p, '', content)
56
+ content = re.sub(r'\n{3,}', '\n\n', content)
57
+ return content.strip()
58
+
59
+ def extract_frontmatter(content):
60
+ """Return (frontmatter_dict_str, body)"""
61
+ m = re.match(r'^---\n(.*?)\n---\n', content, re.DOTALL)
62
+ if m:
63
+ return m.group(1), content[m.end():]
64
+ return '', content
65
+
66
+ def get_sub_title(content):
67
+ """Get first H1 from a sub-file"""
68
+ m = re.search(r'^# (.+)', content, re.MULTILINE)
69
+ return m.group(1) if m else None
70
+
71
+ def consolidate(skill_dir):
72
+ skill_name = os.path.basename(skill_dir)
73
+ main_path = os.path.join(skill_dir, 'SKILL.md')
74
+ if not os.path.exists(main_path):
75
+ return False
76
+
77
+ # Find sub-files (non-SKILL.md markdown files)
78
+ sub_files = sorted([
79
+ f for f in os.listdir(skill_dir)
80
+ if f.endswith('.md') and f != 'SKILL.md'
81
+ ])
82
+
83
+ if not sub_files:
84
+ return False
85
+
86
+ print(f'\n → Consolidating: {skill_name} ({len(sub_files)} sub-files)')
87
+
88
+ # Read main SKILL.md
89
+ main_content = open(main_path, 'r', encoding='utf-8', errors='ignore').read()
90
+ frontmatter, main_body = extract_frontmatter(main_content)
91
+
92
+ # Clean & update frontmatter version
93
+ fm_lines = frontmatter.split('\n')
94
+ new_fm = []
95
+ for line in fm_lines:
96
+ if line.startswith('version:'):
97
+ new_fm.append('version: 3.1.0')
98
+ elif line.startswith('last-updated:'):
99
+ new_fm.append('last-updated: 2026-04-06')
100
+ else:
101
+ new_fm.append(line)
102
+ frontmatter = '\n'.join(new_fm)
103
+
104
+ # Clean main body
105
+ main_body = clean_content(main_body)
106
+
107
+ # Remove MANDATORY read table from main body
108
+ # (links like [file.md](file.md) in tables)
109
+ main_body = re.sub(r'\|.*?\.md.*?\|.*?\|.*?\|\n', '', main_body)
110
+ main_body = re.sub(r'^\|[-| ]+\|\n', '', main_body, flags=re.MULTILINE)
111
+ main_body = re.sub(r'\n{3,}', '\n\n', main_body)
112
+
113
+ # Merge sub-files
114
+ merged_sections = []
115
+ for fname in sub_files:
116
+ fpath = os.path.join(skill_dir, fname)
117
+ raw = open(fpath, 'r', encoding='utf-8', errors='ignore').read()
118
+ _, body = extract_frontmatter(raw)
119
+ body = clean_content(body)
120
+ # Adjust headings: H1→H2, H2→H3, etc.
121
+ body = adjust_headings(body, offset=1)
122
+ if body.strip():
123
+ merged_sections.append(body.strip())
124
+
125
+ # Build final output
126
+ combined = f'---\n{frontmatter}\n---\n\n{main_body}'
127
+ if merged_sections:
128
+ combined += '\n\n---\n\n' + '\n\n---\n\n'.join(merged_sections)
129
+
130
+ # Final cleanup
131
+ combined = re.sub(r'\n{3,}', '\n\n', combined)
132
+ combined = combined.strip() + '\n'
133
+
134
+ # Measure savings
135
+ total_sub_bytes = sum(os.path.getsize(os.path.join(skill_dir, f)) for f in sub_files)
136
+ print(f' Sub-files total: {total_sub_bytes//1024}KB')
137
+
138
+ # Write consolidated SKILL.md
139
+ with open(main_path, 'w', encoding='utf-8') as f:
140
+ f.write(combined)
141
+
142
+ new_size = os.path.getsize(main_path)
143
+ print(f' New SKILL.md: {new_size//1024}KB (from {len(main_content)//1024}KB main + {total_sub_bytes//1024}KB subs → {new_size//1024}KB)')
144
+
145
+ # Delete sub-files
146
+ for fname in sub_files:
147
+ os.remove(os.path.join(skill_dir, fname))
148
+ print(f' Deleted: {fname}')
149
+
150
+ return True
151
+
152
+ def main():
153
+ target = sys.argv[1] if len(sys.argv) > 1 else None
154
+
155
+ total_saved = 0
156
+ processed = 0
157
+
158
+ for skill_name in os.listdir(BASE):
159
+ skill_dir = os.path.join(BASE, skill_name)
160
+ if not os.path.isdir(skill_dir):
161
+ continue
162
+ if target and skill_name != target:
163
+ continue
164
+ if consolidate(skill_dir):
165
+ processed += 1
166
+
167
+ if processed == 0:
168
+ print('No skills with sub-files found (or target not matched).')
169
+ else:
170
+ print(f'\nāœ… Consolidated {processed} skills.')
171
+
172
+ if __name__ == '__main__':
173
+ main()