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
@@ -2,80 +2,256 @@
2
2
  name: api-patterns
3
3
  description: API design principles and decision-making. REST vs GraphQL vs tRPC selection, response formats, versioning, pagination.
4
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
- # API Patterns
10
+ # API Design Patterns
8
11
 
9
- > API design principles and decision-making for 2025.
10
- > **Learn to THINK, not copy fixed patterns.**
12
+ > Build APIs that serve their consumers — not APIs that match the tutorial you read last.
13
+ > Every decision here has a trade-off. Know the trade-off before you pick a side.
11
14
 
12
- ## 🎯 Selective Reading Rule
15
+ ## How to Use This Skill
13
16
 
14
- **Read ONLY files relevant to the request!** Check the content map, find what you need.
17
+ Only read the files you actually need for this task. The map below tells you where to look.
15
18
 
16
19
  ---
17
20
 
18
- ## 📑 Content Map
19
-
20
- | File | Description | When to Read |
21
- |------|-------------|--------------|
22
- | `api-style.md` | REST vs GraphQL vs tRPC decision tree | Choosing API type |
23
- | `rest.md` | Resource naming, HTTP methods, status codes | Designing REST API |
24
- | `response.md` | Envelope pattern, error format, pagination | Response structure |
25
- | `graphql.md` | Schema design, when to use, security | Considering GraphQL |
26
- | `trpc.md` | TypeScript monorepo, type safety | TS fullstack projects |
27
- | `versioning.md` | URI/Header/Query versioning | API evolution planning |
28
- | `auth.md` | JWT, OAuth, Passkey, API Keys | Auth pattern selection |
29
- | `rate-limiting.md` | Token bucket, sliding window | API protection |
30
- | `documentation.md` | OpenAPI/Swagger best practices | Documentation |
31
- | `security-testing.md` | OWASP API Top 10, auth/authz testing | Security audits |
21
+ ## File Index
22
+
23
+ | File | What It Covers | Load When |
24
+ |---|---|---|
25
+ | `api-style.md` | Choosing between REST, GraphQL, and tRPC | Client type is unclear or debated |
26
+ | `rest.md` | Endpoint naming, HTTP verbs, status code semantics | Building a REST surface |
27
+ | `response.md` | Unified response envelope, error shapes, cursor pagination | Defining response contracts |
28
+ | `graphql.md` | Schema-first design, N+1 awareness, when NOT to use GraphQL | GraphQL is on the table |
29
+ | `trpc.md` | Type-safe RPC for TypeScript monorepos | Full-stack TypeScript project |
30
+ | `versioning.md` | URI, header, and content-type versioning strategies | API needs to evolve without breaking clients |
31
+ | `auth.md` | JWT, OAuth 2.0, Passkeys, API keys — picking the right one | Authentication is being designed |
32
+ | `rate-limiting.md` | Token bucket vs sliding window, burst handling | Protecting public or high-traffic endpoints |
33
+ | `documentation.md` | OpenAPI spec quality, example-driven docs | API is being documented |
34
+ | `security-testing.md` | OWASP API Top 10, authorization boundary testing | Security review |
35
+
36
+ ---
37
+
38
+ ## Related Expertise
39
+
40
+ | If You Also Need | Load This |
41
+ |---|---|
42
+ | Server implementation | `@[skills/nodejs-best-practices]` |
43
+ | Data layer | `@[skills/database-design]` |
44
+ | Vulnerability review | `@[skills/vulnerability-scanner]` |
45
+
46
+ ---
47
+
48
+ ## Pre-Design Checklist
49
+
50
+ Answer these before writing a single route:
51
+
52
+ - [ ] Who calls this API? (browser, mobile, service-to-service, third party)
53
+ - [ ] What data shape does the consumer need — or does it vary per caller?
54
+ - [ ] REST, GraphQL, or tRPC — and does the team agree?
55
+ - [ ] What does a failed response look like across the whole surface?
56
+ - [ ] How will this API change in 6 months without breaking callers?
57
+ - [ ] Is there a rate-limit story?
58
+ - [ ] Will there be public docs, and who maintains them?
59
+
60
+ ---
61
+
62
+ ## Common Mistakes
63
+
64
+ **Patterns that cause pain later:**
65
+
66
+ - Treating REST as default without considering the consumer's actual fetch patterns
67
+ - Verbs in endpoint paths (`/getUser`, `/deleteItem`) — REST resources are nouns
68
+ - Inconsistent error shapes across routes — consumers have to guess
69
+ - Leaking stack traces or internal identifiers in error responses
70
+ - No versioning plan until the first breaking change hits production
71
+
72
+ **What good looks like:**
73
+
74
+ - API style chosen for the actual use case, not habit
75
+ - Consumer requirements asked and confirmed before design starts
76
+ - Every response — success and failure — follows the same shape
77
+ - HTTP status codes mean what they're supposed to mean
78
+
79
+ ---
80
+
81
+ ## AI-Era API Patterns (2025+)
82
+
83
+ ### SSE vs WebSocket for AI Streaming
84
+
85
+ ```
86
+ SSE (Server-Sent Events) — use for AI text streaming:
87
+ ✅ One-directional: server → client (exactly what LLM streaming is)
88
+ ✅ HTTP/2-native, works through all proxies
89
+ ✅ No library needed — native EventSource API in browsers
90
+ ❌ If the client also needs to send data mid-stream → WebSocket instead
91
+
92
+ WebSocket — use for bidirectional real-time:
93
+ ✅ Full-duplex (both directions)
94
+ ✅ Real-time collaboration, chat, game state
95
+ ❌ More complex lifecycle management
96
+ ```
97
+
98
+ ```ts
99
+ // ✅ SSE endpoint for AI streaming response
100
+ app.get('/api/generate', async (req, res) => {
101
+ res.setHeader('Content-Type', 'text/event-stream');
102
+ res.setHeader('Cache-Control', 'no-cache');
103
+
104
+ const stream = await openai.chat.completions.create({ ..., stream: true });
105
+
106
+ for await (const chunk of stream) {
107
+ const text = chunk.choices[0]?.delta?.content ?? '';
108
+ if (text) res.write(`data: ${JSON.stringify({ text })}\n\n`);
109
+ }
110
+
111
+ res.write('data: [DONE]\n\n');
112
+ res.end();
113
+ });
114
+ ```
115
+
116
+ ### Model Context Protocol (MCP)
117
+
118
+ MCP is the emerging standard (2025) for AI models to interface with external tools and data sources:
119
+
120
+ ```ts
121
+ // MCP server — expose your API's capabilities as MCP tools
122
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
123
+
124
+ const server = new McpServer({ name: 'my-api', version: '1.0.0' });
125
+
126
+ // Register a tool that AI agents can call
127
+ server.tool(
128
+ 'search_products',
129
+ 'Search the product catalog by keyword and category',
130
+ {
131
+ query: z.string().describe('Search terms'),
132
+ category: z.string().optional().describe('Filter by category'),
133
+ },
134
+ async ({ query, category }) => {
135
+ const results = await db.searchProducts(query, category);
136
+ return { content: [{ type: 'text', text: JSON.stringify(results) }] };
137
+ }
138
+ );
139
+ ```
140
+
141
+ ### Idempotency Keys for LLM Request Deduplication
142
+
143
+ LLM requests can be expensive. If a client retries due to a timeout, you may charge twice:
144
+
145
+ ```ts
146
+ // ✅ Idempotency key — same key = return cached response
147
+ app.post('/api/generate', async (req, res) => {
148
+ const idempotencyKey = req.headers['idempotency-key'];
149
+
150
+ if (idempotencyKey) {
151
+ const cached = await cache.get(`llm:${idempotencyKey}`);
152
+ if (cached) return res.json(cached);
153
+ }
154
+
155
+ const result = await callLLM(req.body);
156
+
157
+ if (idempotencyKey) {
158
+ await cache.set(`llm:${idempotencyKey}`, result, { ex: 3600 }); // 1hr TTL
159
+ }
160
+
161
+ res.json(result);
162
+ });
163
+ ```
32
164
 
