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 adds to or improves existing code without breaking what already works. Enhancement is not greenfield — the existing system shapes what can be done and how.
11
+ This command adds to or improves existing code **without breaking what already works**. Enhancement is not greenfield — the existing system shapes what can be done and how.
12
+
13
+ ---
14
+
15
+ ## When to Use /enhance vs Other Commands
16
+
17
+ | Use `/enhance` when... | Use something else when... |
18
+ |---|---|
19
+ | Adding to working, existing code | Building from scratch → `/create` |
20
+ | Extending a function or module | Restructuring without new behavior → `/refactor` |
21
+ | Adding a new endpoint to an existing API | Fixing a broken behavior → `/debug` |
22
+ | Upgrading a component's capabilities | Auditing for problems → `/review` |
12
23
 
13
24
  ---
14
25
 
@@ -17,7 +28,7 @@ This command adds to or improves existing code without breaking what already wor
17
28
  > Never modify code you haven't read.
18
29
  > Never modify a function without checking what calls it.
19
30
 
20
- The first step of every enhancement is a reading pass — not a writing pass.
31
+ The first step of every enhancement is a **reading pass** — not a writing pass.
21
32
 
22
33
  ---
23
34
 
@@ -25,67 +36,73 @@ The first step of every enhancement is a reading pass — not a writing pass.
25
36
 
26
37
  ### Step 1 — Map the Impact Zone
27
38
 
39
+ Before touching any file, produce this map:
40
+
28
41
  ```
29
- Files to change: [list]
30
- Functions affected: [list]
42
+ Files to change: [list — explicit, not "etc."]
43
+ Functions affected: [list — every function being modified]
31
44
  Callers of those: [list — these must remain unbroken]
32
- Tests currently covering them: [list]
45
+ Tests covering them: [list — these must pass after the change]
46
+ Exported symbols: [list — any public API that must stay compatible]
33
47
  ```
34
48
 
35
- This map must exist before any file is opened for editing.
49
+ > ⚠️ If the impact zone spans more than 10 files, pause and confirm scope with the user before proceeding.
36
50
 
37
51
  ### Step 2 — Define What Changes vs What Stays
38
52
 
39
53
  ```
40
54
  Adding: [new capability being added]
41
- Modifying: [existing behavior being changed]
42
- Preserving: [things that must not change]
55
+ Modifying: [existing behavior being changed — explain why]
56
+ Preserving: [things that must not change — API contracts, test expectations, response formats]
43
57
  ```
44
58
 
45
- Any change to a public interface (function signature, API response shape, exported type) triggers an update of all callers.
59
+ Any change to a **public interface** (function signature, API response shape, exported type) triggers an update of **all callers** — not just the changed file.
46
60
 
47
61
  ### Step 3 — Implement Through Tribunal Gate
48
62
 
49
- | Enhancement Type | Gate |
63
+ | Enhancement Type | Tribunal Gate |
50
64
  |---|---|
51
- | Backend logic | `/tribunal-backend` |
52
- | Frontend/UI | `/tribunal-frontend` |
53
- | DB queries | `/tribunal-database` |
54
- | Cross-domain | `/tribunal-full` |
65
+ | Backend logic / API change | `/tribunal-backend` |
66
+ | Frontend / UI component | `/tribunal-frontend` |
67
+ | DB queries or schema | `/tribunal-database` |
68
+ | Cross-domain change | `/tribunal-full` |
69
+ | Mobile UI component | `/tribunal-mobile` |
70
+ | Performance-critical path | `/tribunal-performance` |
55
71
 
56
- The code goes through Tribunal before being shown.
72
+ The code goes through Tribunal **before** being shown to the user.
57
73
 
58
74
  ### Step 4 — Regression Safety Check
59
75
 
