tribunal-kit 4.4.2 → 4.4.4

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 (108) hide show
  1. package/.agent/scripts/marathon_harness.js +896 -0
  2. package/.agent/scripts/prompt_compiler.js +87 -0
  3. package/.agent/skills/agent-organizer/SKILL.md +42 -0
  4. package/.agent/skills/agentic-patterns/SKILL.md +42 -0
  5. package/.agent/skills/ai-prompt-injection-defense/SKILL.md +42 -0
  6. package/.agent/skills/api-patterns/SKILL.md +42 -0
  7. package/.agent/skills/api-security-auditor/SKILL.md +42 -0
  8. package/.agent/skills/app-builder/SKILL.md +42 -0
  9. package/.agent/skills/appflow-wireframe/SKILL.md +42 -0
  10. package/.agent/skills/architecture/SKILL.md +42 -0
  11. package/.agent/skills/authentication-best-practices/SKILL.md +42 -0
  12. package/.agent/skills/backend-security-expert/SKILL.md +122 -0
  13. package/.agent/skills/bash-linux/SKILL.md +42 -0
  14. package/.agent/skills/behavioral-modes/SKILL.md +42 -0
  15. package/.agent/skills/brainstorming/SKILL.md +42 -0
  16. package/.agent/skills/building-native-ui/SKILL.md +42 -0
  17. package/.agent/skills/clean-code/SKILL.md +42 -0
  18. package/.agent/skills/code-review-checklist/SKILL.md +42 -0
  19. package/.agent/skills/config-validator/SKILL.md +42 -0
  20. package/.agent/skills/csharp-developer/SKILL.md +42 -0
  21. package/.agent/skills/data-validation-schemas/SKILL.md +42 -0
  22. package/.agent/skills/database-design/SKILL.md +42 -0
  23. package/.agent/skills/deployment-procedures/SKILL.md +42 -0
  24. package/.agent/skills/devops-engineer/SKILL.md +42 -0
  25. package/.agent/skills/devops-incident-responder/SKILL.md +42 -0
  26. package/.agent/skills/documentation-templates/SKILL.md +42 -0
  27. package/.agent/skills/edge-computing/SKILL.md +42 -0
  28. package/.agent/skills/error-resilience/SKILL.md +42 -0
  29. package/.agent/skills/extract-design-system/SKILL.md +42 -0
  30. package/.agent/skills/framer-motion-expert/SKILL.md +42 -0
  31. package/.agent/skills/frontend-design/SKILL.md +42 -0
  32. package/.agent/skills/frontend-security-expert/SKILL.md +123 -0
  33. package/.agent/skills/game-design-expert/SKILL.md +42 -0
  34. package/.agent/skills/game-engineering-expert/SKILL.md +42 -0
  35. package/.agent/skills/geo-fundamentals/SKILL.md +42 -0
  36. package/.agent/skills/github-operations/SKILL.md +42 -0
  37. package/.agent/skills/gsap-core/SKILL.md +42 -0
  38. package/.agent/skills/gsap-frameworks/SKILL.md +42 -0
  39. package/.agent/skills/gsap-performance/SKILL.md +42 -0
  40. package/.agent/skills/gsap-plugins/SKILL.md +42 -0
  41. package/.agent/skills/gsap-react/SKILL.md +42 -0
  42. package/.agent/skills/gsap-scrolltrigger/SKILL.md +42 -0
  43. package/.agent/skills/gsap-timeline/SKILL.md +42 -0
  44. package/.agent/skills/gsap-utils/SKILL.md +42 -0
  45. package/.agent/skills/i18n-localization/SKILL.md +42 -0
  46. package/.agent/skills/intelligent-routing/SKILL.md +42 -0
  47. package/.agent/skills/knowledge-graph/SKILL.md +42 -0
  48. package/.agent/skills/lint-and-validate/SKILL.md +42 -0
  49. package/.agent/skills/llm-engineering/SKILL.md +42 -0
  50. package/.agent/skills/local-first/SKILL.md +42 -0
  51. package/.agent/skills/mcp-builder/SKILL.md +42 -0
  52. package/.agent/skills/mobile-design/SKILL.md +42 -0
  53. package/.agent/skills/monorepo-management/SKILL.md +42 -0
  54. package/.agent/skills/motion-engineering/SKILL.md +42 -0
  55. package/.agent/skills/nextjs-react-expert/SKILL.md +42 -0
  56. package/.agent/skills/nodejs-best-practices/SKILL.md +42 -0
  57. package/.agent/skills/observability/SKILL.md +42 -0
  58. package/.agent/skills/parallel-agents/SKILL.md +42 -0
  59. package/.agent/skills/performance-profiling/SKILL.md +42 -0
  60. package/.agent/skills/plan-writing/SKILL.md +42 -0
  61. package/.agent/skills/platform-engineer/SKILL.md +42 -0
  62. package/.agent/skills/playwright-best-practices/SKILL.md +42 -0
  63. package/.agent/skills/powershell-windows/SKILL.md +42 -0
  64. package/.agent/skills/project-idioms/SKILL.md +42 -0
  65. package/.agent/skills/python-patterns/SKILL.md +42 -0
  66. package/.agent/skills/python-pro/SKILL.md +42 -0
  67. package/.agent/skills/react-specialist/SKILL.md +42 -0
  68. package/.agent/skills/readme-builder/SKILL.md +42 -0
  69. package/.agent/skills/realtime-patterns/SKILL.md +42 -0
  70. package/.agent/skills/red-team-tactics/SKILL.md +42 -0
  71. package/.agent/skills/rust-pro/SKILL.md +42 -0
  72. package/.agent/skills/seo-fundamentals/SKILL.md +42 -0
  73. package/.agent/skills/server-management/SKILL.md +42 -0
  74. package/.agent/skills/shadcn-ui-expert/SKILL.md +42 -0
  75. package/.agent/skills/skill-creator/SKILL.md +42 -0
  76. package/.agent/skills/sql-pro/SKILL.md +42 -0
  77. package/.agent/skills/supabase-postgres-best-practices/SKILL.md +42 -0
  78. package/.agent/skills/swiftui-expert/SKILL.md +42 -0
  79. package/.agent/skills/systematic-debugging/SKILL.md +42 -0
  80. package/.agent/skills/tailwind-patterns/SKILL.md +42 -0
  81. package/.agent/skills/tdd-workflow/SKILL.md +42 -0
  82. package/.agent/skills/test-result-analyzer/SKILL.md +42 -0
  83. package/.agent/skills/testing-patterns/SKILL.md +42 -0
  84. package/.agent/skills/trend-researcher/SKILL.md +42 -0
  85. package/.agent/skills/typescript-advanced/SKILL.md +42 -0
  86. package/.agent/skills/ui-ux-pro-max/SKILL.md +42 -0
  87. package/.agent/skills/ui-ux-researcher/SKILL.md +42 -0
  88. package/.agent/skills/vue-expert/SKILL.md +42 -0
  89. package/.agent/skills/vulnerability-scanner/SKILL.md +42 -0
  90. package/.agent/skills/web-accessibility-auditor/SKILL.md +42 -0
  91. package/.agent/skills/web-design-guidelines/SKILL.md +42 -0
  92. package/.agent/skills/webapp-testing/SKILL.md +42 -0
  93. package/.agent/skills/whimsy-injector/SKILL.md +42 -0
  94. package/.agent/skills/workflow-optimizer/SKILL.md +42 -0
  95. package/.agent/workflows/marathon.md +247 -0
  96. package/.agent/workflows/super-prompt.md +27 -0
  97. package/README.md +113 -242
  98. package/bin/tribunal-kit.js +49 -3
  99. package/package.json +3 -2
  100. package/.agent/scripts/append_flow.js +0 -72
  101. package/.agent/scripts/colors.js +0 -11
  102. package/.agent/scripts/compress_skills.js +0 -141
  103. package/.agent/scripts/consolidate_skills.js +0 -149
  104. package/.agent/scripts/deep_compress.js +0 -150
  105. package/.agent/scripts/patch_skills_meta.js +0 -156
  106. package/.agent/scripts/patch_skills_output.js +0 -244
  107. package/.agent/scripts/strip_tribunal.js +0 -47
  108. package/.agent/scripts/utils.js +0 -17
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env node
2
+ // VERIFY: Using native Node.js only. Zero dependencies to ensure instant execution.
3
+
4
+ const rawInput = process.argv.slice(2).join(' ');
5
+
6
+ if (!rawInput) {
7
+ console.error("Usage: node prompt_compiler.js \"Your conversational prompt here\"");
8
+ process.exit(1);
9
+ }
10
+
11
+ // 1. Keep original input, only optionally strip leading "please" for action matching
12
+ const cleanInput = rawInput.trim();
13
+
14
+ // 2. Extract Action (Intent mapping)
15
+ const actionMatch = cleanInput.match(/^(?:(?:hey,?\s*|please\s+|can you\s+|could you\s+|would you\s+|i need you to\s+|i want to\s+)*)(build|create|fix|debug|refactor|update|write|design|audit)\b/i);
16
+ const action = actionMatch ? actionMatch[1].toLowerCase() : 'execute';
17
+
18
+ // 3. Extract Technology Stack
19
+ const techKeywords = [
20
+ 'react', 'tailwind', 'next.js', 'sql', 'postgres', 'express',
21
+ 'python', 'node', 'vue', 'svelte', 'typescript', 'js', 'css',
22
+ 'html', 'prisma', 'drizzle'
23
+ ];
24
+
25
+ const stack = [];
26
+ techKeywords.forEach(tech => {
27
+ const regex = new RegExp(`\\b${tech.replace('.', '\\.')}\\b`, 'i');
28
+ if (regex.test(cleanInput)) {
29
+ stack.push(tech.toLowerCase());
30
+ }
31
+ });
32
+
33
+ // 4. Intelligent Pre-Routing
34
+ const routerMap = {
35
+ 'react': ['react-specialist', 'frontend-design'],
36
+ 'tailwind': ['tailwind-patterns'],
37
+ 'next.js': ['nextjs-react-expert', 'react-specialist'],
38
+ 'sql': ['sql-pro', 'database-design'],
39
+ 'postgres': ['database-design'],
40
+ 'express': ['nodejs-best-practices'],
41
+ 'python': ['python-pro'],
42
+ 'node': ['nodejs-best-practices'],
43
+ 'vue': ['vue-expert'],
44
+ 'svelte': ['frontend-design'],
45
+ 'typescript': ['typescript-advanced'],
46
+ 'js': ['clean-code'],
47
+ 'css': ['tailwind-patterns'],
48
+ 'html': ['frontend-design'],
49
+ 'prisma': ['database-design'],
50
+ 'drizzle': ['database-design']
51
+ };
52
+
53
+ const actionRouter = {
54
+ 'build': ['architecture'],
55
+ 'create': ['architecture'],
56
+ 'fix': ['systematic-debugging'],
57
+ 'debug': ['systematic-debugging'],
58
+ 'refactor': ['clean-code'],
59
+ 'update': ['clean-code'],
60
+ 'write': ['clean-code'],
61
+ 'design': ['frontend-design'],
62
+ 'audit': ['vulnerability-scanner', 'lint-and-validate']
63
+ };
64
+
65
+ const recommendedSkills = new Set();
66
+
67
+ if (actionRouter[action]) {
68
+ actionRouter[action].forEach(s => recommendedSkills.add(s));
69
+ }
70
+
71
+ stack.forEach(tech => {
72
+ if (routerMap[tech]) {
73
+ routerMap[tech].forEach(s => recommendedSkills.add(s));
74
+ }
75
+ });
76
+
77
+ const finalSkills = Array.from(recommendedSkills).slice(0, 3);
78
+
79
+ // 5. Output highly compressed YAML
80
+ console.log('---');
81
+ console.log(`action: ${action}`);
82
+ console.log(`target: |`);
83
+ const indentedTarget = cleanInput.split('\n').map(line => ' ' + line).join('\n');
84
+ console.log(indentedTarget);
85
+ console.log(`stack: [${stack.join(', ')}]`);
86
+ console.log(`recommended_skills: [${finalSkills.join(', ')}]`);
87
+ console.log('---');
@@ -148,3 +148,45 @@ Review these questions before confirming output:
148
148
 