33
165
  ---
34
166
 
35
- ## 🔗 Related Skills
167
+ ## Scripts
36
168
 
37
- | Need | Skill |
38
- |------|-------|
39
- | API implementation | `@[skills/backend-development]` |
40
- | Data structure | `@[skills/database-design]` |
41
- | Security details | `@[skills/security-hardening]` |
169
+ | Script | Purpose | Run With |
170
+ |---|---|---|
171
+ | `scripts/api_validator.py` | Validates endpoint naming and response shape consistency | `python scripts/api_validator.py <project_path>` |
42
172
 
43
173
  ---
44
174
 
45
- ## Decision Checklist
175
+ ## Output Format
176
+
177
+ When this skill produces a recommendation or design decision, structure your output as:
46
178
 
47
- Before designing an API:
179
+ ```
180
+ ━━━ Api Patterns Recommendation ━━━━━━━━━━━━━━━━
181
+ Decision: [what was chosen / proposed]
182
+ Rationale: [why — one concise line]
183
+ Trade-offs: [what is consciously accepted]
184
+ Next action: [concrete next step for the user]
185
+ ─────────────────────────────────────────────────
186
+ Pre-Flight: ✅ All checks passed
187
+ or ❌ [blocking item that must be resolved first]
188
+ ```
48
189
 
