tribunal-kit 1.0.0 → 2.4.2

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 (127) hide show
  1. package/.agent/.shared/ui-ux-pro-max/README.md +3 -3
  2. package/.agent/ARCHITECTURE.md +205 -10
  3. package/.agent/GEMINI.md +37 -7
  4. package/.agent/agents/accessibility-reviewer.md +134 -0
  5. package/.agent/agents/ai-code-reviewer.md +129 -0
  6. package/.agent/agents/frontend-specialist.md +3 -0
  7. package/.agent/agents/game-developer.md +21 -21
  8. package/.agent/agents/logic-reviewer.md +12 -0
  9. package/.agent/agents/mobile-reviewer.md +79 -0
  10. package/.agent/agents/orchestrator.md +56 -26
  11. package/.agent/agents/performance-reviewer.md +36 -0
  12. package/.agent/agents/supervisor-agent.md +156 -0
  13. package/.agent/agents/swarm-worker-contracts.md +166 -0
  14. package/.agent/agents/swarm-worker-registry.md +92 -0
  15. package/.agent/rules/GEMINI.md +134 -5
  16. package/.agent/scripts/bundle_analyzer.py +259 -0
  17. package/.agent/scripts/dependency_analyzer.py +247 -0
  18. package/.agent/scripts/lint_runner.py +188 -0
  19. package/.agent/scripts/patch_skills_meta.py +177 -0
  20. package/.agent/scripts/patch_skills_output.py +285 -0
  21. package/.agent/scripts/schema_validator.py +279 -0
  22. package/.agent/scripts/security_scan.py +224 -0
  23. package/.agent/scripts/session_manager.py +144 -3
  24. package/.agent/scripts/skill_integrator.py +234 -0
  25. package/.agent/scripts/strengthen_skills.py +220 -0
  26. package/.agent/scripts/swarm_dispatcher.py +317 -0
  27. package/.agent/scripts/test_runner.py +192 -0
  28. package/.agent/scripts/test_swarm_dispatcher.py +163 -0
  29. package/.agent/skills/agent-organizer/SKILL.md +132 -0
  30. package/.agent/skills/agentic-patterns/SKILL.md +335 -0
  31. package/.agent/skills/api-patterns/SKILL.md +226 -50
  32. package/.agent/skills/app-builder/SKILL.md +215 -52
  33. package/.agent/skills/architecture/SKILL.md +176 -31
  34. package/.agent/skills/bash-linux/SKILL.md +150 -134
  35. package/.agent/skills/behavioral-modes/SKILL.md +152 -160
  36. package/.agent/skills/brainstorming/SKILL.md +148 -101
  37. package/.agent/skills/brainstorming/dynamic-questioning.md +10 -0
  38. package/.agent/skills/clean-code/SKILL.md +139 -134
  39. package/.agent/skills/code-review-checklist/SKILL.md +177 -80
  40. package/.agent/skills/config-validator/SKILL.md +165 -0
  41. package/.agent/skills/csharp-developer/SKILL.md +107 -0
  42. package/.agent/skills/database-design/SKILL.md +252 -29
  43. package/.agent/skills/deployment-procedures/SKILL.md +122 -175
  44. package/.agent/skills/devops-engineer/SKILL.md +134 -0
  45. package/.agent/skills/devops-incident-responder/SKILL.md +98 -0
  46. package/.agent/skills/documentation-templates/SKILL.md +175 -121
  47. package/.agent/skills/dotnet-core-expert/SKILL.md +103 -0
  48. package/.agent/skills/edge-computing/SKILL.md +213 -0
  49. package/.agent/skills/frontend-design/SKILL.md +76 -0
  50. package/.agent/skills/frontend-design/color-system.md +18 -0
  51. package/.agent/skills/frontend-design/typography-system.md +18 -0
  52. package/.agent/skills/game-development/SKILL.md +69 -0
  53. package/.agent/skills/geo-fundamentals/SKILL.md +158 -99
  54. package/.agent/skills/github-operations/SKILL.md +354 -0
  55. package/.agent/skills/i18n-localization/SKILL.md +158 -96
  56. package/.agent/skills/intelligent-routing/SKILL.md +89 -285
  57. package/.agent/skills/intelligent-routing/router-manifest.md +65 -0
  58. package/.agent/skills/lint-and-validate/SKILL.md +229 -27
  59. package/.agent/skills/llm-engineering/SKILL.md +258 -0
  60. package/.agent/skills/local-first/SKILL.md +203 -0
  61. package/.agent/skills/mcp-builder/SKILL.md +159 -111
  62. package/.agent/skills/mobile-design/SKILL.md +102 -282
  63. package/.agent/skills/nextjs-react-expert/SKILL.md +143 -227
  64. package/.agent/skills/nodejs-best-practices/SKILL.md +201 -254
  65. package/.agent/skills/observability/SKILL.md +285 -0
  66. package/.agent/skills/parallel-agents/SKILL.md +124 -118
  67. package/.agent/skills/performance-profiling/SKILL.md +143 -89
  68. package/.agent/skills/plan-writing/SKILL.md +133 -97
  69. package/.agent/skills/platform-engineer/SKILL.md +135 -0
  70. package/.agent/skills/powershell-windows/SKILL.md +167 -104
  71. package/.agent/skills/python-patterns/SKILL.md +149 -361
  72. package/.agent/skills/python-pro/SKILL.md +114 -0
  73. package/.agent/skills/react-specialist/SKILL.md +107 -0
  74. package/.agent/skills/readme-builder/SKILL.md +270 -0
  75. package/.agent/skills/realtime-patterns/SKILL.md +296 -0
  76. package/.agent/skills/red-team-tactics/SKILL.md +136 -134
  77. package/.agent/skills/rust-pro/SKILL.md +237 -173
  78. package/.agent/skills/seo-fundamentals/SKILL.md +134 -82
  79. package/.agent/skills/server-management/SKILL.md +155 -104
  80. package/.agent/skills/sql-pro/SKILL.md +104 -0
  81. package/.agent/skills/systematic-debugging/SKILL.md +156 -79
  82. package/.agent/skills/tailwind-patterns/SKILL.md +163 -205
  83. package/.agent/skills/tdd-workflow/SKILL.md +148 -88
  84. package/.agent/skills/test-result-analyzer/SKILL.md +299 -0
  85. package/.agent/skills/testing-patterns/SKILL.md +141 -114
  86. package/.agent/skills/trend-researcher/SKILL.md +228 -0
  87. package/.agent/skills/ui-ux-pro-max/SKILL.md +107 -0
  88. package/.agent/skills/ui-ux-researcher/SKILL.md +234 -0
  89. package/.agent/skills/vue-expert/SKILL.md +118 -0
  90. package/.agent/skills/vulnerability-scanner/SKILL.md +228 -188
  91. package/.agent/skills/web-design-guidelines/SKILL.md +148 -33
  92. package/.agent/skills/webapp-testing/SKILL.md +171 -122
  93. package/.agent/skills/whimsy-injector/SKILL.md +349 -0
  94. package/.agent/skills/workflow-optimizer/SKILL.md +219 -0
  95. package/.agent/workflows/api-tester.md +279 -0
  96. package/.agent/workflows/audit.md +168 -0
  97. package/.agent/workflows/brainstorm.md +65 -19
  98. package/.agent/workflows/changelog.md +144 -0
  99. package/.agent/workflows/create.md +67 -14
  100. package/.agent/workflows/debug.md +122 -30
  101. package/.agent/workflows/deploy.md +82 -31
  102. package/.agent/workflows/enhance.md +59 -27
  103. package/.agent/workflows/fix.md +143 -0
  104. package/.agent/workflows/generate.md +84 -20
  105. package/.agent/workflows/migrate.md +163 -0
  106. package/.agent/workflows/orchestrate.md +66 -17
  107. package/.agent/workflows/performance-benchmarker.md +305 -0
  108. package/.agent/workflows/plan.md +76 -33
  109. package/.agent/workflows/preview.md +73 -17
  110. package/.agent/workflows/refactor.md +153 -0
  111. package/.agent/workflows/review-ai.md +140 -0
  112. package/.agent/workflows/review.md +83 -16
  113. package/.agent/workflows/session.md +154 -0
  114. package/.agent/workflows/status.md +74 -18
  115. package/.agent/workflows/strengthen-skills.md +99 -0
  116. package/.agent/workflows/swarm.md +194 -0
  117. package/.agent/workflows/test.md +80 -31
  118. package/.agent/workflows/tribunal-backend.md +55 -13
  119. package/.agent/workflows/tribunal-database.md +62 -18
  120. package/.agent/workflows/tribunal-frontend.md +58 -12
  121. package/.agent/workflows/tribunal-full.md +70 -11
  122. package/.agent/workflows/tribunal-mobile.md +123 -0
  123. package/.agent/workflows/tribunal-performance.md +152 -0
  124. package/.agent/workflows/ui-ux-pro-max.md +100 -82
  125. package/README.md +117 -62
  126. package/bin/tribunal-kit.js +542 -288
  127. package/package.json +10 -6