149
149
  ## VBC Protocol (Verification-Before-Completion)
150
150
  You MUST verify existing code signatures and variables before attempting to modify or call them. No hallucination is permitted.
151
+
152
+
153
+ ---
154
+
155
+ ## 🤖 LLM-Specific Traps
156
+
157
+ AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
158
+
159
+ 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
160
+ 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
161
+ 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
162
+ 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
163
+ 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
164
+
165
+ ---
166
+
167
+ ## 🏛️ Tribunal Integration (Anti-Hallucination)
168
+
169
+ **Slash command: `/review` or `/tribunal-full`**
170
+ **Active reviewers: `logic-reviewer` · `security-auditor`**
171
+
172
+ ### ❌ Forbidden AI Tropes
173
+
174
+ 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
175
+ 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
176
+ 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
177
+
178
+ ### ✅ Pre-Flight Self-Audit
179
+
180
+ Review these questions before confirming output:
181
+ ```
182
+ ✅ Did I rely ONLY on real, verified tools and methods?
183
+ ✅ Is this solution appropriately scoped to the user's constraints?
184
+ ✅ Did I handle potential failure modes and edge cases?
185
+ ✅ Have I avoided generic boilerplate that doesn't add value?
186
+ ```
187
+
188
+ ### 🛑 Verification-Before-Completion (VBC) Protocol
189
+
190
+ **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
191
+ - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
192
+ - ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
@@ -313,3 +313,45 @@ Review these questions before confirming output:
313
313
 