60
76
  ```
61
- Existing tests: still pass (none were broken)
62
- New tests added: covering new behavior
63
- Callers updated: if any interface changed
77
+ Existing tests: still pass (none were broken by the change)
78
+ New tests added: covering the new behavior
79
+ Callers updated: if any interface changed, all callers are updated together
80
+ □ TypeScript / lint: check passes after the enhancement
64
81
  ```
65
82
 
66
- All three must be true before the enhancement is considered complete.
83
+ All four must be true before the enhancement is considered complete.
67
84
 
68
85
  ---
69
86
 
70
87
  ## Response Template
71
88
 
72
89
  ```
73
- Enhancement: [What was added/changed]
90
+ Enhancement: [What was added or changed, in one sentence]
74
91
 
75
92
  Impact Zone:
76
- Changed: [files]
77
- Callers updated: [files, or "none — interface preserved"]
93
+ Changed: [files modified]
94
+ Callers updated: [files updated, or "none — interface preserved"]
78
95
 
79
96
  Tribunal result:
80
97
  [reviewer]: [APPROVED | REJECTED — reason]
81
98
 
82
99
  Regression risk:
83
- 🟢 Low — new path only, no existing path changed
84
- 🟡 Medium — shared code modified, callers reviewed
85
- 🔴 High — interface changed, all callers updated
100
+ 🟢 Low — new path only, no existing path changed
101
+ 🟡 Medium — shared code modified, callers reviewed and updated
102
+ 🔴 High — interface changed, all callers updated and verified
86
103
 
87
104
  Changes:
88
- [diff]
105
+ [diff or before/after]
89
106
  ```
90
107
 
91
108
  ---
@@ -94,7 +111,20 @@ Changes:
94
111
 
95
112
  - **Read existing code before describing it** — never assume what a function does from its name
96
113
  - **Preserved interfaces must stay identical** — adding a required parameter breaks every caller silently
97
- - **Unknown patterns get `// VERIFY`** — never guess at a codebase convention
114
+ - **Unknown patterns get `// VERIFY`** — never guess at a codebase convention or framework behavior
115
+ - **Never delete or rename an export** without verifying all import sites are updated
116
+ - **`// VERIFY: check method exists`** on any method call not seen in existing code or official docs
117
+
118
+ ---
119
+
120
+ ## Cross-Workflow Navigation
121
+
122
+ | If during /enhance you encounter... | Go to |
123
+ |---|---|
124
+ | Unexpected behavior in existing code | `/debug` to root-cause before changing anything |
125
+ | Code quality so poor it needs restructuring | `/refactor` first, then come back to `/enhance` |
126
+ | Security vulnerability in the code you're reading | `/audit` to determine blast radius |
127
+ | Tests don't exist for the area being changed | `/test` first to establish a baseline |
98
128
 
99
129
  ---
100
130
 
@@ -104,4 +134,6 @@ Changes:
104
134
  /enhance add pagination to the users list API endpoint
105
135
  /enhance add rate limiting to all authentication routes
106
136
  /enhance upgrade the search component to support filters