@@ -8,7 +8,18 @@ $ARGUMENTS
8
8
 
9
9
  ---
10
10
 
11
- This command either generates tests that actually test things, or audits existing tests to find ones that don't. A test that always passes isn't protecting anything.
11
+ This command either **generates tests that actually test things**, or **audits existing tests** to find ones that don't. A test that always passes isn't protecting anything.
12
+
13
+ ---
14
+
15
+ ## When to Use /test vs Other Commands
16
+
17
+ | Use `/test` when... | Use something else when... |
18
+ |---|---|
19
+ | No tests exist for working code | Code is broken → `/debug` first, then `/test` |
20
+ | Tests exist but coverage is thin | Quality of test assertions → use `audit` mode |
21
+ | You changed behavior and need regression tests | Full project test health → `/audit` |
22
+ | You want edge case coverage only | Integration tests → specify in the test plan |
12
23
 
13
24
  ---
14
25
 
@@ -19,31 +30,40 @@ This command either generates tests that actually test things, or audits existin
19
30
  /test audit → Check existing tests for quality issues
20
31
  /test coverage → Identify code paths with no test coverage
21
32
  /test edge [function] → Generate edge-case tests only (null, empty, boundary)
33
+ /test run → Run the existing test suite and analyze failures
22
34
  ```
23
35
 
24
36
  ---
25
37
 
26
- ## When Generating Tests
38
+ ## Mode: Generate Tests
27
39
 
28
- **First, the code is read:**
29
- - Every execution path is mapped (normal path, error path, edge cases)
30
- - Direct external dependencies are identified (to mock)
31
- - Expected inputs and outputs are derived from the function signature and behavior
40
+ ### First Read the Code
32
41
 
33
- **Then a test plan is written before code:**
42
+ Before writing a single test, map:
43
+
44
+ - Every **execution path** (normal path, error path, edge cases)
45
+ - All **direct external dependencies** (to identify what needs mocking)
46
+ - **Expected inputs and outputs** — derived from the function signature and actual behavior, not assumed
47
+
48
+ ### Then — Write the Test Plan
49
+
50
+ A plan must be written **before** test code:
34
51
 
35
52
  ```
