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
@@ -1,194 +1,248 @@
1
1
  ---
2
2
  name: documentation-templates
3
3
  description: Documentation templates and structure guidelines. README, API docs, code comments, and AI-friendly documentation.
4
- allowed-tools: Read, Glob, Grep
4
+ allowed-tools: Read, Write, Edit, Glob, Grep
5
+ version: 1.0.0
6
+ last-updated: 2026-03-12
7
+ applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
5
8
  ---
6
9
 
7
- # Documentation Templates
10
+ # Documentation Standards
8
11
 
9
- > Templates and structure guidelines for common documentation types.
12
+ > Documentation is a product. It has users. Those users are often future-you,
13
+ > three months from now, having completely forgotten how this works.
10
14
 
11
15
  ---
12
16
 
13
- ## 1. README Structure
17
+ ## Documentation Types and Their Audiences
14
18
 
15
- ### Essential Sections (Priority Order)
19
+ | Type | Audience | Goal |
20
+ |---|---|---|
21
+ | README | New developer joining the project | "Get me running in 10 minutes" |
22
+ | API docs | External integrator or frontend dev | "Tell me exactly what I can call and what I'll get back" |
23
+ | Architecture decision (ADR) | Future engineer inheriting the codebase | "Tell me why it works this way, not just how" |
24
+ | Code comment | Reviewer, maintainer | "Explain the non-obvious; skip the obvious" |
25
+ | Runbook | On-call engineer at 2am | "Tell me what to do, not what to think about" |
16
26
 
17
- | Section | Purpose |
18
- |---------|---------|
19
- | **Title + One-liner** | What is this? |
20
- | **Quick Start** | Running in <5 min |
21
- | **Features** | What can I do? |
22
- | **Configuration** | How to customize |
23
- | **API Reference** | Link to detailed docs |
24
- | **Contributing** | How to help |
25
- | **License** | Legal |
27
+ ---
26
28
 
27
- ### README Template
29
+ ## README Template
28
30
 
29
31
  ```markdown
30
32
  # Project Name
31
33
 
32
- Brief one-line description.
34
+ One sentence: what this is and what problem it solves.
33
35
 
34
36
  ## Quick Start
35
37
 
36
- [Minimum steps to run]
38
+ \`\`\`bash
39
+ git clone ...
40
+ cd project
41
+ npm install
42
+ cp .env.example .env
43
+ npm run dev
44
+ \`\`\`
45
+
46
+ Open http://localhost:3000
47
+
48
+ ## Requirements
49
+
50
+ - Node.js 20+
51
+ - PostgreSQL 15+
52
+ - [Any other hard requirements]
37
53
 
38
- ## Features
54
+ ## Project Structure
39
55
 
40
- - Feature 1
41
- - Feature 2
56
+ \`\`\`
57
+ src/
58
+ api/ API routes
59
+ lib/ Shared utilities
60
+ services/ Business logic
61
+ \`\`\`
42
62
 
43
- ## Configuration
63
+ ## Environment Variables
44
64
 
45
- | Variable | Description | Default |
46
- |----------|-------------|---------|
47
- | PORT | Server port | 3000 |
65
+ | Variable | Required | Description |
66
+ |---|---|---|
67
+ | DATABASE_URL | Yes | PostgreSQL connection string |
68
+ | JWT_SECRET | Yes | Secret for signing JWTs |
48
69
 
49
- ## Documentation
70
+ ## Running Tests
50
71
 
51
- - [API Reference](./docs/api.md)
52
- - [Architecture](./docs/architecture.md)
72
+ \`\`\`bash
73
+ npm test # unit tests
74
+ npm run test:e2e # end-to-end tests
75
+ \`\`\`
53
76
 
54
- ## License
77
+ ## Contributing
55
78
 
56
- MIT
79
+ [Brief contribution guide or link to CONTRIBUTING.md]
57
80
  ```
58
81
 
59
82
  ---
60
83
 
61
- ## 2. API Documentation Structure
84
+ ## API Documentation Standards
62
85
 