314
314
  ## VBC Protocol (Verification-Before-Completion)
315
315
  You MUST verify existing code signatures and variables before attempting to modify or call them. No hallucination is permitted.
316
+
317
+
318
+ ---
319
+
320
+ ## 🤖 LLM-Specific Traps
321
+
322
+ AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
323
+
324
+ 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
325
+ 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
326
+ 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
327
+ 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
328
+ 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
329
+
330
+ ---
331
+
332
+ ## 🏛️ Tribunal Integration (Anti-Hallucination)
333
+
334
+ **Slash command: `/review` or `/tribunal-full`**
335
+ **Active reviewers: `logic-reviewer` · `security-auditor`**
336
+
337
+ ### ❌ Forbidden AI Tropes
338
+
339
+ 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
340
+ 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
341
+ 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
342
+
343
+ ### ✅ Pre-Flight Self-Audit
344
+
345
+ Review these questions before confirming output:
346
+ ```
347
+ ✅ Did I rely ONLY on real, verified tools and methods?
348
+ ✅ Is this solution appropriately scoped to the user's constraints?
349
+ ✅ Did I handle potential failure modes and edge cases?
350
+ ✅ Have I avoided generic boilerplate that doesn't add value?
351
+ ```
352
+
353
+ ### 🛑 Verification-Before-Completion (VBC) Protocol
354
+
355
+ **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
356
+ - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
357
+ - ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
@@ -182,3 +182,45 @@ Review these questions before confirming output:
182
182
 