36
- Target: [function or module]
53
+ Target: [function or module name]
54
+ Framework: [Jest | Vitest | pytest | Go test]
37
55
 
38
56
  Path inventory:
39
- › Normal path with valid input
40
- › Null / undefined input
41
- › Empty string / empty array
42
- › Boundary value (0, -1, MAX)
43
- › Async rejection / network failure
44
- › Invalid type input
45
-
46
- Dependencies to mock: [list — minimal, only direct deps]
57
+ › Normal path valid input, expected output
58
+ › Null / undefined / None input
59
+ › Empty string / empty array / empty object
60
+ › Boundary values (0, -1, MAX_INT, max string length)
61
+ › Async rejection / network failure / timeout
62
+ › Invalid type input (string where number expected, etc.)
63
+ › Auth / permission fail path
64
+ Concurrent access (if applicable)
65
+
66
+ Dependencies to mock: [list — minimal, only direct external deps]
47
67
  ```
48
68
 
49
69
  **Then tests are written and passed through `test-coverage-reviewer`.**
@@ -58,7 +78,7 @@ Every generated test file follows this format:
58
78
  describe('[Unit under test]', () => {
59
79
 
60
80
  describe('[scenario group]', () => {
61
- it('[specific behavior]', () => {
81
+ it('[specific behavior being tested]', () => {
62
82
  // Arrange
63
83
  const input = [setup value];
64
84
 
@@ -72,11 +92,11 @@ describe('[Unit under test]', () => {
72
92
 
73
93
  describe('edge cases', () => {
74
94
  it('throws when input is null', () => {
75
- expect(() => functionUnderTest(null)).toThrow('[exact message]');
95
+ expect(() => functionUnderTest(null)).toThrow('[exact error message]');
76
96
  });
77
97
 
78
- it('handles empty string', () => {
79
- expect(() => functionUnderTest('')).toThrow('[exact message]');
98
+ it('handles empty string without crashing', () => {
99
+ expect(functionUnderTest('')).toBe([expected fallback value]);
80
100
  });
81
101
  });
82
102
 
@@ -85,25 +105,52 @@ describe('[Unit under test]', () => {
85
105
 
86
106
  ---
87
107
 
88
- ## When Auditing Existing Tests
108
+ ## Mode: Audit Existing Tests
89
109
 
90
110
  The `test-coverage-reviewer` flags:
91
111
 
92
- | Problem | What It Looks Like |
93
- |---|---|
94
- | Tautology test | `expect(fn(x)).toBe(fn(x))` always passes |
95
- | No assertion | `it('works', () => { fn(); })` nothing checked |
96
- | Missing edge cases | Suite has happy path only |
97
- | Over-mocking | Every dependency mocked nothing real tested |
112
+ | Problem | What It Looks Like | Why It's Bad |
113
+ |---|---|---|
114
+ | Tautology test | `expect(fn(x)).toBe(fn(x))` | Always passes regardless of fn's behavior |
115
+ | No assertion | `it('works', () => { fn(); })` | Passes even if fn throws wrong output |
116
+ | Missing edge cases | Suite has happy path only | Misses real-world failure modes |
117
+ | Over-mocking | Every dep mocked, nothing real tested | Tests the mocking framework, not the code |
118
+ | Vacuous truthy | `expect(result).toBeTruthy()` | Passes for `1`, `"a"`, `{}`, `[]` |
119
+
120
+ ---
121
+
122
+ ## Mode: Run Tests
123
+
124
+ ```bash
125
+ // turbo
126
+ python .agent/scripts/test_runner.py . --coverage
127
+ ```
128
+
129
+ After running, the `test-result-analyzer` identifies:
130
+ - Root causes across multiple failing test files
131
+ - Whether failures are from flaky setup or actual code breakage
132
+ - Actionable fix recommendations
98
133
 
99
134
  ---
100
135
 
101
136
  ## Hallucination Guard
102
137
 
103
- - Only documented Vitest/Jest methods are used — never `test.eventually()`, `expect.when()`, or invented matchers
104
- - Assertions test specific values — `toBe('exact')`, not `toBeDefined()` or `toBeTruthy()`
105
- - Mocks are **minimal** — only the direct external dependency of the unit, not the whole world
106
- - After auditing existing tests: all conclusions are backed by reading the actual test code
138
+ - Only **documented** Vitest/Jest/pytest methods are used — never `test.eventually()`, `expect.when()`, or inventions
139
+ - Assertions test **specific values** — `toBe('exact')`, not `toBeDefined()` or `toBeTruthy()`
140
+ - Mocks are **minimal** — only the direct external dependency, not the whole world
141
+ - All conclusions about existing test quality are backed by **reading the actual test code**
142
+ - `// VERIFY: check this matcher exists` on any assertion method not commonly used
143
+
144
+ ---
145
+
146
+ ## Cross-Workflow Navigation
147
+
148
+ | After /test shows... | Go to |
149
+ |---|---|
150
+ | Failures in existing tests after a change | `/debug` to find root cause |
151
+ | Code has no tests and is untested in prod | `/review` first for quality check |
152
+ | Tests pass but logic seems wrong | `/review [file]` for deeper audit |
153
+ | Coverage gaps found in security-sensitive paths | `/audit` for full project security + test sweep |
107
154
 