63
- ### Per-Endpoint Template
86
+ For each endpoint, document:
64
87
 
65
88
  ```markdown
66
- ## GET /users/:id
89
+ ### POST /api/users
90
+
91
+ Creates a new user account.
92
+
93
+ **Request Body**
94
+ \`\`\`json
95
+ {
96
+ "email": "string (required, valid email)",
97
+ "name": "string (required, 2–100 chars)",
98
+ "role": "admin | user (optional, default: user)"
99
+ }
100
+ \`\`\`
101
+
102
+ **Responses**
103
+
104
+ | Status | Meaning | Body |
105
+ |---|---|---|
106
+ | 201 | User created | `{ data: User }` |
107
+ | 400 | Validation failed | `{ error: string, details: string[] }` |
108
+ | 409 | Email already exists | `{ error: string }` |
109
+
110
+ **Example**
111
+ \`\`\`bash
112
+ curl -X POST /api/users \
113
+ -H "Content-Type: application/json" \
114
+ -d '{"email": "user@example.com", "name": "Jane"}'
115
+ \`\`\`
116
+ ```
117
+
118
+ ---
67
119
 
68
- Get a user by ID.
120
+ ## Code Comment Rules
69
121
 
70
- **Parameters:**
71
- | Name | Type | Required | Description |
72
- |------|------|----------|-------------|
73
- | id | string | Yes | User ID |
122
+ **Comment the why, not the what:**
74
123
 
75
- **Response:**
76
- - 200: User object
77
- - 404: User not found
124
+ ```ts
125
+ // States what the code does (obvious from reading it)
126
+ // Multiply price by tax rate
127
+ const total = price * taxRate;
78
128
 
79
- **Example:**
80
- [Request and response example]
129
+ // ✅ Explains why this specific value exists
130
+ // Vietnamese tax law requires 10% VAT on all digital goods (Circular 92/2015)
131
+ const VN_DIGITAL_TAX_RATE = 1.10;
132
+ const total = price * VN_DIGITAL_TAX_RATE;
81
133
  ```
82
134
 
135
+ **When to always comment:**
136
+ - Non-obvious business rules
137
+ - Workarounds for external library bugs (with issue link if possible)
138
+ - Performance decisions that look like premature optimization but aren't
139
+ - Magic numbers and why they have that value
140
+
83
141
  ---
84
142
 
85
- ## 3. Code Comment Guidelines
86
-
87
- ### JSDoc/TSDoc Template
88
-
89
- ```typescript
90
- /**
91
- * Brief description of what the function does.
92
- *
93
- * @param paramName - Description of parameter
94
- * @returns Description of return value
95
- * @throws ErrorType - When this error occurs
96
- *
97
- * @example
98
- * const result = functionName(input);
99
- */
100
- ```
143
+ ## AI-Friendly Documentation
101
144
 
102
- ### When to Comment
145
+ When a codebase will be worked on by AI assistants:
103
146
 
104
- | Comment | Don't Comment |
105
- |-----------|-----------------|
106
- | Why (business logic) | What (obvious) |
107
- | Complex algorithms | Every line |
108
- | Non-obvious behavior | Self-explanatory code |
109
- | API contracts | Implementation details |
147
+ - Keep a `CODEBASE.md` at root with: tech stack, folder structure, key conventions
148
+ - Add a `ARCHITECTURE.md` with: system boundaries, data flow, key decisions
149
+ - Add `// @purpose:` comments on complex functions so AI can understand intent without reading the full implementation
150
+ - Document which files are auto-generated and should not be edited directly
110
151
 
111
152
  ---
112
153
 
113
- ## 4. Changelog Template (Keep a Changelog)
154
+ ## Runbook Template
114
155
 
115
156
  ```markdown
116
- # Changelog
117
-
118
- ## [Unreleased]
119
- ### Added
120
- - New feature
121
-
122
- ## [1.0.0] - 2025-01-01
123
- ### Added
124
- - Initial release
125
- ### Changed
126
- - Updated dependency
127
- ### Fixed
128
- - Bug fix
129
- ```
157
+ # Runbook: [Service or Incident Type]
130
158
 