137
+ /enhance add retry logic to the payment service's HTTP client
138
+ /enhance extend the user model to support multiple email addresses
107
139
  ```
@@ -0,0 +1,143 @@
1
+ ---
2
+ description: Auto-fix known issues with lint, formatting, imports, and TypeScript errors. Human approval required before applying.
3
+ ---
4
+
5
+ # /fix — Automated Issue Resolution
6
+
7
+ $ARGUMENTS
8
+
9
+ ---
10
+
11
+ This command runs auto-fixable checks and applies corrections. **Every fix requires human approval** — nothing is written to disk without explicit confirmation.
12
+
13
+ ---
14
+
15
+ ## When to Use /fix vs Other Commands
16
+
17
+ | Use `/fix` when... | Use something else when... |
18
+ |---|---|
19
+ | Lint reports many auto-fixable issues | Logic bugs → `/debug` |
20
+ | Formatting is inconsistent after a merge | Security vulnerabilities → `/audit` |
21
+ | Dependency upgrade changed import paths | TypeScript type errors → `/generate` or manual fix |
22
+ | Quick cleanup before a PR | Full project health check → `/audit` |
23
+
24
+ ---
25
+
26
+ ## What Happens
27
+
28
+ ### Stage 1 — Dry Run (Always First)
29
+
30
+ Before fixing anything, show what would change:
31
+
32
+ ```bash
33
+ # Lint auto-fix dry run (show issues without applying)
34
+ // turbo
35
+ python .agent/scripts/lint_runner.py . --fix
36
+
37
+ # Prettier check (show files that would be reformatted)
38
+ // turbo
39
+ npx prettier --check .
40
+
41
+ # TypeScript errors (does not auto-fix — reports only)
42
+ // turbo
43
+ npx tsc --noEmit
44
+ ```
45
+
46
+ Present the dry run results to the user before touching anything:
47
+
48
+ ```
49
+ 📋 Auto-fixable issues found:
50
+ - ESLint: 12 fixable issues across 5 files
51
+ - Prettier: 8 files would be reformatted
52
+ - TypeScript: 3 unused imports (auto-fixable)
53
+ - TypeScript: 2 type errors (require manual fix — see below)
54
+
55
+ ⚠️ Manual fixes required (not auto-fixable):
56
+ - src/auth/jwt.ts line 34: Type 'string | undefined' is not assignable to 'string'
57
+ - src/db/queries.ts line 12: Property 'userId' does not exist
58
+
59
+ ⏸️ Proceed with auto-fix? [Y = apply | N = cancel]
60
+ ```
61
+
62
+ > ⏸️ **Human Gate** — never apply fixes without explicit user approval.
63
+
64
+ ---
65
+
66
+ ### Stage 2 — Apply Fixes (After Approval)
67
+
68
+ Run fixers in this order (order matters — ESLint first prevents Prettier from undoing logic changes):
69
+
70
+ ```bash
71
+ # Step 1: ESLint logic fixes
72
+ npx eslint . --fix
73
+
74
+ # Step 2: Prettier formatting
75
+ npx prettier --write .
76
+
77
+ # Step 3: Import sorting (if configured)
78
+ npx organize-imports-cli tsconfig.json
79
+ ```
80
+
81
+ ---
82
+
83
+ ### Stage 3 — Verify After Fix
84
+
85
+ ```bash
86
+ # Full lint must be clean after auto-fix
87
+ // turbo
88
+ python .agent/scripts/lint_runner.py .
89
+
90
+ # Tests must still pass (fixes should not change behavior)
91
+ // turbo
92
+ python .agent/scripts/test_runner.py .
93
+
94
+ # Show git diff of all applied changes
95
+ git diff --stat
96
+ ```
97
+
98
+ If tests fail after auto-fix → **revert immediately** and report which fix caused the failure.
99
+
100
+ ---
101
+
102
+ ## What This Does NOT Fix
103
+
104
+ | Issue type | Handled by |
105
+ |---|---|
106
+ | TypeScript type errors requiring logic changes | Manual fix or `/generate` |
107
+ | Logic bugs | `/debug` |
108
+ | Security vulnerabilities | `/audit` then `/generate` |
109
+ | Test failures | `/debug` then `/test` |
110
+ | Architecture issues | `/refactor` |
111
+
112
+ These are reported but left for human resolution. Auto-fix never attempts these.
113
+
114
+ ---
115
+
116
+ ## Safety Rules
117
+
118
+ 1. **Never auto-fix without showing the diff first**
119
+ 2. **Never fix and commit in one step** — user reviews the diff before any commit
120
+ 3. **If a fix changes behavior** (not just formatting): flag it as `⚠️ This fix may change runtime behavior — review manually`
121
+ 4. **Revert on test failure** — if tests fail after fixing, undo the fix and report which change caused it
122
+ 5. **Never modify files in `node_modules` or generated output directories**
123
+
124
+ ---
125
+
126
+ ## Cross-Workflow Navigation
127
+
128
+ | After /fix... | Go to |
129
+ |---|---|
130
+ | Lint is clean, ready for review | `/review [file]` for logic audit |
131
+ | TypeScript errors remain after lint fix | Address manually or use `/generate` for targeted rewrite |
132
+ | Pre-deploy cleanup complete | `/audit` for full project health check |
133
+
134
+ ---
135
+
136
+ ## Usage
137
+
138
+ ```
139
+ /fix lint errors in this project
140
+ /fix formatting across all files
141
+ /fix unused imports and variables
142
+ /fix all ESLint and Prettier issues before the PR
143
+ ```
@@ -8,7 +8,18 @@ $ARGUMENTS
8
8
 
9
9
  ---
10
10
 
11
- This command runs code generation through the full Tribunal pipeline. Code reaches you only after being reviewed. Nothing is written to disk without your explicit approval.
11
+ This command runs code generation through the full Tribunal pipeline. Code reaches you only after being reviewed by the appropriate specialist reviewers. **Nothing is written to disk without your explicit approval.**
12
+
13
+ ---
14
+
15
+ ## When to Use /generate vs Other Commands
16
+
17
+ | Use `/generate` when... | Use something else when... |
18
+ |---|---|
19
+ | You need new code written | Existing code needs to change → `/enhance` |
20
+ | A single focused piece of code is needed | Multi-domain build → `/swarm` or `/create` |
21
+ | You want a safety-audited code snippet | You need a full project structure → `/create` |
22
+ | You need a quick but safe implementation | You want to understand options first → `/plan` |
12
23
 
13
24
  ---
14
25
 
@@ -18,14 +29,14 @@ This command runs code generation through the full Tribunal pipeline. Code reach
18
29
  Your request
19
30
 
20
31
 
21
- Context read — existing files, schema, package.json scanned
32
+ Context scan — existing files, schema, package.json read first
22
33
 
23
34
 
24
35
  Maker generates at temperature 0.1
25
- (grounded in context, never inventing)
36
+ (grounded in real context never inventing)
26
37
 
27
38
 
28
- Selected reviewers run in parallel
39
+ Auto-selected reviewers run in parallel
29
40
 
30
41
 
31
42
  Human Gate — you see all verdicts and the diff
@@ -36,36 +47,56 @@ Only then: write to disk (Y) or discard (N) or revise (R)
36
47
 
37
48
  ## Who Reviews It
38
49
 
39
- Default (always active):
50
+ **Default (always active):**
40
51
 
41
52
  ```