49
- - [ ] **Asked user about API consumers?**
50
- - [ ] **Chosen API style for THIS context?** (REST/GraphQL/tRPC)
51
- - [ ] **Defined consistent response format?**
52
- - [ ] **Planned versioning strategy?**
53
- - [ ] **Considered authentication needs?**
54
- - [ ] **Planned rate limiting?**
55
- - [ ] **Documentation approach defined?**
56
190
 
57
191
  ---
58
192
 
59
- ## Anti-Patterns
193
+ ## 🏛️ Tribunal Integration (Anti-Hallucination)
194
+
195
+ **Slash command: `/tribunal-backend`**
196
+ **Active reviewers: `logic` · `security` · `dependency`**
60
197
 
61
- **DON'T:**
62
- - Default to REST for everything
63
- - Use verbs in REST endpoints (/getUsers)
64
- - Return inconsistent response formats
65
- - Expose internal errors to clients
66
- - Skip rate limiting
198
+ ### ❌ Forbidden AI Tropes in API Design
199
+
200
+ 1. **REST = CRUD assumption** — do not assume every REST endpoint maps 1:1 with a database table. APIs model behaviors, not just data.
201
+ 2. **Missing Input Validation** — never generate an endpoint that accepts external data without validating it (e.g., Zod, Joi).
202
+ 3. **Hardcoded 200 OK** returning 200 for created resources (should be 201) or async accepted (should be 202). Use precise status codes.
203
+ 4. **No Pagination strategy** — returning unbound lists endpoints (e.g., `GET /users`) without limits or cursors.
204
+ 5. **Leaky Error Responses** — returning raw database errors or stack traces to the client.
205
+
206
+ ### ✅ Pre-Flight Self-Audit
207
+
208
+ Review these questions before generating API design or code:
209
+ ```
210
+ ✅ Are all inputs validated at the boundary?
211
+ ✅ Does every endpoint have an explicit authentication AND authorization check?
212
+ ✅ Did I use the correct HTTP verbs and semantic status codes?
213
+ ✅ Is the response shape consistent with the rest of the API?
214
+ ✅ Did I handle pagination for lists and rate limiting for public endpoints?
215
+ ```
67
216
 
68
- **DO:**
69
- - Choose API style based on context
70
- - Ask about client requirements
71
- - Document thoroughly
72
- - Use appropriate status codes
73
217
 
74
218
  ---
75
219
 
76
- ## Script
220
+ ## 🤖 LLM-Specific Traps
221
+
222
+ AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
223
+
224
+ 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
225
+ 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
226
+ 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
227
+ 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
228
+ 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
229
+
230
+ ---
231
+
232
+ ## 🏛️ Tribunal Integration (Anti-Hallucination)
233
+
234
+ **Slash command: `/review` or `/tribunal-full`**
235
+ **Active reviewers: `logic-reviewer` · `security-auditor`**
236
+
237
+ ### ❌ Forbidden AI Tropes
238
+
239
+ 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
240
+ 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
241
+ 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
242
+
243
+ ### ✅ Pre-Flight Self-Audit
244
+
245
+ Review these questions before confirming output:
246
+ ```
247
+ ✅ Did I rely ONLY on real, verified tools and methods?
248
+ ✅ Is this solution appropriately scoped to the user's constraints?
249
+ ✅ Did I handle potential failure modes and edge cases?
250
+ ✅ Have I avoided generic boilerplate that doesn't add value?
251
+ ```
77
252
 
78
- | Script | Purpose | Command |
79
- |--------|---------|---------|
80
- | `scripts/api_validator.py` | API endpoint validation | `python scripts/api_validator.py <project_path>` |
253
+ ### 🛑 Verification-Before-Completion (VBC) Protocol
81
254
 