183
183
  ## VBC Protocol (Verification-Before-Completion)
184
184
  You MUST verify existing code signatures and variables before attempting to modify or call them. No hallucination is permitted.
185
+
186
+
187
+ ---
188
+
189
+ ## 🤖 LLM-Specific Traps
190
+
191
+ AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
192
+
193
+ 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
194
+ 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
195
+ 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
196
+ 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
197
+ 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
198
+
199
+ ---
200
+
201
+ ## 🏛️ Tribunal Integration (Anti-Hallucination)
202
+
203
+ **Slash command: `/review` or `/tribunal-full`**
204
+ **Active reviewers: `logic-reviewer` · `security-auditor`**
205
+
206
+ ### ❌ Forbidden AI Tropes
207
+
208
+ 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
209
+ 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
210
+ 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
211
+
212
+ ### ✅ Pre-Flight Self-Audit
213
+
214
+ Review these questions before confirming output:
215
+ ```
216
+ ✅ Did I rely ONLY on real, verified tools and methods?
217
+ ✅ Is this solution appropriately scoped to the user's constraints?
218
+ ✅ Did I handle potential failure modes and edge cases?
219
+ ✅ Have I avoided generic boilerplate that doesn't add value?
220
+ ```
221
+
222
+ ### 🛑 Verification-Before-Completion (VBC) Protocol
223
+
224
+ **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
225
+ - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
226
+ - ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
@@ -245,3 +245,45 @@ Review these questions before confirming output:
245
245
 