42
53
  logic-reviewer → Hallucinated methods, impossible logic, undefined refs
43
54
  security-auditor → OWASP vulnerabilities, SQL injection, hardcoded secrets
44
55
  ```
45
56
 
46
- Auto-activated by keywords in your request:
57
+ **Auto-activated by keywords in your request:**
47
58
 
48
- | Keyword | Additional Reviewer |
59
+ | Keyword in request | Additional Reviewers Activated |
49
60
  |---|---|
50
- | api, route, endpoint | `dependency-reviewer` + `type-safety-reviewer` |
51
- | sql, query, database | `sql-reviewer` |
52
- | component, hook, react | `frontend-reviewer` + `type-safety-reviewer` |
53
- | test, spec, coverage | `test-coverage-reviewer` |
54
- | slow, memory, optimize | `performance-reviewer` |
61
+ | `api`, `route`, `endpoint` | `dependency-reviewer` + `type-safety-reviewer` |
62
+ | `sql`, `query`, `database`, `orm` | `sql-reviewer` |
63
+ | `component`, `hook`, `react`, `vue` | `frontend-reviewer` + `type-safety-reviewer` |
64
+ | `test`, `spec`, `coverage`, `jest`, `vitest` | `test-coverage-reviewer` |
65
+ | `slow`, `memory`, `optimize`, `cache` | `performance-reviewer` |
66
+ | `mobile`, `react native`, `flutter` | `mobile-reviewer` |
67
+ | `llm`, `openai`, `anthropic`, `gemini`, `ai`, `embedding` | `ai-code-reviewer` |
68
+ | `a11y`, `wcag`, `aria`, `accessibility` | `accessibility-reviewer` |
69
+ | `import`, `require`, `package` | `dependency-reviewer` |
70
+
71
+ > If unsure which reviewers to activate, use `/tribunal-full` for maximum coverage.
55
72
 
56
73
  ---
57
74
 
58
75
  ## What the Maker Is Not Allowed to Do
59
76
 
60
77
  ```