255
+ **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
256
+ - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
257
+ - ✅ **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.
@@ -1,75 +1,238 @@
1
1
  ---
2
2
  name: app-builder
3
3
  description: Main application building orchestrator. Creates full-stack applications from natural language requests. Determines project type, selects tech stack, coordinates agents.
4
- allowed-tools: Read, Write, Edit, Glob, Grep, Bash, Agent
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
- # App Builder - Application Building Orchestrator
10
+ # App Builder Application Orchestrator
8
11
 
9
- > Analyzes user's requests, determines tech stack, plans structure, and coordinates agents.
12
+ > Building a full application is a coordination problem, not a coding problem.
13
+ > Coordinate the experts. Keep the boundaries clean.
10
14
 
11
- ## 🎯 Selective Reading Rule
15
+ ---
12
16
 
13
- **Read ONLY files relevant to the request!** Check the content map, find what you need.
17
+ ## When This Skill Activates
14
18
 
15
- | File | Description | When to Read |
16
- |------|-------------|--------------|
17
- | `project-detection.md` | Keyword matrix, project type detection | Starting new project |
18
- | `tech-stack.md` | 2026 default stack, alternatives | Choosing technologies |
19
- | `agent-coordination.md` | Agent pipeline, execution order | Coordinating multi-agent work |
20
- | `scaffolding.md` | Directory structure, core files | Creating project structure |
21
- | `feature-building.md` | Feature analysis, error handling | Adding features to existing project |
22
- | `templates/SKILL.md` | **Project templates** | Scaffolding new project |
19
+ Activate when the user request involves:
20
+ - Creating a new application from scratch
21
+ - Building a major feature that spans frontend + backend + database
22
+ - Bootstrapping a project structure for a new stack
23
23
 
24
24
  ---
25
25
 
26
- ## 📦 Templates (13)
27
-
28
- Quick-start scaffolding for new projects. **Read the matching template only!**
29
-
30
- | Template | Tech Stack | When to Use |
31
- |----------|------------|-------------|
32
- | [nextjs-fullstack](templates/nextjs-fullstack/TEMPLATE.md) | Next.js + Prisma | Full-stack web app |
33
- | [nextjs-saas](templates/nextjs-saas/TEMPLATE.md) | Next.js + Stripe | SaaS product |
34
- | [nextjs-static](templates/nextjs-static/TEMPLATE.md) | Next.js + Framer | Landing page |
35
- | [nuxt-app](templates/nuxt-app/TEMPLATE.md) | Nuxt 3 + Pinia | Vue full-stack app |
36
- | [express-api](templates/express-api/TEMPLATE.md) | Express + JWT | REST API |
37
- | [python-fastapi](templates/python-fastapi/TEMPLATE.md) | FastAPI | Python API |
38
- | [react-native-app](templates/react-native-app/TEMPLATE.md) | Expo + Zustand | Mobile app |
39
- | [flutter-app](templates/flutter-app/TEMPLATE.md) | Flutter + Riverpod | Cross-platform mobile |
40
- | [electron-desktop](templates/electron-desktop/TEMPLATE.md) | Electron + React | Desktop app |
41
- | [chrome-extension](templates/chrome-extension/TEMPLATE.md) | Chrome MV3 | Browser extension |
42
- | [cli-tool](templates/cli-tool/TEMPLATE.md) | Node.js + Commander | CLI app |
43
- | [monorepo-turborepo](templates/monorepo-turborepo/TEMPLATE.md) | Turborepo + pnpm | Monorepo |
26
+ ## Orchestration Flow
27
+
28
+ ```
29
+ 1. CLARIFY → Understand what and who for
30
+ 2. DECIDE → Choose the stack
31
+ 3. PLAN → Break into ordered, dependency-aware tasks
32
+ 4. COORDINATE → Run specialists in the right sequence
33
+ 5. INTEGRATE → Verify boundaries are consistent
34
+ 6. PREVIEW → Start the dev server
35
+ ```
44
36
 
45
37
  ---
46
38
 
47
- ## 🔗 Related Agents
39
+ ## Phase 1 — Clarification
40
+
41
+ Before selecting a stack or writing a line of code, ask:
48
42
 