246
246
  ## VBC Protocol (Verification-Before-Completion)
247
247
  You MUST verify existing code signatures and variables before attempting to modify or call them. No hallucination is permitted.
248
+
249
+
250
+ ---
251
+
252
+ ## 🤖 LLM-Specific Traps
253
+
254
+ AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
255
+
256
+ 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
257
+ 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
258
+ 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
259
+ 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
260
+ 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
261
+
262
+ ---
263
+
264
+ ## 🏛️ Tribunal Integration (Anti-Hallucination)
265
+
266
+ **Slash command: `/review` or `/tribunal-full`**
267
+ **Active reviewers: `logic-reviewer` · `security-auditor`**
268
+
269
+ ### ❌ Forbidden AI Tropes
270
+
271
+ 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
272
+ 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
273
+ 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
274
+
275
+ ### ✅ Pre-Flight Self-Audit
276
+
277
+ Review these questions before confirming output:
278
+ ```
279
+ ✅ Did I rely ONLY on real, verified tools and methods?
280
+ ✅ Is this solution appropriately scoped to the user's constraints?
281
+ ✅ Did I handle potential failure modes and edge cases?
282
+ ✅ Have I avoided generic boilerplate that doesn't add value?
283
+ ```
284
+
285
+ ### 🛑 Verification-Before-Completion (VBC) Protocol
286
+
287
+ **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
288
+ - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
289
+ - ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
@@ -191,3 +191,45 @@ Review these questions before confirming output:
191
191
 
192
192
  ## VBC Protocol (Verification-Before-Completion)
193
193
  You MUST verify existing code signatures and variables before attempting to modify or call them. No hallucination is permitted.
194
+
195
+
196
+ ---
197
+
198
+ ## 🤖 LLM-Specific Traps
199
+
200
+ AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
201
+
202
+ 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
203
+ 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
204
+ 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
205
+ 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
206
+ 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
207
+
208
+ ---
209
+
210
+ ## 🏛️ Tribunal Integration (Anti-Hallucination)
211
+
212
+ **Slash command: `/review` or `/tribunal-full`**
213
+ **Active reviewers: `logic-reviewer` · `security-auditor`**
214
+
215
+ ### ❌ Forbidden AI Tropes
216
+
217
+ 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
218
+ 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
219
+ 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
220
+
221
+ ### ✅ Pre-Flight Self-Audit
222
+
223
+ Review these questions before confirming output:
224
+ ```
225
+ ✅ Did I rely ONLY on real, verified tools and methods?
226
+ ✅ Is this solution appropriately scoped to the user's constraints?
227
+ ✅ Did I handle potential failure modes and edge cases?
228
+ ✅ Have I avoided generic boilerplate that doesn't add value?
229
+ ```
230
+
231
+ ### 🛑 Verification-Before-Completion (VBC) Protocol
232
+
233
+ **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
234
+ - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
235
+ - ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
@@ -570,3 +570,45 @@ Review these questions before confirming output:
570
570
 