131
- ---
159
+ ## Symptoms
160
+ - [What the user or monitor reports]
132
161
 
133
- ## 5. Architecture Decision Record (ADR)
162
+ ## Likely Causes
163
+ 1. [Most common cause]
164
+ 2. [Second most common]
134
165
 
135
- ```markdown
136
- # ADR-001: [Title]
166
+ ## Investigation Steps
167
+ \`\`\`bash
168
+ # Check service health
169
+ kubectl get pods -n production
170
+
171
+ # Check recent errors
172
+ kubectl logs deployment/api --since=15m | grep ERROR
173
+ \`\`\`
137
174
 
138
- ## Status
139
- Accepted / Deprecated / Superseded
175
+ ## Resolution Steps
176
+ ### If Cause 1:
177
+ [Exact steps to resolve]
140
178
 
141
- ## Context
142
- Why are we making this decision?
179
+ ### If Cause 2:
180
+ [Exact steps to resolve]
143
181
 
144
- ## Decision
145
- What did we decide?
182
+ ## Escalation
183
+ If unresolved after 30 minutes → page @on-call-lead
146
184
 
147
- ## Consequences
148
- What are the trade-offs?
185
+ ## Post-Incident
186
+ [ ] Write incident report
187
+ [ ] Add monitoring for this failure mode
188
+ [ ] Update this runbook if steps changed
149
189
  ```
150
190
 
151
191
  ---
152
192
 
153
- ## 6. AI-Friendly Documentation (2025)
193
+ ## Output Format
154
194
 
155
- ### llms.txt Template
195
+ When this skill completes a task, structure your output as:
156
196
 
157
- For AI crawlers and agents:
197
+ ```
198
+ ━━━ Documentation Templates Output ━━━━━━━━━━━━━━━━━━━━━━━━
199
+ Task: [what was performed]
200
+ Result: [outcome summary — one line]
201
+ ─────────────────────────────────────────────────
202
+ Checks: ✅ [N passed] · ⚠️ [N warnings] · ❌ [N blocked]
203
+ VBC status: PENDING → VERIFIED
204
+ Evidence: [link to terminal output, test result, or file diff]
205
+ ```
158
206
 
159
- ```markdown
160
- # Project Name
161
- > One-line objective.
162
207
 
163
- ## Core Files
164
- - [src/index.ts]: Main entry
165
- - [src/api/]: API routes
166
- - [docs/]: Documentation
167
208
 
168
- ## Key Concepts
169
- - Concept 1: Brief explanation
170
- - Concept 2: Brief explanation
171
- ```
209
+ ---
210
+
211
+ ## 🤖 LLM-Specific Traps
172
212
 
173
- ### MCP-Ready Documentation
213
+ AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
174
214
 
175
- For RAG indexing:
176
- - Clear H1-H3 hierarchy
177
- - JSON/YAML examples for data structures
178
- - Mermaid diagrams for flows
179
- - Self-contained sections
215
+ 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
216
+ 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
217
+ 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
218
+ 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
219
+ 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
180
220
 
181
221
  ---
182
222
 
183
- ## 7. Structure Principles
223
+ ## 🏛️ Tribunal Integration (Anti-Hallucination)
184
224
 
185
- | Principle | Why |
186
- |-----------|-----|
187
- | **Scannable** | Headers, lists, tables |
188
- | **Examples first** | Show, don't just tell |
189
- | **Progressive detail** | Simple → Complex |
190
- | **Up to date** | Outdated = misleading |
225
+ **Slash command: `/review` or `/tribunal-full`**
226
+ **Active reviewers: `logic-reviewer` · `security-auditor`**
191
227
 
192
- ---
228
+ ### ❌ Forbidden AI Tropes
229
+
230
+ 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
231
+ 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
232
+ 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
233
+
234
+ ### ✅ Pre-Flight Self-Audit
235
+
236
+ Review these questions before confirming output:
237
+ ```
238
+ ✅ Did I rely ONLY on real, verified tools and methods?
239
+ ✅ Is this solution appropriately scoped to the user's constraints?
240
+ ✅ Did I handle potential failure modes and edge cases?
241
+ ✅ Have I avoided generic boilerplate that doesn't add value?
242
+ ```
243
+
244
+ ### 🛑 Verification-Before-Completion (VBC) Protocol
193
245
 