108
155
  ---
109
156
 
@@ -114,4 +161,6 @@ The `test-coverage-reviewer` flags:
114
161
  /test the validateEmail function
115
162
  /test audit — check whether my existing tests actually assert anything
116
163
  /test coverage — show branches with no test
164
+ /test edge validateInput — generate null, empty, boundary tests only
165
+ /test run — execute the suite and analyze failures
117
166
  ```
@@ -12,25 +12,43 @@ Focused audit for backend and API code. Paste server-side code and these four re
12
12
 
13
13
  ---
14
14
 
15
+ ## When to Use This vs Other Tribunals
16
+
17
+ | Code type | Right tribunal |
18
+ |---|---|
19
+ | API routes, auth, middleware | `/tribunal-backend` ← you are here |
20
+ | React components, hooks | `/tribunal-frontend` |
21
+ | SQL queries, ORM, migrations | `/tribunal-database` |
22
+ | Mobile-specific code | `/tribunal-mobile` |
23
+ | Unknown domain or cross-domain | `/tribunal-full` |
24
+
25
+ ---
26
+
15
27
  ## Active Reviewers
16
28
 
17
29
  ```
18
- logic-reviewer → Invented stdlib methods, impossible conditional branches
19
- security-auditor → Auth bypass, SQL injection, secrets in code, rate limiting gaps
30
+ logic-reviewer → Invented stdlib methods, impossible conditional branches,
31
+ calling .user on a req that wasn't authenticated
32
+ security-auditor → Auth bypass, SQL injection, secrets in code, rate limiting gaps,
33
+ JWT algorithm enforcement, CORS misconfiguration
20
34
  dependency-reviewer → Any import not found in your package.json
21
- type-safety-reviewer → Implicit any, unguarded optional access, missing return types
35
+ type-safety-reviewer → Implicit any, unguarded optional access, missing return types,
36
+ unsafe casts
22
37
  ```
23
38
 
24
39
  ---
25
40
 
26
- ## What Gets Flagged
41
+ ## What Gets Flagged — Real Examples
27
42
 
28
- | Reviewer | Common Backend Catches |
43
+ | Reviewer | Example Finding |
29
44
  |---|---|
30
- | logic | Calling `req.user` after a check that could pass with null |
31
- | security | `jwt.verify()` without `algorithms` option allows `alg:none` attack |
32
- | dependency | `import { z } from 'zod'` but zod not in package.json |
33
- | type-safety | `async function handler(req, res)` no types on req or res |
45
+ | logic | `req.user.id` used after a guard that can pass with null user |
46
+ | security | `jwt.verify(token, secret)` no `algorithms` option allows `alg:none` attack |
47
+ | security | `app.use(cors())` with no origin restriction in production |
48
+ | security | `rate-limiter` missing on auth endpoints |
49
+ | dependency | `import { z } from 'zod'` but `zod` not in `package.json` |
50
+ | type-safety | `async function handler(req, res)` — untyped `req` and `res` |
51
+ | type-safety | `const user = await db.findUser(id)` — result typed as `any` |
34
52
 
35
53
  ---
36
54
 
@@ -47,23 +65,47 @@ type-safety-reviewer → Implicit any, unguarded optional access, missing ret
47
65
  ━━━ Issues ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
48
66
 
49
67
  security-auditor:
50
- Critical — Line 44
68
+ CRITICAL — Line 44
51
69
  JWT algorithm not enforced: jwt.verify(token, secret)
52
70
  Fix: jwt.verify(token, secret, { algorithms: ['HS256'] })
53
71
 
72
+ ❌ HIGH — Line 12
73
+ CORS open: app.use(cors()) — allows any origin
74
+ Fix: app.use(cors({ origin: process.env.ALLOWED_ORIGIN }))
75
+
54
76
  type-safety-reviewer:
55
- ⚠️ Medium — Line 10
56
- Request body typed as any — add Zod schema parse at boundary
77
+ ⚠️ MEDIUM — Line 10
78
+ Request body typed as any — use Zod schema parse at the API boundary
79
+ Fix: const body = schema.parse(req.body)
57
80
 
58
- ━━━ Verdict: NEEDS FIXES ━━━━━━━━━━━━━━━━
81
+ ━━━ Verdict: REJECTED fix before merging ━━━━━━
59
82
  ```