571
571
  ## VBC Protocol (Verification-Before-Completion)
572
572
  You MUST verify existing code signatures and variables before attempting to modify or call them. No hallucination is permitted.
573
+
574
+
575
+ ---
576
+
577
+ ## 🤖 LLM-Specific Traps
578
+
579
+ AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
580
+
581
+ 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
582
+ 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
583
+ 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
584
+ 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
585
+ 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
586
+
587
+ ---
588
+
589
+ ## 🏛️ Tribunal Integration (Anti-Hallucination)
590
+
591
+ **Slash command: `/review` or `/tribunal-full`**
592
+ **Active reviewers: `logic-reviewer` · `security-auditor`**
593
+
594
+ ### ❌ Forbidden AI Tropes
595
+
596
+ 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
597
+ 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
598
+ 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
599
+
600
+ ### ✅ Pre-Flight Self-Audit
601
+
602
+ Review these questions before confirming output:
603
+ ```
604
+ ✅ Did I rely ONLY on real, verified tools and methods?
605
+ ✅ Is this solution appropriately scoped to the user's constraints?
606
+ ✅ Did I handle potential failure modes and edge cases?
607
+ ✅ Have I avoided generic boilerplate that doesn't add value?
608
+ ```
609
+
610
+ ### 🛑 Verification-Before-Completion (VBC) Protocol
611
+
612
+ **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
613
+ - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
614
+ - ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
@@ -143,3 +143,45 @@ Review these questions before confirming output:
143
143
 
144
144
  ## VBC Protocol (Verification-Before-Completion)
145
145
  You MUST verify existing code signatures and variables before attempting to modify or call them. No hallucination is permitted.
146
+
147
+
148
+ ---
149
+
150
+ ## 🤖 LLM-Specific Traps
151
+
152
+ AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
153
+
154
+ 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
155
+ 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
156
+ 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
157
+ 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
158
+ 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
159
+
160
+ ---
161
+
162
+ ## 🏛️ Tribunal Integration (Anti-Hallucination)
163
+
164
+ **Slash command: `/review` or `/tribunal-full`**
165
+ **Active reviewers: `logic-reviewer` · `security-auditor`**
166
+
167
+ ### ❌ Forbidden AI Tropes
168
+
169
+ 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
170
+ 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
171
+ 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
172
+
173
+ ### ✅ Pre-Flight Self-Audit
174
+
175
+ Review these questions before confirming output:
176
+ ```
177
+ ✅ Did I rely ONLY on real, verified tools and methods?
178
+ ✅ Is this solution appropriately scoped to the user's constraints?
179
+ ✅ Did I handle potential failure modes and edge cases?
180
+ ✅ Have I avoided generic boilerplate that doesn't add value?
181
+ ```
182
+
183
+ ### 🛑 Verification-Before-Completion (VBC) Protocol
184
+
185
+ **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
186
+ - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
187
+ - ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
@@ -217,3 +217,45 @@ Review these questions before confirming output:
217
217
 
218
218
  ## VBC Protocol (Verification-Before-Completion)
219
219
  You MUST verify existing code signatures and variables before attempting to modify or call them. No hallucination is permitted.