49
- | Agent | Role |
50
- |-------|------|
51
- | `project-planner` | Task breakdown, dependency graph |
52
- | `frontend-specialist` | UI components, pages |
53
- | `backend-specialist` | API, business logic |
54
- | `database-architect` | Schema, migrations |
55
- | `devops-engineer` | Deployment, preview |
43
+ ```
44
+ 1. What is the core thing this app does? (not features — the primary purpose)
45
+ 2. Who uses it? (internal tool, public-facing, B2B, mobile users?)
46
+ 3. What constraints matter most? (time to ship, cost, performance, existing stack?)
47
+ 4. What already exists that this integrates with?
48
+ ```
49
+
50
+ Wait for answers. Stack decisions depend on these answers.
56
51
 
57
52
  ---
58
53
 
59
- ## Usage Example
54
+ ## Phase 2 — Stack Selection
55
+
56
+ | App Type | Frontend | Backend | Database |
57
+ |---|---|---|---|
58
+ | Content / marketing site | Next.js | Next.js API routes | PostgreSQL (if dynamic) |
59
+ | SaaS web app | Next.js | Next.js API routes / Fastify | PostgreSQL + Redis |
60
+ | Mobile app (cross-platform) | React Native (Expo) | Node.js API | PostgreSQL |
61
+ | Internal dashboard / admin | Next.js | Next.js API routes | Existing |
62
+ | Real-time (chat, collaboration) | Next.js | Fastify + WebSockets | PostgreSQL + Redis |
63
+ | Data-heavy API | — | FastAPI (Python) | PostgreSQL |
64
+ | AI assistant / RAG app | Next.js (streaming) | Fastify + LLM SDK | PostgreSQL + pgvector |
65
+ | Edge-global, latency-critical | Next.js | Hono (Cloudflare Workers) | Turso / Cloudflare KV |
66
+
67
+ **If unclear:** Next.js + PostgreSQL covers 80% of use cases and is the safest default for web apps.
68
+
69
+ ---
70
+
71
+ ## AI-Native App Orchestration
72
+
73
+ For RAG apps and AI assistants, the build order changes:
60
74
 
61
75
  ```
62
- User: "Make an Instagram clone with photo sharing and likes"
76
+ Step 1: vector-database-architect
77
+ → Design the embedding schema and chunking strategy
78
+ → Output: schema with vector column + indexing strategy
79
+
80
+ Step 2: ingest-pipeline (backend-specialist)
81
+ → Build document ingestion: load → chunk → embed → store
82
+ → Output: ingest API endpoint
63
83
 
64
- App Builder Process:
65
- 1. Project type: Social Media App
66
- 2. Tech stack: Next.js + Prisma + Cloudinary + Clerk
67
- 3. Create plan:
68
- ├─ Database schema (users, posts, likes, follows)
69
- ├─ API routes (12 endpoints)
70
- ├─ Pages (feed, profile, upload)
71
- └─ Components (PostCard, Feed, LikeButton)
72
- 4. Coordinate agents
73
- 5. Report progress
74
- 6. Start preview
84
+ Step 3: retrieval-api (backend-specialist, uses Steps 1+2)
85
+ Build: embed query → vector search → rerank → prompt assembly
86
+ Output: /api/generate endpoint with SSE streaming
87
+
88
+ Step 4: streaming-frontend (frontend-specialist, uses Step 3)
89
+ Build: EventSource consumer → streaming text UI → loading states
90
+ Output: AI chat or search interface
75
91
  ```