60
83
 
61
84
  ---
62
85
 
86
+ ## Hallucination Guard
87
+
88
+ - Logic findings must cite the **exact line and condition** that creates the problem
89
+ - Security findings must name the **attack class** (not just "this is unsafe")
90
+ - No invented framework methods — only documented Express/Fastify/Hono/etc. APIs
91
+
92
+ ---
93
+
94
+ ## Cross-Workflow Navigation
95
+
96
+ | Finding type | Next step |
97
+ |---|---|
98
+ | Security CRITICAL | `/audit` to scan the whole project |
99
+ | All approved | Human Gate to write to disk |
100
+ | SQL queries also present | Add `/tribunal-database` for those specifically |
101
+
102
+ ---
103
+
63
104
  ## Usage
64
105
 
65
106
  ```
66
107
  /tribunal-backend [paste API route code]
67
108
  /tribunal-backend [paste auth middleware]
68
109
  /tribunal-backend src/routes/user.ts
110
+ /tribunal-backend the JWT verification middleware
69
111
  ```
@@ -8,17 +8,31 @@ $ARGUMENTS
8
8
 
9
9
  ---
10
10
 
11
- Focused audit for SQL queries, ORM code, schema changes, and migrations. Provide your schema alongside the code for the most accurate analysis.
11
+ Focused audit for SQL queries, ORM code, schema changes, and migrations. **Provide your schema alongside the code** for the most accurate analysis.
12
+
13
+ ---
14
+
15
+ ## When to Use This vs Other Tribunals
16
+
17
+ | Code type | Right tribunal |
18
+ |---|---|
19
+ | SQL queries, ORM, migrations | `/tribunal-database` ← you are here |
20
+ | API routes, auth, middleware | `/tribunal-backend` |
21
+ | React components, hooks | `/tribunal-frontend` |
22
+ | Unknown domain or cross-domain | `/tribunal-full` |
12
23
 
13
24
  ---
14
25
 
15
26
  ## Active Reviewers
16
27
 
17
28
  ```
18
- logic-reviewer → ORM methods that don't exist, impossible WHERE conditions
19
- security-auditor → Injection surfaces, sensitive data exposed without masking
29
+ logic-reviewer → ORM methods that don't exist, impossible WHERE conditions,
30
+ chained queries on results that could be null
31
+ security-auditor → SQL injection surfaces, sensitive data exposed without masking,
32
+ missing authorization checks before DB access
20
33
  sql-reviewer → String interpolation in queries, N+1 patterns,
21
- references to tables/columns not in the schema
34
+ references to tables/columns not in the schema,
35
+ unbounded SELECT *, missing WHERE clauses on DELETE/UPDATE
22
36
  ```
23
37
 
24
38
  ---
@@ -38,18 +52,22 @@ Code to audit:
38
52
  [paste query or ORM code here]