220
+
221
+
222
+ ---
223
+
224
+ ## 🤖 LLM-Specific Traps
225
+
226
+ AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
227
+
228
+ 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
229
+ 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
230
+ 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
231
+ 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
232
+ 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
233
+
234
+ ---
235
+
236
+ ## 🏛️ Tribunal Integration (Anti-Hallucination)
237
+
238
+ **Slash command: `/review` or `/tribunal-full`**
239
+ **Active reviewers: `logic-reviewer` · `security-auditor`**
240
+
241
+ ### ❌ Forbidden AI Tropes
242
+
243
+ 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
244
+ 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
245
+ 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
246
+
247
+ ### ✅ Pre-Flight Self-Audit
248
+
249
+ Review these questions before confirming output:
250
+ ```
251
+ ✅ Did I rely ONLY on real, verified tools and methods?
252
+ ✅ Is this solution appropriately scoped to the user's constraints?
253
+ ✅ Did I handle potential failure modes and edge cases?
254
+ ✅ Have I avoided generic boilerplate that doesn't add value?
255
+ ```
256
+
257
+ ### 🛑 Verification-Before-Completion (VBC) Protocol
258
+
259
+ **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
260
+ - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
261
+ - ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
@@ -187,3 +187,45 @@ Review these questions before confirming output:
187
187
 
188
188
  ## VBC Protocol (Verification-Before-Completion)
189
189
  You MUST verify existing code signatures and variables before attempting to modify or call them. No hallucination is permitted.