61
- ❌ Import a package not in the project's package.json
62
- ❌ Call a method it hasn't seen documented
78
+ ❌ Import a package not verified in the project's package.json
79
+ ❌ Call a method it hasn't seen in official documentation
63
80
  ❌ Use `any` in TypeScript without a comment explaining why
64
81
  ❌ Generate an entire application in one shot
65
- ❌ Guess at a database column name
82
+ ❌ Guess at a database column or table name
83
+ ❌ Fabricate API response shapes — read existing types first
84
+ ❌ Assume environment variables exist — reference .env.example or documented config
66
85
  ```
67
86
 
68
- When unsure about any call: it writes `// VERIFY: [reason]` instead of hallucinating.
87
+ When unsure about any call: the Maker writes `// VERIFY: [reason]` instead of hallucinating.
88
+
89
+ ---
90
+
91
+ ## Reviewer Verdict Meanings
92
+
93
+ | Verdict | Meaning | What Happens |
94
+ |---|---|---|
95
+ | `✅ APPROVED` | No issues found | Code proceeds to Human Gate |
96
+ | `⚠️ WARNING` | Non-blocking issue | Human Gate shown with warning highlighted |
97
+ | `❌ REJECTED` | Blocking issue found | Code is revised, not shown to human |
98
+
99
+ **Retry limit:** Maker is revised up to **3 times** per rejection. After 3 failed attempts, the session halts and reports to the user with the full failure history.
69
100
 
70
101
  ---
71
102
 
@@ -76,12 +107,20 @@ When unsure about any call: it writes `// VERIFY: [reason]` instead of hallucina
76
107
 
77
108
  Active reviewers: logic · security · [others]
78
109
 