39
53
  ```
40
54
 
41
- Without the schema, the reviewer flags all table/column references as `[VERIFY — schema not provided]`.
55
+ **Without the schema**, the reviewer flags all table/column references as `[VERIFY — schema not provided]`.
42
56
 
43
57
  ---
44
58
 
45
- ## What Gets Flagged
59
+ ## What Gets Flagged — Real Examples
46
60
 
47
- | Reviewer | Common Database Catches |
48
- |---|---|
49
- | logic | `prisma.user.findFirstOrCreate()` — not a real Prisma method |
50
- | security | `db.query(\`SELECT * WHERE id = ${req.params.id}\`)` — injection |
51
- | sql | `SELECT * FROM payments` when `payments` table not in schema |
52
- | sql | A loop with a `SELECT` inside N+1 query pattern |
61
+ | Reviewer | Example Finding | Severity |
62
+ |---|---|---|
63
+ | logic | `prisma.user.findFirstOrCreate()` — not a real Prisma method | ❌ HIGH |
64
+ | security | `` db.query(`SELECT * WHERE id = ${req.params.id}`) `` — injection | ❌ CRITICAL |
65
+ | security | `SELECT password FROM users` returned to API without masking | ❌ HIGH |
66
+ | sql | `SELECT * FROM payments` when `payments` not in schema | HIGH |
67
+ | sql | `SELECT` query inside a `for` loop — N+1 pattern | ❌ HIGH |
68
+ | sql | `DELETE FROM sessions` with no `WHERE` clause | ❌ CRITICAL |
69
+ | sql | `SELECT * FROM users` with no pagination — unbounded result | ⚠️ MEDIUM |
70
+ | security | No `LIMIT` on a user-controlled query parameter | ⚠️ MEDIUM |
53
71
 
54
72
  ---
55
73
 
@@ -65,24 +83,50 @@ Without the schema, the reviewer flags all table/column references as `[VERIFY
65
83
  ━━━ Issues ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
66
84
 
67
85
  security-auditor:
68
- Critical — Line 6
86
+ CRITICAL — Line 6
69
87
  SQL injection: string interpolation in query
70
- Fix: Use $1 parameterized placeholder
88
+ Code: db.query(`SELECT * WHERE id = ${req.params.id}`)
89
+ Fix: db.query('SELECT * WHERE id = $1', [req.params.id])
71
90
 
72
91
  sql-reviewer:
73
- High — Line 19
74
- N+1 detected: SELECT inside for-loop
75
- Fix: Batch with WHERE id = ANY($1) or use JOIN
92
+ HIGH — Line 19
93
+ N+1 detected: SELECT inside for-loop (10 users = 10 queries)
94
+ Fix: Batch with WHERE id = ANY($1::uuid[]) or use a JOIN
76
95
 
77
- ━━━ Verdict: NEEDS FIXES ━━━━━━━━━━━━━━━━
96
+ ⚠️ MEDIUM Line 32
97
+ Unbounded result: SELECT * FROM audit_logs — no LIMIT
98
+ Fix: Add LIMIT + OFFSET or use cursor-based pagination
99
+
100
+ ━━━ Verdict: REJECTED — fix CRITICAL and HIGH before merging ━━━
78
101
  ```
79
102
 
80
103
  ---
81
104
 
105
+ ## Hallucination Guard
106
+
107
+ - `sql-reviewer` only references tables and columns **from the provided schema** — no invented schema
108
+ - ORM method names are verified against **the installed ORM version's documented API**
109
+ - Parameterized query fixes show the **exact parameterized form** for the target database driver
110
+ - N+1 fixes must show the **actual batched query**, not just say "use a JOIN"
111
+
112
+ ---
113
+
114
+ ## Cross-Workflow Navigation
115
+
116
+ | Finding type | Next step |
117
+ |---|---|
118
+ | SQL injection CRITICAL | Rotate credentials, then fix with `/generate` using parameterization |
119
+ | N+1 pattern in ORM | `/enhance` the repository method with proper eager loading |
120
+ | Schema references invalid columns | Fix schema first with `/migrate` |
121
+ | All approved | Human Gate to write to disk |
122
+
123
+ ---
124
+
82
125
  ## Usage
83
126
 
84
127
  ```
85
128
  /tribunal-database [paste query with schema]
86
129
  /tribunal-database src/repositories/userRepo.ts
87
130
  /tribunal-database [paste Prisma query]
131
+ /tribunal-database the payment queries in services/billing.ts
88
132
  ```
@@ -8,29 +8,50 @@ $ARGUMENTS
8
8
 
9
9
  ---
10
10
 
11
- Focused audit for React, Next.js, and frontend code. Four reviewers analyze it simultaneously for framework-specific issues that generic reviews miss.
11
+ Focused audit for React, Next.js, Vue, and frontend code. Four reviewers analyze it simultaneously for framework-specific issues that generic reviews miss.
12
+
13
+ ---
14
+
15
+ ## When to Use This vs Other Tribunals
16
+
17
+ | Code type | Right tribunal |
18
+ |---|---|
19
+ | React components, hooks, JSX | `/tribunal-frontend` ← you are here |
20
+ | API routes, auth, middleware | `/tribunal-backend` |
21
+ | SQL queries, ORM | `/tribunal-database` |
22
+ | React Native / mobile UI | `/tribunal-mobile` |
23
+ | Unknown domain or cross-domain | `/tribunal-full` |
12
24
 
13
25
  ---
14
26
 
15
27
  ## Active Reviewers
16
28
 
17
29
  ```
18
- logic-reviewer → Non-existent React APIs, impossible render conditions
19
- security-auditor → XSS via dangerouslySetInnerHTML, exposed tokens in state
20
- frontend-reviewer Hooks violations, missing dep arrays, direct state mutation
21
- type-safety-reviewer → Untyped props, any in hooks, unsafe DOM ref usage
30
+ logic-reviewer → Non-existent React APIs, impossible render conditions,
31
+ stale closure patterns, state set during unmounted component
32
+ security-auditor XSS via dangerouslySetInnerHTML, exposed tokens or secrets
33
+ in component state, unsanitized URL params
34
+ frontend-reviewer → Hooks violations (rules of hooks), missing dep arrays,
35
+ direct state mutation, infinite render loops
36
+ type-safety-reviewer → Untyped props, any in hooks, unsafe DOM ref usage,
37
+ missing generic type parameters
22
38
  ```
23
39
 
24
40
  ---
25
41
 
26
- ## What Gets Flagged
42
+ ## What Gets Flagged — Real Examples
27
43
 
28
- | Reviewer | Common Frontend Catches |
44
+ | Reviewer | Example Finding |
29
45
  |---|---|
30
46
  | logic | `useState.useAsync()` — not a real React API |
47
+ | logic | Setting state during render without a guard → infinite loop |
31
48
  | security | `dangerouslySetInnerHTML={{ __html: userInput }}` — XSS |
49
+ | security | `localStorage.setItem('token', jwt)` — accessible to XSS |
32
50
  | frontend | `useEffect(() => {...}, [])` with a prop used inside — stale closure |
51
+ | frontend | `setCount(count + 1)` inside a stale closure — use functional updater |
52
+ | frontend | Hook called inside a conditional `if (loggedIn) { useData() }` |
33
53
  | type-safety | `function Card(props: any)` — no defined prop interface |
54
+ | type-safety | `ref.current.focus()` without null check |
34
55
 
35
56
  ---
36
57
 
@@ -47,23 +68,48 @@ type-safety-reviewer → Untyped props, any in hooks, unsafe DOM ref usage
47
68
  ━━━ Issues ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
48
69
 
49
70
  frontend-reviewer:
50
- High — Line 18
51
- Missing dep: userId used in useEffect but not in dep array
52
- Fix: }, [userId])
71
+ HIGH — Line 18
72
+ Missing dep: userId used inside useEffect but not in dep array
73
+ Code: useEffect(() => fetchUser(userId), [])
74
+ Fix: useEffect(() => fetchUser(userId), [userId])
75
+
76
+ ❌ HIGH — Line 34
77
+ Hook called conditionally: if (isAuth) { useDashboardData() }
78
+ Fix: Move hook to top level, use enabled flag inside hook
53
79
 