190
+
191
+
192
+ ---
193
+
194
+ ## 🤖 LLM-Specific Traps
195
+
196
+ AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
197
+
198
+ 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
199
+ 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
200
+ 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
201
+ 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
202
+ 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
203
+
204
+ ---
205
+
206
+ ## 🏛️ Tribunal Integration (Anti-Hallucination)
207
+
208
+ **Slash command: `/review` or `/tribunal-full`**
209
+ **Active reviewers: `logic-reviewer` · `security-auditor`**
210
+
211
+ ### ❌ Forbidden AI Tropes
212
+
213
+ 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
214
+ 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
215
+ 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
216
+
217
+ ### ✅ Pre-Flight Self-Audit
218
+
219
+ Review these questions before confirming output:
220
+ ```
221
+ ✅ Did I rely ONLY on real, verified tools and methods?
222
+ ✅ Is this solution appropriately scoped to the user's constraints?
223
+ ✅ Did I handle potential failure modes and edge cases?
224
+ ✅ Have I avoided generic boilerplate that doesn't add value?
225
+ ```
226
+
227
+ ### 🛑 Verification-Before-Completion (VBC) Protocol
228
+
229
+ **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
230
+ - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
231
+ - ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
@@ -0,0 +1,122 @@
1
+ ---
2
+ name: backend-security-expert
3
+ description: Backend security auditing for modern server-side architectures. Focuses on Next.js Server Actions, Node.js/Edge APIs, JWT & Session architectures, ORM injection (Prisma/Drizzle), and RBAC implementation.
4
+ allowed-tools: Read, Write, Edit, Glob, Grep
5
+ version: 1.0.0
6
+ last-updated: 2026-05-22
7
+ applies-to-model: gemini-3-1-pro, claude-3-7-sonnet
8
+ ---
9
+
10
+ # Backend Security Expert — Modern Server Architectures
11
+
12
+ ## Hallucination Traps (Read First)
13
+ - ❌ Recommending session tokens without algorithm enforcement → ✅ Always verify JWT algorithms (`alg: "HS256"`) to prevent "None" attacks.
14
+ - ❌ Treating ORMs as automatically secure → ✅ Prisma and Drizzle can still be vulnerable if raw SQL/queries are dynamically interpolated.
15
+ - ❌ Assuming Next.js Server Actions are private APIs → ✅ Server Actions are public endpoints and must be authenticated and rate-limited.
16
+ - ❌ Leaving input validation to the controller logic → ✅ Always enforce strict schema boundaries (Zod/Pydantic) before business logic.
17
+
18
+ ---
19
+
20
+ ## 1. Next.js Server Actions & Edge APIs
21
+ Server Actions create implicit API endpoints. They must be treated like raw REST routes.
22
+ - **Authentication**: Validate the session ID/token at the very top of *every* Server Action.
23
+ - **Input Validation**: Parse all inputs using Zod. Do not trust TypeScript types, as they do not exist at runtime.
24
+ - **Rate Limiting**: Apply `@upstash/ratelimit` or similar to prevent brute force and abuse on public-facing actions.
25
+
26
+ ## 2. Authentication & Authorization (RBAC)
27
+ - **Role-Based Access**: Check if the authenticated user has permission to perform the specific action, not just if they are logged in.
28
+ - **IDOR Prevention**: Always verify that the resource being modified belongs to the user requesting the modification (e.g., `WHERE userId = session.userId`).
29
+ - **Secrets Management**: Never hardcode API keys. Ensure they are loaded from `.env` and fail loudly if missing.
30
+
31
+ ## 3. Database & ORM Security
32
+ - **NoSQL/ORM Injection**: Avoid passing raw JSON or objects directly into query constraints (e.g., MongoDB `$where` or Prisma raw queries).
33
+ - **Mass Assignment**: Never destructure user input directly into a database create/update call. Explicitly pick the fields allowed to be updated.
34
+ - **Query Depth**: For GraphQL backends, always implement depth limiting and cost analysis to prevent query-based DDoS.
35
+
36
+ ## 4. Headers & Server Hardening
37
+ - **CORS**: Never use wildcard `Access-Control-Allow-Origin: *` for authenticated routes.
38
+ - **Security Headers**: Ensure Helmet (or equivalent Next.js headers config) is active for HSTS, X-Frame-Options, and Content-Type-Options.
39
+
40
+ ---
41
+
42
+ AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
43
+
44
+ 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
45
+ 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
46
+ 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
47
+ 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
48
+ 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
49
+
50
+ ---
51
+
52
+ **Slash command: `/review` or `/tribunal-full`**
53
+ **Active reviewers: `logic-reviewer` · `security-auditor`**
54
+
55
+ ### ❌ Forbidden AI Tropes
56
+
57
+ 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
58
+ 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
59
+ 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
60
+
61
+ Review these questions before confirming output:
62
+ ```
63
+ ✅ Did I rely ONLY on real, verified tools and methods?
64
+ ✅ Is this solution appropriately scoped to the user's constraints?
65
+ ✅ Did I handle potential failure modes and edge cases?
66
+ ✅ Have I avoided generic boilerplate that doesn't add value?
67
+ ```
68
+
69
+ ### 🛑 Verification-Before-Completion (VBC) Protocol
70
+
71
+ **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
72
+ - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
73
+ - ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
74
+
75
+ ## Pre-Flight Checklist
76
+ - [ ] Have I reviewed the user's specific constraints and requests?
77
+ - [ ] Have I checked the environment for relevant existing implementations?
78
+
79
+ ## VBC Protocol (Verification-Before-Completion)
80
+ You MUST verify existing code signatures and variables before attempting to modify or call them. No hallucination is permitted.
81
+
82
+
83
+ ---
84
+
85
+ ## 🤖 LLM-Specific Traps
86
+
87
+ AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
88
+
89
+ 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
90
+ 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
91
+ 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
92
+ 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
93
+ 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
94
+
95
+ ---
96
+
97
+ ## 🏛️ Tribunal Integration (Anti-Hallucination)
98
+
99
+ **Slash command: `/review` or `/tribunal-full`**
100
+ **Active reviewers: `logic-reviewer` · `security-auditor`**
101
+
102
+ ### ❌ Forbidden AI Tropes
103
+
104
+ 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
105
+ 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
106
+ 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
107
+
108
+ ### ✅ Pre-Flight Self-Audit
109
+
110
+ Review these questions before confirming output:
111
+ ```
112
+ ✅ Did I rely ONLY on real, verified tools and methods?
113
+ ✅ Is this solution appropriately scoped to the user's constraints?
114
+ ✅ Did I handle potential failure modes and edge cases?
115
+ ✅ Have I avoided generic boilerplate that doesn't add value?
116
+ ```
117
+
118
+ ### 🛑 Verification-Before-Completion (VBC) Protocol
119
+
120
+ **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
121
+ - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
122
+ - ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.