92
+
93
+ **Never wire the frontend to the LLM directly** — always proxy through your backend to keep API keys server-side.
94
+
95
+ ---
96
+
97
+ ## Phase 3 — Project Structure
98
+
99
+ **Web (Next.js):**
100
+
101
+ ```
102
+ app/
103
+ (auth)/ Auth pages — login, register
104
+ (app)/ Protected app routes
105
+ api/ API routes
106
+ components/
107
+ ui/ Primitive components (button, input, modal)
108
+ features/ Feature-specific components
109
+ lib/
110
+ db/ Database client and utilities
111
+ auth/ Auth helpers
112
+ utils/ Shared utilities
113
+ ```
114
+
115
+ **API-only (Node.js / Fastify):**
116
+
117
+ ```
118
+ src/
119
+ routes/ Route definitions (thin)
120
+ handlers/ Request handling and response formatting
121
+ services/ Business logic
122
+ repositories/ Database access
123
+ lib/ Shared utilities
124
+ ```
125
+
126
+ ---
127
+
128
+ ## Phase 4 — Agent Coordination
129
+
130
+ Build in dependency order:
131
+
132
+ ```
133
+ Step 1: database-architect
134
+ → Design and document the schema
135
+ → Output: SQL schema, type definitions
136
+
137
+ Step 2: backend-specialist (uses schema from Step 1)
138
+ → Build API routes
139
+ → Output: API endpoint spec (URL, method, request, response shapes)
140
+
141
+ Step 3: frontend-specialist (uses API spec from Step 2)
142
+ → Build UI components
143
+ → Connect to real API contracts
144
+ → Output: Working pages
145
+
146
+ Step 4: test-engineer (uses all of the above)
147
+ → Create integration and E2E tests
148
+ → Output: Test suite
149
+ ```
150
+
151
+ **Never run Step 2 against a guessed schema. Never run Step 3 against a guessed API.**
152
+
153
+ ---
154
+
155
+ ## Phase 5 — Integration Verification
156
+
157
+ Before presenting to the user, verify consistency:
158
+
159
+ - API endpoints the frontend calls → exist on the backend
160
+ - Database column names the backend queries → exist in the schema
161
+ - TypeScript types match across package boundaries
162
+ - Environment variables referenced in code → are in `.env.example`
163
+
164
+ ---
165
+
166
+ ## Phase 6 — Preview Launch
167
+
168
+ After integration verification, start the dev server:
169
+
170
+ ```bash
171
+ # Check for dev script
172
+ python .agent/scripts/auto_preview.py start
173
+
174
+ # Or manually
175
+ npm run dev
176
+ ```
177
+
178
+ Report the URL to the user.
179
+
180
+ ---
181
+
182
+ ## Template Index
183
+
184
+ | Template | Path | When to Use |
185
+ |---|---|---|
186
+ | Next.js Full-Stack | `templates/nextjs-app/` | Web app with API routes |
187
+ | React Native | `templates/react-native-app/` | Cross-platform mobile |
188
+ | API Only | `templates/api-only/` | Backend service, no UI |
189
+
190
+ ---
191
+
192
+ ## Output Format
193
+
194
+ When this skill produces a recommendation or design decision, structure your output as:
195
+
196
+ ```
197
+ ━━━ App Builder Recommendation ━━━━━━━━━━━━━━━━
198
+ Decision: [what was chosen / proposed]
199
+ Rationale: [why — one concise line]
200
+ Trade-offs: [what is consciously accepted]
201
+ Next action: [concrete next step for the user]
202
+ ─────────────────────────────────────────────────
203
+ Pre-Flight: ✅ All checks passed
204
+ or ❌ [blocking item that must be resolved first]
205
+ ```
206
+
207
+
208
+ ---
209
+
210
+ ## 🏛️ Tribunal Integration (Anti-Hallucination)
211
+
212
+ **Slash command: `/create`**
213
+ **Active reviewers: `orchestrator` · `project-planner`**
214
+
215
+ ### ❌ Forbidden AI Tropes in App Building
216
+
217
+ 1. **Skipping Constraints** — immediately starting to generate code without asking the user about their constraints and audience.
218
+ 2. **Building the Whole App at Once** — attempting to generate 50 files in a single turn.
219
+ 3. **Out-of-Order Execution** — writing frontend components before the API or DB schema is actually designed.
220
+ 4. **Magic Dependencies** — assuming packages are installed without updating `package.json`.
221
+ 5. **Ignoring Boundaries** — mismatching the API response format between the server and the frontend client.
222
+
223
+ ### ✅ Pre-Flight Self-Audit
224
+
225
+ Review these questions before orchestrating a full app build:
226
+ ```
227
+ ✅ Did I ask the clarifying questions regarding constraints and target audience?
228
+ ✅ Is my generated plan broken into modular, sequenced steps (DB -> API -> UI)?
229
+ ✅ Have I explicitly defined the API contracts so the frontend and backend match?
230
+ ✅ Did I correctly track which dependencies need to be installed?
231
+ ✅ Am I verifying integration at each boundary before moving to the next layer?
232
+ ```
233
+
234
+ ### 🛑 Verification-Before-Completion (VBC) Protocol
235
+
236
+ **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
237
+ - ❌ **Forbidden:** Declaring an application architecture or full-stack integration complete without verifying the seams.
238
+ - ✅ **Required:** You are explicitly forbidden from completing an app build or integration phase without providing **concrete terminal evidence** (e.g., successful local dev server start logs, passing build logs, or successful API local test results).