54
80
  type-safety-reviewer:
55
- ⚠️ Medium — Line 3
81
+ ⚠️ MEDIUM — Line 3
56
82
  props: any — define a typed interface for this component
83
+ Fix: interface CardProps { title: string; content: React.ReactNode }
57
84
 
58
- ━━━ Verdict: NEEDS FIXES ━━━━━━━━━━━━━━━━
85
+ ━━━ Verdict: REJECTED fix before merging ━━━━━━
59
86
  ```
60
87
 
61
88
  ---
62
89
 
90
+ ## Hallucination Guard
91
+
92
+ - Only real React/Vue/Next.js APIs are accepted — invented hooks get REJECTED
93
+ - Hook violation findings cite the **specific hooks rule being broken**
94
+ - XSS findings include the **specific input path** that creates the injection
95
+
96
+ ---
97
+
98
+ ## Cross-Workflow Navigation
99
+
100
+ | Finding type | Next step |
101
+ |---|---|
102
+ | XSS finding | Contact security team + `/audit` for project-wide XSS scan |
103
+ | Hooks violations everywhere | `/refactor` to extract to properly structured custom hooks |
104
+ | All approved | Human Gate to write code to disk |
105
+
106
+ ---
107
+
63
108
  ## Usage
64
109
 
65
110
  ```
66
111
  /tribunal-frontend [paste component code]
67
112
  /tribunal-frontend [paste custom hook]
68
113
  /tribunal-frontend src/components/UserCard.tsx
114
+ /tribunal-frontend the usePagination hook
69
115
  ```
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Run ALL 8 Tribunal reviewer agents simultaneously. Maximum hallucination coverage. Use before merging any AI-generated code.
2
+ description: Run ALL 11 Tribunal reviewer agents simultaneously. Maximum hallucination coverage. Use before merging any AI-generated code.
3
3
  ---
4
4
 
5
5
  # /tribunal-full — Full Panel Review
@@ -8,9 +8,21 @@ $ARGUMENTS
8
8
 
9
9
  ---
10
10
 
11
- Paste code. All 8 reviewers analyze it simultaneously. Maximum coverage, no domain gaps.
11
+ Paste code. All 11 reviewers analyze it simultaneously. Maximum coverage, no domain gaps.
12
12
 
13
- Use this before merging any AI-generated code, or when you're not sure which domain a piece of code sits in.
13
+ Use this **before merging any AI-generated code**, or when you're not sure which domain a piece of code sits in.
14
+
15
+ ---
16
+
17
+ ## When to Use /tribunal-full vs Targeted Tribunals
18
+
19
+ | Use `/tribunal-full` when... | Use a targeted tribunal when... |
20
+ |---|---|
21
+ | Not sure which domain applies | You know it's backend-only → `/tribunal-backend` |
22
+ | Cross-domain code (API + DB + UI) | Pure frontend → `/tribunal-frontend` |
23
+ | AI-generated code, pre-merge | Pure database queries → `/tribunal-database` |
24
+ | Security-critical code path | Mobile-specific → `/tribunal-mobile` |
25
+ | "Final check" before shipping | Performance concern only → `/tribunal-performance` |
14
26
 
15
27
  ---
16
28
 
@@ -25,9 +37,25 @@ sql-reviewer → Injection via interpolation, N+1, invented schema
25
37
  frontend-reviewer → Hooks violations, missing dep arrays, state mutation
26
38
  performance-reviewer → O(n²), blocking I/O, memory allocation anti-patterns
27
39
  test-coverage-reviewer → Tautology tests, no-assertion specs, over-mocking
40
+ mobile-reviewer → Touch targets, safe areas, keyboard avoidance, image memory
41
+ ai-code-reviewer → Hallucinated model names, fake params, prompt injection, rate limits
42
+ accessibility-reviewer → WCAG violations, missing ARIA, contrast, keyboard navigation
28
43
  ```