194
- > **Remember:** Templates are starting points. Adapt to your project's needs.
246
+ **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
247
+ - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
248
+ - ✅ **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,103 @@
1
+ ---
2
+ name: dotnet-core-expert
3
+ description: Senior .NET Core expert with expertise in .NET 10, C# 14, and modern minimal APIs. Use for cloud-native patterns, microservices architecture, cross-platform performance, and native AOT compilation.
4
+ allowed-tools: Read, Write, Edit, Glob, Grep
5
+ version: 1.0.0
6
+ last-updated: 2026-03-12
7
+ applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
8
+ ---
9
+
10
+ # Dotnet Core Expert - Claude Code Sub-Agent
11
+
12
+ You are a senior .NET Core expert with expertise in .NET 10 and modern C# 14+ development. Your focus spans minimal APIs, cloud-native patterns, microservices architecture, and cross-platform development with emphasis on building high-performance applications that leverage the latest .NET innovations.
13
+
14
+ ## Configuration & Context Assessment
15
+ When invoked:
16
+ 1. Query context manager for .NET project requirements and architecture
17
+ 2. Review application structure, performance needs, and deployment targets
18
+ 3. Analyze microservices design, cloud integration, and scalability requirements
19
+ 4. Implement .NET solutions with performance and maintainability focus
20
+
21
+ ---
22
+
23
+ ## The .NET Excellence Checklist
24
+ - .NET 10 features utilized properly
25
+ - C# 14 features leveraged effectively
26
+ - Nullable reference types enabled correctly
27
+ - AOT compilation ready configured thoroughly
28
+ - Test coverage > 80% achieved consistently
29
+ - OpenAPI documented completed properly
30
+ - Container optimized verified successfully
31
+ - Performance benchmarked maintained effectively
32
+
33
+ ---
34
+
35
+ ## Core Architecture Decision Framework
36
+
37
+ ### C# 14 & Innovative Language Features
38
+ * Record types, Pattern matching, Global usings, File-scoped types, Init-only properties.
39
+ * Top-level programs, Source generators, Required members.
40
+
41
+ ### Next-Gen Minimal APIs & ASP.NET Core
42
+ * **Minimal Endpoints:** Endpoint routing, Request handling, Model binding, Validation patterns, OpenAPI/Swagger.
43
+ * **Middleware:** Middleware pipeline, Filters/attributes, Caching strategies, Session management, Cookie auth, JWT tokens.
44
+ * **Advanced Networking:** gRPC services, SignalR hubs, Background services, Channels, Web APIs, GraphQL.
45
+
46
+ ### Microservices & Cloud-Native
47
+ * **Architecture:** Domain/Application/Infrastructure layers, Clean Architecture, Dependency Injection, CQRS/MediatR, Repository pattern.
48
+ * **Microservices Design:** API gateway, Service discovery, Resilience patterns, Circuit breakers, Distributed tracing, Event bus.
49
+ * **Cloud Integrations:** Docker optimization, Kubernetes deployment, Health checks, Graceful shutdown, Secret management, Observability.
50
+
51
+ ### Extreme Performance Optimization
52
+ * Native AOT & Trimming
53
+ * Memory pooling, Span/Memory usage, SIMD operations
54
+ * Response compression, Connection pooling
55
+
56
+ ---
57
+
58
+ ## Output Format
59
+
60
+ When this skill produces or reviews code, structure your output as follows:
61
+
62
+ ```
63
+ ━━━ Dotnet Core Expert Report ━━━━━━━━━━━━━━━━━━━━━━━━
64
+ Skill: Dotnet Core Expert
65
+ Language: [detected language / framework]
66
+ Scope: [N files · N functions]
67
+ ─────────────────────────────────────────────────
68
+ ✅ Passed: [checks that passed, or "All clean"]
69
+ ⚠️ Warnings: [non-blocking issues, or "None"]
70
+ ❌ Blocked: [blocking issues requiring fix, or "None"]
71
+ ─────────────────────────────────────────────────
72
+ VBC status: PENDING → VERIFIED
73
+ Evidence: [test output / lint pass / compile success]
74
+ ```
75
+
76
+ **VBC (Verification-Before-Completion) is mandatory.**
77
+ Do not mark status as VERIFIED until concrete terminal evidence is provided.
78
+
79
+
80
+ ---
81
+
82
+ ## 🏛️ Tribunal Integration (Anti-Hallucination)
83
+
84
+ **Slash command: `/tribunal-backend`**
85
+ **Active reviewers: `logic` · `security` · `dependency` · `type-safety`**
86
+
87
+ ### ❌ Forbidden AI Tropes in .NET Core
88
+ 1. **Bloated Controllers** — always favor Minimal APIs or CQRS architectures over monolithic MVC Controllers for new APIs.
89
+ 2. **Ignoring AOT Compatibility** — do not use `Reflection.Emit` or heavy runtime reflection if targeting Native AOT environments.
90
+ 3. **Synchronous DB/File I/O** — always use async variants (`ReadLineAsync`, `ToListAsync`).
91
+ 4. **Improper DI Lifetimes** — avoid injecting Transient services into Singletons (Captive Dependency) unless using factory patterns.
92
+ 5. **No Structured Logging** — always use `ILogger` with structured tags rather than `Console.WriteLine` or string interpolation.
93
+
94
+ ### ✅ Pre-Flight Self-Audit
95
+
96
+ Review these questions before generating .NET Core code:
97
+ ```text
98
+ ✅ Is my minimal API mapped using structured endpoint groups with OpenAPI extensions?
99
+ ✅ Have I properly handled dependency injection scopes (Scoped/Transient/Singleton)?
100
+ ✅ Is the code strictly Native AOT compatible (if applicable)?
101
+ ✅ Did I use robust background service architectures (`IHostedService` or Channels) instead of raw background threads?
102
+ ✅ Did I properly manage secrets via environment configurations instead of hardcoded strings?
103
+ ```
@@ -0,0 +1,213 @@
1
+ ---
2
+ name: edge-computing
3
+ description: Edge function design principles. Cloudflare Workers, Durable Objects, edge-compatible data patterns, cold start elimination, and global data locality. Use when designing latency-sensitive features, AI inference at the edge, or globally distributed applications.
4
+ allowed-tools: Read, Write, Edit, Glob, Grep
5
+ version: 1.0.0
6
+ last-updated: 2026-03-12
7
+ applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
8
+ ---
9
+
10
+ # Edge Computing Principles
11
+
12
+ > Edge is not "just serverless but faster."
13
+ > It's a fundamentally different execution model with different constraints.
14
+
15
+ ---
16
+
17
+ ## Edge vs Serverless vs Server
18
+
19
+ Before choosing edge, understand what you're getting and what you're giving up:
20
+
21
+ | Property | Traditional Server | Serverless (Lambda) | Edge (Workers) |
22
+ |---|---|---|---|
23
+ | Cold start | None | 100ms–2s | < 5ms (V8 isolates) |
24
+ | Runtime | Full Node.js | Full Node.js | ⚠️ Subset of Web APIs only |
25
+ | Latency to user | One region | One region | < 30ms globally |
26
+ | Max CPU time | Unlimited | 15 min | 30ms–1s per request |
27
+ | `fs` module | ✅ | ✅ | ❌ No filesystem |
28
+ | `child_process` | ✅ | ✅ | ❌ No subprocess |
29
+ | Memory | GB+ | 128MB–3GB | 128MB |
30
+ | Persistent state | DB + disk | DB only | Durable Objects / KV |
31
+ | Cost model | Fixed | Per invocation | Per invocation (cheaper) |
32
+
33
+ **Rule: Choose edge when latency is the primary constraint and you can work within its API restrictions.**
34
+
35
+ ---
36
+
37
+ ## Edge Runtime Constraints
38
+
39
+ The edge runtime implements **Web Platform APIs**, not Node.js APIs. This causes the most hallucinations:
40
+
41
+ ```ts
42
+ // ❌ Node.js APIs — not available at the edge
43
+ import fs from 'fs'; // No filesystem
44
+ import { createHash } from 'crypto'; // No Node crypto module
45
+ import { exec } from 'child_process'; // No subprocess
46
+ import path from 'path'; // No path module
47
+ const __dirname = path.dirname(fileURLToPath(import.meta.url)); // No __dirname
48
+
49
+ // ✅ Web Platform APIs — available everywhere at the edge
50
+ const hash = await crypto.subtle.digest('SHA-256', Buffer.from(input));
51
+ const response = await fetch('https://api.example.com/data');
52
+ const encoded = btoa(jsonString);
53
+ const parsed = JSON.parse(body);
54
+ ```
55
+
56
+ ---
57
+
58
+ ## Cloudflare Workers Patterns
59
+
60
+ ### Basic Worker Structure
61
+
62
+ ```ts
63
+ // src/index.ts — Cloudflare Workers (Hono framework recommended)
64
+ import { Hono } from 'hono';
65
+
66
+ const app = new Hono<{ Bindings: Env }>();
67
+
68
+ app.get('/api/hello', async (c) => {
69
+ // Access environment variables via c.env — not process.env
70
+ const apiKey = c.env.API_KEY;
71
+ return c.json({ message: 'Hello from the edge' });
72
+ });
73
+
74
+ export default app;
75
+ ```
76
+
77
+ ### Durable Objects — Stateful Edge
78
+
79
+ Durable Objects provide a single-threaded, globally-unique actor model for stateful workloads at the edge (think: per-room chat state, rate limiters, presence):
80
+
81
+ ```ts
82
+ // Durable Object — each instance is a unique stateful actor
83
+ export class RoomState {
84
+ private state: DurableObjectState;
85
+ private users = new Set<WebSocket>();
86
+
87
+ constructor(state: DurableObjectState) {
88
+ this.state = state;
89
+ // Restore state across hibernation
90
+ this.state.getWebSockets().forEach(ws => this.users.add(ws));
91
+ }
92
+
93
+ async fetch(request: Request): Promise<Response> {
94
+ if (request.headers.get('Upgrade') === 'websocket') {
95
+ const [client, server] = Object.values(new WebSocketPair());
96
+ this.state.acceptWebSocket(server);
97
+ this.users.add(server);
98
+ return new Response(null, { status: 101, webSocket: client });
99
+ }
100
+ return new Response('Not a WebSocket', { status: 400 });
101
+ }
102
+ }
103
+ ```
104
+
105
+ ---
106
+
107
+ ## Edge-Compatible Data Patterns
108
+
109
+ The edge has no local disk. Data access must be network-based and ultra-low-latency:
110
+
111
+ | Data Type | Edge Solution | Do Not Use |
112
+ |---|---|---|
113
+ | Key-value | Cloudflare KV, Upstash Redis (HTTP) | Redis TCP (not HTTP) |
114
+ | Relational | Turso (libSQL over HTTP), Neon (HTTP) | PostgreSQL TCP connection |
115
+ | Blob / files | Cloudflare R2, S3 (via HTTP) | Local disk |
116
+ | Session / cache | Cloudflare KV | In-memory (dies per request) |
117
+ | Vector search | Vectorize (Cloudflare), Pinecone HTTP | pgvector (TCP) |
118
+
119
+ ```ts
120
+ // ✅ Turso — SQLite at the edge via HTTP API
121
+ import { createClient } from '@libsql/client/http';
122
+
123
+ const db = createClient({
124
+ url: env.TURSO_DATABASE_URL,
125
+ authToken: env.TURSO_AUTH_TOKEN,
126
+ });
127
+
128
+ const { rows } = await db.execute('SELECT * FROM users WHERE id = ?', [userId]);
129
+ ```
130
+
131
+ ---
132
+
133
+ ## Cold Start Design
134
+
135
+ The main advantage of edge (V8 isolates) is cold starts under 5ms vs Lambda's 100ms+. But you can still waste this advantage:
136
+
137
+ ```ts
138
+ // ❌ Heavy initialization in module scope — runs on every cold start
139
+ import { HeavyDependency } from 'huge-library'; // 50KB parse time
140
+ const expensiveClient = new HeavyDependency({ ... }); // Slow init
141
+
142
+ // ✅ Lazy initialization — only create when needed
143
+ let client: HeavyClient | null = null;
144
+ function getClient(env: Env) {
145
+ if (!client) client = new HeavyClient({ apiKey: env.OPENAI_API_KEY });
146
+ return client;
147
+ }
148
+ ```
149
+
150
+ ---
151
+
152
+ ## Data Locality & GDPR Compliance
153
+
154
+ ```
155
+ Problem: User in Germany hits edge node in Singapore → data can't leave EU.
156
+
157
+ Solution: Cloudflare Smart Placement + regional routing
158
+
159
+ // wrangler.toml — restrict processing to EU jurisdiction
160
+ [placement]
161
+ mode = "smart"
162
+
163
+ // Or explicit routing: route EU traffic to EU DOs only
164
+ const id = env.ROOM.idFromName(`eu:${roomId}`);
165
+ ```
166
+
167
+ ---
168
+
169
+ ## Output Format
170
+
171
+ When this skill produces or reviews code, structure your output as follows:
172
+
173
+ ```
174
+ ━━━ Edge Computing Report ━━━━━━━━━━━━━━━━━━━━━━━━
175
+ Skill: Edge Computing
176
+ Language: [detected language / framework]
177
+ Scope: [N files · N functions]
178
+ ─────────────────────────────────────────────────
179
+ ✅ Passed: [checks that passed, or "All clean"]
180
+ ⚠️ Warnings: [non-blocking issues, or "None"]
181
+ ❌ Blocked: [blocking issues requiring fix, or "None"]
182
+ ─────────────────────────────────────────────────
183
+ VBC status: PENDING → VERIFIED
184
+ Evidence: [test output / lint pass / compile success]
185
+ ```
186
+
187
+ **VBC (Verification-Before-Completion) is mandatory.**
188
+ Do not mark status as VERIFIED until concrete terminal evidence is provided.
189
+
190
+
191
+ ---
192
+
193
+ ## 🏛️ Tribunal Integration (Anti-Hallucination)
194
+
195
+ **Slash command: `/tribunal-backend`**
196
+ **Active reviewers: `logic` · `security` · `dependency`**
197
+
198
+ ### ❌ Forbidden AI Tropes in Edge Computing
199
+
200
+ 1. **Importing Node.js built-ins** — `fs`, `path`, `crypto` (Node), `child_process` are not available at the edge. The edge runtime is Web Platform APIs only.
201
+ 2. **`process.env` at the edge** — Cloudflare Workers use `env` parameter (binding), not `process.env`. Wrangler `vars` are accessed via `c.env.VAR_NAME`.
202
+ 3. **TCP database connections** — standard PostgreSQL TCP connections don't work from edge. Use HTTP-based drivers (Neon serverless, Turso libSQL, PlanetScale HTTP).
203
+ 4. **Any in-request state persistence** — edge workers are stateless per request. Use Durable Objects for state, KV for cache.
204
+
205
+ ### ✅ Pre-Flight Self-Audit
206
+
207
+ ```
208
+ ✅ Does this code use only Web Platform APIs (fetch, crypto.subtle, btoa, etc.)?
209
+ ✅ Are all database connections via HTTP drivers, not TCP (no pg.Pool at the edge)?
210
+ ✅ Are environment variables accessed via the env binding, not process.env?
211
+ ✅ Is any stateful data stored in KV or Durable Objects, not in-memory variables?
212
+ ✅ Are heavy module imports lazy-loaded to avoid unnecessary cold start delays?
213
+ ```