79
- [Generated code]
110
+ [Generated code with // VERIFY: tags where applicable]
80
111
 
81
112
  ━━━ Verdicts ━━━━━━━━━━━━━━━━━━━━━━━━━━━
82
113
 
83
- logic-reviewer: ✅ APPROVED
84
- security-auditor: ✅ APPROVED
114
+ logic-reviewer: ✅ APPROVED
115
+ security-auditor: ✅ APPROVED
116
+ dependency-reviewer: ⚠️ WARNING — lodash not in package.json
117
+
118
+ ━━━ Warnings ━━━━━━━━━━━━━━━━━━━━━━━━━━
119
+
120
+ dependency-reviewer:
121
+ ⚠️ Medium — Line 3
122
+ lodash is imported but not listed in package.json
123
+ Fix: Run `npm install lodash` or use a built-in alternative
85
124
 
86
125
  ━━━ Human Gate ━━━━━━━━━━━━━━━━━━━━━━━━
87
126
 
@@ -90,11 +129,36 @@ Write to disk? Y = approve | N = discard | R = revise with feedback
90
129
 
91
130
  ---
92
131
 
132
+ ## Hallucination Guard (Expanded)
133
+
134
+ - **Context-first**: Maker reads `package.json`, `tsconfig.json`, and any referenced files before writing a single line
135
+ - **No phantom imports**: Every import is verified against the project's dependencies
136
+ - **No invented methods**: Only methods documented in the official library docs are used
137
+ - **`// VERIFY:` on all uncertainty**: Any call that cannot be verified from existing code or official docs gets a `// VERIFY:` comment
138
+ - **No complete app generation**: Large features are broken into reviewable modules, not dumped as a monolith
139
+ - **Secrets stay in env**: No hardcoded credentials, keys, or tokens — ever
140
+
141
+ ---
142
+
143
+ ## Cross-Workflow Navigation
144
+
145
+ | If the result of /generate shows... | Go to |
146
+ |---|---|
147
+ | Multiple files need changing | `/enhance` for impact-zone analysis |
148
+ | Security-critical code was touched | `/tribunal-full` for maximum coverage |
149
+ | New DB queries are generated | `/tribunal-database` |
150
+ | New API routes are generated | `/tribunal-backend` |
151
+ | Tests need to be written next | `/test` |
152
+
153
+ ---
154
+
93
155
  ## Usage
94
156
 
95
157
  ```
96
158
  /generate a JWT middleware for Express with algorithm enforcement
97
159
  /generate a Prisma query for users with their posts included
98
160
  /generate a debounced search hook in React
99
- /generate a function to validate and normalize email addresses
161
+ /generate a parameterized SQL query for fetching paginated orders
162
+ /generate a rate-limited fetch wrapper using p-limit
163
+ /generate a zod schema for email + password login input
100
164
  ```
@@ -0,0 +1,163 @@
1
+ ---
2
+ description: Migration workflow for framework upgrades, dependency bumps, and database migrations.
3
+ ---
4
+
5
+ # /migrate — Version & Schema Migration
6
+
7
+ $ARGUMENTS
8
+
9
+ ---
10
+
11
+ This command structures any migration operation — upgrading framework versions, bumping major dependencies, or running database migrations — to minimize breakage and ensure a clear rollback path.
12
+
13
+ ---
14
+
15
+ ## When to Use /migrate vs Other Commands
16
+
17
+ | Use `/migrate` when... | Use something else when... |
18
+ |---|---|
19
+ | Upgrading a framework (Next.js 14 → 15) | Minor patch bumps → update `package.json` directly |
20
+ | Bumping dependencies with breaking changes | Bug from a recent upgrade → `/debug` |
21
+ | Creating or running database migrations | Adding a feature to existing schema → `/enhance` |
22
+ | Switching tools entirely (Jest → Vitest) | Code restructuring only → `/refactor` |
23
+
24
+ ---
25
+
26
+ ## Migration Types
27
+
28
+ | Type | Examples | Key Risk |
29
+ |---|---|---|
30
+ | Framework major version | Next.js 14→15, React 18→19 | Removed APIs, new routing conventions |
31
+ | Dependency breaking change | Lodash 4→5, Axios 1→2 | Changed method signatures |
32
+ | Tool migration | Jest → Vitest, CRA → Vite | Config format, different globals |
33
+ | Database migration | Prisma schema change, SQL column add | Data loss, downtime |
34
+ | Language version | Python 3.10 → 3.12, Node 18 → 22 | Behavior changes, removed builtins |
35
+
36
+ ---
37
+
38
+ ## What Happens
39
+
40
+ ### Stage 1 — Inventory Breaking Changes
41
+
42
+ Before touching any code:
43
+
44
+ ```
45
+ □ What is the migration? (from X to Y)
46
+ □ Is there an official migration guide? (read it before proceeding)
47
+ □ What are the documented breaking changes? (read the changelog)
48
+ □ Which files in the codebase are affected? (grep for imports, config references)
49
+ □ Is there a rollback path? (git branch, database backup, rollback command)
50
+ □ Is the migration reversible? (some DB migrations are one-way)
51
+ ```
52
+
53
+ > ⚠️ **Never start a migration without reading the official migration guide first.** If none exists, read the changelog and all GitHub "breaking change" issues.
54
+
55
+ ---
56
+
57
+ ### Stage 2 — Plan the Migration Path
58
+
59
+ Create a sequential checklist ordered by dependency:
60
+
61
+ ```
62
+ 1. Update configuration files (package.json, tsconfig, build config)
63
+ 2. Update runtime code (imports, renamed APIs, new patterns)
64
+ 3. Handle deprecated features (replace deprecated APIs with new equivalents)
65
+ 4. Update tests for new behavior (new patterns, changed mocks)
66
+ 5. Run full test suite (must pass before declaring done)
67
+ 6. Update documentation (README, CHANGELOG)
68
+ ```
69
+
70
+ Each step is a **checkpoint**. If a step fails, stop and resolve before continuing.
71
+
72
+ ### Stage 3 — Execute Incrementally
73
+
74
+ ```
75
+ For each step in the migration plan:
76
+ 1. Make the change
77
+ 2. Run affected tests immediately
78
+ 3. Verify no regressions
79
+ 4. Commit the step (isolated commit)
80
+ 5. Move to next step
81
+ ```
82
+
83
+ **Rules:**
84
+ - **One breaking change at a time** — never batch multiple incompatible changes
85
+ - If a step requires more than **5 file changes**, break it into sub-steps
86
+ - Tests run **after every step**, not just at the end
87
+ - If a step breaks more than 5 tests, stop and reassess scope
88
+
89
+ ### Stage 4 — Verify Complete Migration
90
+
91
+ ```
92
+ □ All tests pass
93
+ □ Build completes without errors
94
+ □ No remaining deprecation warnings
95
+ □ Version updated in package.json
96
+ □ Rollback path documented
97
+ □ Staging environment tested (if applicable)
98
+ ```
99
+
100
+ ---
101
+
102
+ ## Database Migration Specific
103
+
104
+ When running database migrations:
105
+
106
+ ```bash
107
+ # 1. Backup the database FIRST (even in dev)
108
+ pg_dump mydb > backup_before_migration.sql
109
+
110
+ # 2. Run Prisma schema validation
111
+ // turbo
112
+ python .agent/scripts/schema_validator.py .
113
+
114
+ # 3. Test migration on shadow/test database first
115
+ npx prisma migrate dev --name [migration-name]
116
+
117
+ # 4. Verify data integrity after migration
118
+ # Run custom verification queries or check row counts
119
+
120
+ # 5. Document rollback SQL
121
+ # What command reverses this migration?
122
+ ```
123
+
124
+ **One-way migrations:** If a migration drops data or columns, it may be irreversible. Document this explicitly:
125
+
126
+ ```
127
+ ⚠️ IRREVERSIBLE: This migration drops column `users.legacy_auth_token`.
128
+ Rollback: Requires restoring from backup — not possible via migrate down.
129
+ ```
130
+
131
+ ---
132
+
133
+ ## Hallucination Guard
134
+
135
+ - **Never invent migration steps** — only use documented migration guides and official changelogs
136
+ - **Never assume backward compatibility** — verify each changed API against official docs
137
+ - Flag undocumented behavior changes: `// VERIFY: migration guide does not mention this change`
138
+ - **Do not remove deprecated code** until the replacement is verified working
139
+ - **No version guessing** — specify exact versions, not ranges, unless the migration guide specifies
140
+
141
+ ---
142
+
143
+ ## Cross-Workflow Navigation
144
+
145
+ | After /migrate results show... | Go to |
146
+ |---|---|
147
+ | Tests broke after migration | `/debug` to find root cause |
148
+ | Security issues in a new version's patterns | `/audit` for security-focused review |
149
+ | New version uses different patterns everywhere | `/refactor` to bring code in line |
150
+ | All tests pass, ready for deploy | `/deploy` following pre-flight checklist |
151
+
152
+ ---
153
+
154
+ ## Usage
155
+
156
+ ```
157
+ /migrate Next.js 14 to 15
158
+ /migrate from Jest to Vitest
159
+ /migrate add a new database column with Prisma
160
+ /migrate upgrade React Router from v5 to v6
161
+ /migrate Python 3.10 to 3.12
162
+ /migrate from REST to tRPC
163
+ ```