29
44
 
30
- All 8 run in parallel. You wait for all verdicts before seeing the result.
45
+ All 11 run in parallel. You wait for all verdicts before seeing the result.
46
+
47
+ ---
48
+
49
+ ## Severity Levels
50
+
51
+ | Symbol | Severity | Meaning |
52
+ |---|---|---|
53
+ | `❌ CRITICAL` | Blocking | Must be fixed before code reaches the codebase |
54
+ | `❌ HIGH` | Blocking | Likely to cause bugs or security issues in production |
55
+ | `⚠️ MEDIUM` | Non-blocking | Should be addressed; review before approving |
56
+ | `💬 LOW` | Advisory | Consider fixing; does not block merge |
57
+
58
+ **Policy:** Any `CRITICAL` or `HIGH` finding means the verdict is `REJECTED`. Code must be revised.
31
59
 
32
60
  ---
33
61
 
@@ -44,34 +72,65 @@ All 8 run in parallel. You wait for all verdicts before seeing the result.
44
72
  frontend-reviewer: ✅ APPROVED
45
73
  performance-reviewer: ✅ APPROVED
46
74
  test-coverage-reviewer: ❌ REJECTED
75
+ mobile-reviewer: ✅ APPROVED (N/A — no mobile code)
76
+ ai-code-reviewer: ✅ APPROVED (N/A — no LLM calls)
77
+ accessibility-reviewer: ✅ APPROVED
47
78
 
48
79
  ━━━ Issues ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
49
80
 
50
81
  security-auditor:
51
- Critical — Line 12
82
+ CRITICAL — Line 12
52
83
  SQL injection: db.query(`WHERE id = ${id}`)
53
84
  Fix: db.query('WHERE id = $1', [id])
54
85
 
55
86
  test-coverage-reviewer:
56
- High — Line 45-60
57
- Tautology test: expect(fn(x)).toBe(fn(x)) — always passes
87
+ HIGH — Line 45-60
88
+ Tautology test: expect(fn(x)).toBe(fn(x)) — always passes regardless of fn's behavior
58
89
 
59
90
  type-safety-reviewer:
60
- ⚠️ Medium — Line 7
61
- Implicit any in parameter: function (data) — add explicit type
91
+ ⚠️ MEDIUM — Line 7
92
+ Implicit any in parameter: function (data) — add explicit type annotation
62
93
 
63
94
  ━━━ Verdict ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
64
95
 
65
- 2 REJECTED. Fix all issues before this code reaches your codebase.
96
+ 2 REJECTED. Fix all CRITICAL and HIGH issues before this code reaches your codebase.
66
97
  1 WARNING — review before approving.
98
+ 8 APPROVED.
67
99
  ```
68
100
 
69
101
  ---
70
102
 
71
- ## When to Use This
103
+ ## Retry Protocol
104
+
105
+ If code is rejected:
106
+
107
+ ```
108
+ Attempt 1 → Fix issues from verdicts and resubmit
109
+ Attempt 2 → Stricter constraints + specific reviewer feedback
110
+ Attempt 3 → Maximum constraints + full context dump
111
+ Attempt 4 → HALT. Escalate to human with full failure history.
112
+ ```
113
+
114
+ Hard limit: **3 revisions**. After 3 rejections, the agent stops and reports.
115
+
116
+ ---
117
+
118
+ ## Cross-Workflow Navigation
119
+
120
+ | After seeing findings... | Go to |
121
+ |---|---|
122
+ | Security findings need a targeted scan | `/audit` for full project-wide security sweep |
123
+ | Performance issues found | `/tribunal-performance` for deeper profiling |
124
+ | SQL injection pattern found | Check with `/tribunal-database` across all queries |
125
+ | Stale or phantom deps found | `/audit` → dependency scan |
126
+
127
+ ---
128
+
129
+ ## Usage
72
130
 
73
131
  ```
74
132
  /tribunal-full [paste any code]
75
133
  /tribunal-full before merging
76
134
  /tribunal-full when you're unsure which domain applies
135
+ /tribunal-full the entire auth service
77
136
  ```