tribunal-kit 3.0.0 → 4.0.0

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 (233) hide show
  1. package/.agent/ARCHITECTURE.md +99 -99
  2. package/.agent/GEMINI.md +52 -52
  3. package/.agent/agents/accessibility-reviewer.md +187 -220
  4. package/.agent/agents/ai-code-reviewer.md +199 -233
  5. package/.agent/agents/backend-specialist.md +215 -238
  6. package/.agent/agents/code-archaeologist.md +161 -181
  7. package/.agent/agents/database-architect.md +184 -207
  8. package/.agent/agents/debugger.md +191 -218
  9. package/.agent/agents/dependency-reviewer.md +103 -136
  10. package/.agent/agents/devops-engineer.md +218 -238
  11. package/.agent/agents/documentation-writer.md +201 -221
  12. package/.agent/agents/explorer-agent.md +160 -180
  13. package/.agent/agents/frontend-reviewer.md +160 -194
  14. package/.agent/agents/frontend-specialist.md +248 -237
  15. package/.agent/agents/game-developer.md +48 -52
  16. package/.agent/agents/logic-reviewer.md +116 -149
  17. package/.agent/agents/mobile-developer.md +200 -223
  18. package/.agent/agents/mobile-reviewer.md +162 -195
  19. package/.agent/agents/orchestrator.md +181 -211
  20. package/.agent/agents/penetration-tester.md +157 -174
  21. package/.agent/agents/performance-optimizer.md +183 -203
  22. package/.agent/agents/performance-reviewer.md +178 -211
  23. package/.agent/agents/precedence-reviewer.md +213 -0
  24. package/.agent/agents/product-manager.md +142 -162
  25. package/.agent/agents/product-owner.md +6 -25
  26. package/.agent/agents/project-planner.md +142 -162
  27. package/.agent/agents/qa-automation-engineer.md +225 -242
  28. package/.agent/agents/security-auditor.md +174 -194
  29. package/.agent/agents/seo-specialist.md +193 -213
  30. package/.agent/agents/sql-reviewer.md +161 -194
  31. package/.agent/agents/supervisor-agent.md +184 -203
  32. package/.agent/agents/swarm-worker-contracts.md +17 -17
  33. package/.agent/agents/swarm-worker-registry.md +46 -46
  34. package/.agent/agents/test-coverage-reviewer.md +160 -193
  35. package/.agent/agents/test-engineer.md +0 -21
  36. package/.agent/agents/type-safety-reviewer.md +175 -208
  37. package/.agent/patterns/generator.md +9 -9
  38. package/.agent/patterns/inversion.md +12 -12
  39. package/.agent/patterns/pipeline.md +9 -9
  40. package/.agent/patterns/reviewer.md +13 -13
  41. package/.agent/patterns/tool-wrapper.md +9 -9
  42. package/.agent/rules/GEMINI.md +63 -63
  43. package/.agent/scripts/append_flow.js +72 -0
  44. package/.agent/scripts/case_law_manager.py +525 -0
  45. package/.agent/scripts/compress_skills.py +167 -0
  46. package/.agent/scripts/consolidate_skills.py +173 -0
  47. package/.agent/scripts/deep_compress.py +202 -0
  48. package/.agent/scripts/minify_context.py +80 -0
  49. package/.agent/scripts/security_scan.py +1 -1
  50. package/.agent/scripts/skill_evolution.py +563 -0
  51. package/.agent/scripts/strip_tribunal.py +41 -0
  52. package/.agent/skills/agent-organizer/SKILL.md +100 -126
  53. package/.agent/skills/agentic-patterns/SKILL.md +0 -70
  54. package/.agent/skills/ai-prompt-injection-defense/SKILL.md +134 -160
  55. package/.agent/skills/api-patterns/SKILL.md +123 -215
  56. package/.agent/skills/api-security-auditor/SKILL.md +143 -177
  57. package/.agent/skills/app-builder/SKILL.md +334 -50
  58. package/.agent/skills/app-builder/templates/SKILL.md +13 -15
  59. package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +16 -16
  60. package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +22 -22
  61. package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +18 -18
  62. package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +20 -20
  63. package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +17 -17
  64. package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +18 -18
  65. package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +21 -21
  66. package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +19 -19
  67. package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +26 -26
  68. package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +26 -26
  69. package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +19 -19
  70. package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +18 -18
  71. package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +20 -20
  72. package/.agent/skills/appflow-wireframe/SKILL.md +95 -121
  73. package/.agent/skills/architecture/SKILL.md +169 -331
  74. package/.agent/skills/authentication-best-practices/SKILL.md +139 -173
  75. package/.agent/skills/bash-linux/SKILL.md +129 -154
  76. package/.agent/skills/behavioral-modes/SKILL.md +8 -69
  77. package/.agent/skills/brainstorming/SKILL.md +436 -104
  78. package/.agent/skills/building-native-ui/SKILL.md +152 -174
  79. package/.agent/skills/clean-code/SKILL.md +331 -360
  80. package/.agent/skills/code-review-checklist/SKILL.md +0 -62
  81. package/.agent/skills/config-validator/SKILL.md +115 -141
  82. package/.agent/skills/csharp-developer/SKILL.md +468 -528
  83. package/.agent/skills/database-design/SKILL.md +104 -369
  84. package/.agent/skills/deployment-procedures/SKILL.md +119 -145
  85. package/.agent/skills/devops-engineer/SKILL.md +295 -332
  86. package/.agent/skills/devops-incident-responder/SKILL.md +87 -113
  87. package/.agent/skills/doc.md +5 -5
  88. package/.agent/skills/documentation-templates/SKILL.md +27 -63
  89. package/.agent/skills/edge-computing/SKILL.md +131 -157
  90. package/.agent/skills/extract-design-system/SKILL.md +108 -134
  91. package/.agent/skills/framer-motion-expert/SKILL.md +111 -855
  92. package/.agent/skills/frontend-design/SKILL.md +151 -499
  93. package/.agent/skills/game-design-expert/SKILL.md +79 -105
  94. package/.agent/skills/game-engineering-expert/SKILL.md +96 -122
  95. package/.agent/skills/geo-fundamentals/SKILL.md +97 -124
  96. package/.agent/skills/github-operations/SKILL.md +279 -314
  97. package/.agent/skills/gsap-expert/SKILL.md +119 -826
  98. package/.agent/skills/i18n-localization/SKILL.md +113 -138
  99. package/.agent/skills/intelligent-routing/SKILL.md +167 -127
  100. package/.agent/skills/lint-and-validate/SKILL.md +16 -52
  101. package/.agent/skills/llm-engineering/SKILL.md +344 -357
  102. package/.agent/skills/local-first/SKILL.md +128 -154
  103. package/.agent/skills/mcp-builder/SKILL.md +92 -118
  104. package/.agent/skills/mobile-design/SKILL.md +213 -219
  105. package/.agent/skills/motion-engineering/SKILL.md +184 -0
  106. package/.agent/skills/nextjs-react-expert/SKILL.md +99 -698
  107. package/.agent/skills/nodejs-best-practices/SKILL.md +498 -559
  108. package/.agent/skills/observability/SKILL.md +293 -330
  109. package/.agent/skills/parallel-agents/SKILL.md +96 -122
  110. package/.agent/skills/performance-profiling/SKILL.md +217 -254
  111. package/.agent/skills/plan-writing/SKILL.md +92 -118
  112. package/.agent/skills/platform-engineer/SKILL.md +97 -123
  113. package/.agent/skills/playwright-best-practices/SKILL.md +137 -162
  114. package/.agent/skills/powershell-windows/SKILL.md +112 -146
  115. package/.agent/skills/project-idioms/SKILL.md +87 -0
  116. package/.agent/skills/python-patterns/SKILL.md +15 -35
  117. package/.agent/skills/python-pro/SKILL.md +148 -754
  118. package/.agent/skills/react-specialist/SKILL.md +123 -827
  119. package/.agent/skills/readme-builder/SKILL.md +23 -85
  120. package/.agent/skills/realtime-patterns/SKILL.md +269 -304
  121. package/.agent/skills/red-team-tactics/SKILL.md +18 -51
  122. package/.agent/skills/rust-pro/SKILL.md +623 -701
  123. package/.agent/skills/seo-fundamentals/SKILL.md +129 -154
  124. package/.agent/skills/server-management/SKILL.md +164 -190
  125. package/.agent/skills/shadcn-ui-expert/SKILL.md +181 -206
  126. package/.agent/skills/skill-creator/SKILL.md +24 -56
  127. package/.agent/skills/sql-pro/SKILL.md +579 -633
  128. package/.agent/skills/supabase-postgres-best-practices/SKILL.md +35 -66
  129. package/.agent/skills/swiftui-expert/SKILL.md +151 -176
  130. package/.agent/skills/systematic-debugging/SKILL.md +92 -118
  131. package/.agent/skills/tailwind-patterns/SKILL.md +516 -576
  132. package/.agent/skills/tdd-workflow/SKILL.md +111 -137
  133. package/.agent/skills/test-result-analyzer/SKILL.md +33 -73
  134. package/.agent/skills/testing-patterns/SKILL.md +512 -573
  135. package/.agent/skills/trend-researcher/SKILL.md +30 -71
  136. package/.agent/skills/ui-ux-pro-max/SKILL.md +8 -41
  137. package/.agent/skills/ui-ux-researcher/SKILL.md +51 -91
  138. package/.agent/skills/vue-expert/SKILL.md +127 -866
  139. package/.agent/skills/vulnerability-scanner/SKILL.md +354 -269
  140. package/.agent/skills/web-accessibility-auditor/SKILL.md +168 -193
  141. package/.agent/skills/web-design-guidelines/SKILL.md +25 -61
  142. package/.agent/skills/webapp-testing/SKILL.md +119 -145
  143. package/.agent/skills/whimsy-injector/SKILL.md +58 -132
  144. package/.agent/skills/workflow-optimizer/SKILL.md +28 -68
  145. package/.agent/workflows/api-tester.md +151 -151
  146. package/.agent/workflows/audit.md +127 -138
  147. package/.agent/workflows/brainstorm.md +110 -110
  148. package/.agent/workflows/changelog.md +112 -112
  149. package/.agent/workflows/create.md +124 -124
  150. package/.agent/workflows/debug.md +165 -189
  151. package/.agent/workflows/deploy.md +180 -189
  152. package/.agent/workflows/enhance.md +128 -151
  153. package/.agent/workflows/fix.md +114 -135
  154. package/.agent/workflows/generate.md +13 -4
  155. package/.agent/workflows/migrate.md +160 -160
  156. package/.agent/workflows/orchestrate.md +168 -168
  157. package/.agent/workflows/performance-benchmarker.md +114 -123
  158. package/.agent/workflows/plan.md +173 -173
  159. package/.agent/workflows/preview.md +80 -80
  160. package/.agent/workflows/refactor.md +161 -183
  161. package/.agent/workflows/review-ai.md +101 -129
  162. package/.agent/workflows/review.md +116 -116
  163. package/.agent/workflows/session.md +94 -94
  164. package/.agent/workflows/status.md +79 -79
  165. package/.agent/workflows/strengthen-skills.md +138 -139
  166. package/.agent/workflows/swarm.md +179 -179
  167. package/.agent/workflows/test.md +189 -211
  168. package/.agent/workflows/tribunal-backend.md +94 -113
  169. package/.agent/workflows/tribunal-database.md +95 -115
  170. package/.agent/workflows/tribunal-frontend.md +96 -118
  171. package/.agent/workflows/tribunal-full.md +93 -133
  172. package/.agent/workflows/tribunal-mobile.md +95 -119
  173. package/.agent/workflows/tribunal-performance.md +110 -133
  174. package/.agent/workflows/ui-ux-pro-max.md +122 -143
  175. package/README.md +30 -1
  176. package/bin/tribunal-kit.js +175 -12
  177. package/package.json +25 -4
  178. package/.agent/skills/api-patterns/api-style.md +0 -42
  179. package/.agent/skills/api-patterns/auth.md +0 -24
  180. package/.agent/skills/api-patterns/documentation.md +0 -26
  181. package/.agent/skills/api-patterns/graphql.md +0 -41
  182. package/.agent/skills/api-patterns/rate-limiting.md +0 -31
  183. package/.agent/skills/api-patterns/response.md +0 -37
  184. package/.agent/skills/api-patterns/rest.md +0 -40
  185. package/.agent/skills/api-patterns/security-testing.md +0 -122
  186. package/.agent/skills/api-patterns/trpc.md +0 -41
  187. package/.agent/skills/api-patterns/versioning.md +0 -22
  188. package/.agent/skills/app-builder/agent-coordination.md +0 -71
  189. package/.agent/skills/app-builder/feature-building.md +0 -53
  190. package/.agent/skills/app-builder/project-detection.md +0 -34
  191. package/.agent/skills/app-builder/scaffolding.md +0 -118
  192. package/.agent/skills/app-builder/tech-stack.md +0 -40
  193. package/.agent/skills/architecture/context-discovery.md +0 -43
  194. package/.agent/skills/architecture/examples.md +0 -94
  195. package/.agent/skills/architecture/pattern-selection.md +0 -68
  196. package/.agent/skills/architecture/patterns-reference.md +0 -50
  197. package/.agent/skills/architecture/trade-off-analysis.md +0 -77
  198. package/.agent/skills/brainstorming/dynamic-questioning.md +0 -360
  199. package/.agent/skills/database-design/database-selection.md +0 -43
  200. package/.agent/skills/database-design/indexing.md +0 -39
  201. package/.agent/skills/database-design/migrations.md +0 -48
  202. package/.agent/skills/database-design/optimization.md +0 -36
  203. package/.agent/skills/database-design/orm-selection.md +0 -30
  204. package/.agent/skills/database-design/schema-design.md +0 -56
  205. package/.agent/skills/frontend-design/animation-guide.md +0 -331
  206. package/.agent/skills/frontend-design/color-system.md +0 -329
  207. package/.agent/skills/frontend-design/decision-trees.md +0 -418
  208. package/.agent/skills/frontend-design/motion-graphics.md +0 -306
  209. package/.agent/skills/frontend-design/typography-system.md +0 -363
  210. package/.agent/skills/frontend-design/ux-psychology.md +0 -1116
  211. package/.agent/skills/frontend-design/visual-effects.md +0 -383
  212. package/.agent/skills/intelligent-routing/router-manifest.md +0 -65
  213. package/.agent/skills/mobile-design/decision-trees.md +0 -516
  214. package/.agent/skills/mobile-design/mobile-backend.md +0 -491
  215. package/.agent/skills/mobile-design/mobile-color-system.md +0 -420
  216. package/.agent/skills/mobile-design/mobile-debugging.md +0 -122
  217. package/.agent/skills/mobile-design/mobile-design-thinking.md +0 -357
  218. package/.agent/skills/mobile-design/mobile-navigation.md +0 -458
  219. package/.agent/skills/mobile-design/mobile-performance.md +0 -767
  220. package/.agent/skills/mobile-design/mobile-testing.md +0 -356
  221. package/.agent/skills/mobile-design/mobile-typography.md +0 -433
  222. package/.agent/skills/mobile-design/platform-android.md +0 -666
  223. package/.agent/skills/mobile-design/platform-ios.md +0 -561
  224. package/.agent/skills/mobile-design/touch-psychology.md +0 -537
  225. package/.agent/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +0 -312
  226. package/.agent/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +0 -240
  227. package/.agent/skills/nextjs-react-expert/3-server-server-side-performance.md +0 -490
  228. package/.agent/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +0 -264
  229. package/.agent/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +0 -581
  230. package/.agent/skills/nextjs-react-expert/6-rendering-rendering-performance.md +0 -432
  231. package/.agent/skills/nextjs-react-expert/7-js-javascript-performance.md +0 -684
  232. package/.agent/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +0 -150
  233. package/.agent/skills/vulnerability-scanner/checklists.md +0 -121
@@ -1,77 +0,0 @@
1
- # Trade-off Analysis & ADR
2
-
3
- > Document every architectural decision with trade-offs.
4
-
5
- ## Decision Framework
6
-
7
- For EACH architectural component, document:
8
-
9
- ```markdown
10
- ## Architecture Decision Record
11
-
12
- ### Context
13
- - **Problem**: [What problem are we solving?]
14
- - **Constraints**: [Team size, scale, timeline, budget]
15
-
16
- ### Options Considered
17
-
18
- | Option | Pros | Cons | Complexity | When Valid |
19
- |--------|------|------|------------|-----------|
20
- | Option A | Benefit 1 | Cost 1 | Low | [Conditions] |
21
- | Option B | Benefit 2 | Cost 2 | High | [Conditions] |
22
-
23
- ### Decision
24
- **Chosen**: [Option B]
25
-
26
- ### Rationale
27
- 1. [Reason 1 - tied to constraints]
28
- 2. [Reason 2 - tied to requirements]
29
-
30
- ### Trade-offs Accepted
31
- - [What we're giving up]
32
- - [Why this is acceptable]
33
-
34
- ### Consequences
35
- - **Positive**: [Benefits we gain]
36
- - **Negative**: [Costs/risks we accept]
37
- - **Mitigation**: [How we'll address negatives]
38
-
39
- ### Revisit Trigger
40
- - [When to reconsider this decision]
41
- ```
42
-
43
- ## ADR Template
44
-
45
- ```markdown
46
- # ADR-[XXX]: [Decision Title]
47
-
48
- ## Status
49
- Proposed | Accepted | Deprecated | Superseded by [ADR-YYY]
50
-
51
- ## Context
52
- [What problem? What constraints?]
53
-
54
- ## Decision
55
- [What we chose - be specific]
56
-
57
- ## Rationale
58
- [Why - tie to requirements and constraints]
59
-
60
- ## Trade-offs
61
- [What we're giving up - be honest]
62
-
63
- ## Consequences
64
- - **Positive**: [Benefits]
65
- - **Negative**: [Costs]
66
- - **Mitigation**: [How to address]
67
- ```
68
-
69
- ## ADR Storage
70
-
71
- ```
72
- docs/
73
- └── architecture/
74
- ├── adr-001-use-nextjs.md
75
- ├── adr-002-postgresql-over-mongodb.md
76
- └── adr-003-adopt-repository-pattern.md
77
- ```
@@ -1,360 +0,0 @@
1
- # Dynamic Question Generation
2
-
3
- > **PRINCIPLE:** Questions are not about gathering data—they are about **revealing architectural consequences**.
4
- >
5
- > Every question must connect to a concrete implementation decision that affects cost, complexity, or timeline.
6
-
7
- ---
8
-
9
- ## 🧠 Core Principles
10
-
11
- ### 1. Questions Reveal Consequences
12
-
13
- A good question is not "What color do you want?" but:
14
-
15
- ```markdown
16
- ❌ BAD: "What authentication method?"
17
- ✅ GOOD: "Should users sign up with email/password or social login?
18
-
19
- Impact:
20
- - Email/Pass → Need password reset, hashing, 2FA infrastructure
21
- - Social → OAuth providers, user profile mapping, less control
22
-
23
- Trade-off: Security vs. Development time vs. User friction"
24
- ```
25
-
26
- ### 2. Context Before Content
27
-
28
- First understand **where** this request fits:
29
-
30
- | Context | Question Focus |
31
- |---------|----------------|
32
- | **Greenfield** (new project) | Foundation decisions: stack, hosting, scale |
33
- | **Feature Addition** | Integration points, existing patterns, breaking changes |
34
- | **Refactor** | Why refactor? Performance? Maintainability? What's broken? |
35
- | **Debug** | Symptoms → Root cause → Reproduction path |
36
-
37
- ### 3. Minimum Viable Questions
38
-
39
- **PRINCIPLE:** Each question must eliminate a fork in the implementation road.
40
-
41
- ```
42
- Before Question:
43
- ├── Path A: Do X (5 min)
44
- ├── Path B: Do Y (15 min)
45
- └── Path C: Do Z (1 hour)
46
-
47
- After Question:
48
- └── Path Confirmed: Do X (5 min)
49
- ```
50
-
51
- If a question doesn't reduce implementation paths → **DELETE IT**.
52
-
53
- ### 4. Questions Generate Data, Not Assumptions
54
-
55
- ```markdown
56
- ❌ ASSUMPTION: "User probably wants Stripe for payments"
57
- ✅ QUESTION: "Which payment provider fits your needs?
58
-
59
- Stripe → Best documentation, 2.9% + $0.30, US-centric
60
- LemonSqueezy → Merchant of Record, 5% + $0.50, global taxes
61
- Paddle → Complex pricing, handles EU VAT, enterprise focus"
62
- ```
63
-
64
- ---
65
-
66
- ## 📋 Question Generation Algorithm
67
-
68
- ```
69
- INPUT: User request + Context (greenfield/feature/refactor/debug)
70
-
71
- ├── STEP 1: Parse Request
72
- │ ├── Extract domain (ecommerce, auth, realtime, cms, etc.)
73
- │ ├── Extract features (explicit and implied)
74
- │ └── Extract scale indicators (users, data volume, frequency)
75
-
76
- ├── STEP 2: Identify Decision Points
77
- │ ├── What MUST be decided before coding? (blocking)
78
- │ ├── What COULD be decided later? (deferable)
79
- │ └── What has ARCHITECTURAL impact? (high-leverage)
80
-
81
- ├── STEP 3: Generate Questions (Priority Order)
82
- │ ├── P0: Blocking decisions (cannot proceed without answer)
83
- │ ├── P1: High-leverage (affects >30% of implementation)
84
- │ ├── P2: Medium-leverage (affects specific features)
85
- │ └── P3: Nice-to-have (edge cases, optimization)
86
-
87
- └── STEP 4: Format Each Question
88
- ├── What: Clear question
89
- ├── Why: Impact on implementation
90
- ├── Options: Trade-offs (not just A vs B)
91
- ├── Fun/Superpower Option: Inject at least one highly creative, unconventional approach
92
- └── Default: What happens if user doesn't answer
93
- ```
94
-
95
- ---
96
-
97
- ## 🎯 Domain-Specific Question Banks
98
-
99
- ### E-Commerce
100
-
101
- | Question | Why It Matters | Trade-offs |
102
- |----------|----------------|------------|
103
- | **Single or Multi-vendor?** | Multi-vendor → Commission logic, vendor dashboards, split payments | +Revenue, -Complexity |
104
- | **Inventory Tracking?** | Needs stock tables, reservation logic, low-stock alerts | +Accuracy, -Development time |
105
- | **Digital or Physical Products?** | Digital → Download links, no shipping | Physical → Shipping APIs, tracking |
106
- | **Subscription or One-time?** | Subscription → Recurring billing, dunning, proration | +Revenue, -Complexity |
107
-
108
- ### Authentication
109
-
110
- | Question | Why It Matters | Trade-offs |
111
- |----------|----------------|------------|
112
- | **Social Login Needed?** | OAuth providers vs. password reset infrastructure | +UX, -Control |
113
- | **Role-Based Permissions?** | RBAC tables, policy enforcement, admin UI | +Security, -Development time |
114
- | **2FA Required?** | TOTP/SMI infrastructure, backup codes, recovery flow | +Security, -UX friction |
115
- | **Email Verification?** | Verification tokens, email service, resend logic | +Security, -Sign-up friction |
116
-
117
- ### Real-time
118
-
119
- | Question | Why It Matters | Trade-offs |
120
- |----------|----------------|------------|
121
- | **WebSocket or Polling?** | WS → Server scaling, connection management | Polling → Simpler, higher latency |
122
- | **Expected Concurrent Users?** | <100 → Single server, >1000 → Redis pub/sub, >10k → specialized infra | +Scale, -Complexity |
123
- | **Message Persistence?** | History tables, storage costs, pagination | +UX, -Storage |
124
- | **Ephemeral or Durable?** | Ephemeral → In-memory, Durable → Database write before emit | +Reliability, -Latency |
125
-
126
- ### Content/CMS
127
-
128
- | Question | Why It Matters | Trade-offs |
129
- |----------|----------------|------------|
130
- | **Rich Text or Markdown?** | Rich Text → Sanitization, XSS risks | Markdown → Simple, no WYSIWYG |
131
- | **Draft/Publish Workflow?** | Status field, scheduled jobs, versioning | +Control, -Complexity |
132
- | **Media Handling?** | Upload endpoints, storage, optimization | +Features, -Development time |
133
- | **Multi-language?** | i18n tables, translation UI, fallback logic | +Reach, -Complexity |
134
-
135
- ### Business & Product Strategy
136
-
137
- | Question | Why It Matters | Trade-offs |
138
- |----------|----------------|------------|
139
- | **Monetization Approach?** | Freemium vs. Paywall vs. Ads affects user flow | +Revenue, -User Acquisition |
140
- | **Onboarding CRO?** | Wizard vs. self-serve dictates state management | +Activation, -Dev Time |
141
- | **Competitor Differentiator?** | Must highlight this UI feature above all else | +Standout, -Standardization |
142
- | **Marketing Psychology?** | FOMO (urgency) vs. Trust (social proof) layout | +Conversion, -Aesthetics |
143
-
144
- ---
145
-
146
- ## 📐 Dynamic Question Template
147
-
148
- ```markdown
149
- Based on your request for [DOMAIN] [FEATURE]:
150
-
151
- ## 🔴 CRITICAL (Blocking Decisions)
152
-
153
- ### 1. **[DECISION POINT]**
154
-
155
- **Question:** [Clear, specific question]
156
-
157
- **Why This Matters:**
158
- - [Explain architectural consequence]
159
- - [Affects: cost / complexity / timeline / scale]
160
-
161
- **Options:**
162
- | Option | Pros | Cons | Best For |
163
- |--------|------|------|----------|
164
- | A | [Advantage] | [Disadvantage] | [Use case] |
165
- | B | [Advantage] | [Disadvantage] | [Use case] |
166
-
167
- **If Not Specified:** [Default choice + rationale]
168
-
169
- ---
170
-
171
- ## 🟡 HIGH-LEVERAGE (Affects Implementation)
172
-
173
- ### 2. **[DECISION POINT]**
174
- [Same format]
175
-
176
- ---
177
-
178
- ## 🟢 NICE-TO-HAVE (Edge Cases)
179
-
180
- ### 3. **[DECISION POINT]**
181
- [Same format]
182
- ```
183
-
184
- ---
185
-
186
- ## 🔄 Iterative Questioning
187
-
188
- ### First Pass (3-5 Questions)
189
- Focus on **blocking decisions**. Don't proceed without answers.
190
-
191
- ### Second Pass (After Initial Implementation)
192
- As patterns emerge, ask:
193
- - "This feature implies [X]. Should we handle [edge case] now or defer?"
194
- - "We're using [Pattern A]. Should [Feature B] follow the same pattern?"
195
-
196
- ### Third Pass (Optimization)
197
- When functionality works:
198
- - "Performance bottleneck at [X]. Optimize now or acceptable for now?"
199
- - "Refactor [Y] for maintainability or ship as-is?"
200
-
201
- ---
202
-
203
- ## 🎭 Example: Full Question Generation
204
-
205
- ```
206
- USER REQUEST: "Build an Instagram clone"
207
-
208
- STEP 1: Parse
209
- ├── Domain: Social Media
210
- ├── Features: Photo sharing, engagement (likes/comments), user profiles
211
- ├── Implied: Feed, following, authentication
212
- └── Scale: Potentially high (social apps go viral)
213
-
214
- STEP 2: Decision Points
215
- ├── Blocking: Storage strategy, authentication method, feed type
216
- ├── High-leverage: Real-time notifications, data model complexity
217
- └── Deferable: Analytics, advanced search, reels/video
218
-
219
- STEP 3: Generate Questions (Priority)
220
-
221
- P0 (Blocking):
222
- 1. Storage Strategy → Affects architecture, cost, speed
223
- 2. Feed Algorithm → Affects database queries, complexity
224
- 3. Auth Method → Affects dev time, UX, security
225
-
226
- P1 (High-leverage):
227
- 4. Real-time Notifications → WebSocket vs polling
228
- 5. Media Processing → Client-side vs server-side optimization
229
-
230
- P2 (Deferable):
231
- 6. Story/Reels → Major feature creep, defer to v2
232
- 7. DM/Chat → Separate subsystem, defer to v2
233
-
234
- STEP 4: Format Output
235
- ```
236
-
237
- ---
238
-
239
- ## 📊 Generated Output (Example)
240
-
241
- ```
242
- Based on your Instagram clone request:
243
-
244
- ## 🔴 CRITICAL DECISIONS (Cannot Proceed Without Answers)
245
-
246
- ### 1. **Photo Storage Strategy**
247
-
248
- **Question:** Where will user photos be stored and served?
249
-
250
- **Why This Matters:**
251
- - Affects: Monthly hosting costs, page load speed, CDN complexity
252
- - High-volume social apps: 1000 users × 10 photos × 2MB = 20GB storage
253
-
254
- **Options:**
255
- | Option | Cost | Speed | Complexity | Best For |
256
- |--------|------|-------|------------|----------|
257
- | **Cloudinary** | $89/mo (25GB) | Fast (CDN) | Low | MVP, rapid launch |
258
- | **AWS S3 + CloudFront** | $0.023/GB | Fast (CDN) | Medium | Production, cost-optimized |
259
- | **Supabase Storage** | Free tier 1GB | Medium | Low | Small scale, simple |
260
- | **Local Storage** | Server cost | Slow | Low | Development only |
261
-
262
- **If Not Specified:** Cloudinary (balanced for MVP)
263
-
264
- ---
265
-
266
- ### 2. **Feed Algorithm Choice**
267
-
268
- **Question:** How should the main feed work?
269
-
270
- **Why This Matters:**
271
- - Affects: Database query complexity, caching strategy, development time
272
- - Algorithmic feeds require ML infrastructure, ranking signals
273
-
274
- **Options:**
275
- | Option | Complexity | Database Impact | Best For |
276
- |--------|------------|-----------------|----------|
277
- | **Chronological** | Low | Simple query | Early stage, transparency |
278
- | **Follow-Only** | Medium | JOIN with pagination | Most social apps |
279
- | **Algorithmic** | High | Pre-computed feed tables | Instagram competitor |
280
-
281
- **If Not Specified:** Follow-Only (balanced for social app)
282
-
283
- ---
284
-
285
- ### 3. **Authentication Approach**
286
-
287
- **Question:** How do users sign up and login?
288
-
289
- **Why This Matters:**
290
- - Affects: Development time (2-5 hours), security posture, UX friction
291
-
292
- **Options:**
293
- | Option | Dev Time | Security | UX | Best For |
294
- |--------|----------|----------|-----|----------|
295
- | **Email/Password** | 4-5 hrs | High (if 2FA) | Medium | Full control needed |
296
- | **Social Only** | 1-2 hrs | Provider-dependent | Smooth | B2C, rapid launch |
297
- | **Magic Link** | 2-3 hrs | Medium | Very smooth | Security-focused |
298
- | **Clerk/Auth0** | 1 hr | High | Smooth | Fastest to market |
299
-
300
- **If Not Specified:** Clerk (fastest for MVP)
301
-
302
- ---
303
-
304
- ## 🟡 HIGH-LEVERAGE (Affects Architecture)
305
-
306
- ### 4. **Real-time Notifications**
307
-
308
- **Question:** Do users need instant notifications for likes/comments?
309
-
310
- **Why This Matters:**
311
- - WebSocket adds infrastructure complexity (Redis pub/sub for scaling)
312
- - Polling is simpler but higher latency
313
-
314
- **Options:**
315
- | Option | Complexity | Scale Cost | Best For |
316
- |--------|------------|------------|----------|
317
- | **WebSocket + Redis** | High | $10+/mo | >1000 concurrent users |
318
- | **Polling (30s)** | Low | DB queries | <1000 users |
319
- | **No Real-time** | None | None | MVP, validate first |
320
-
321
- **If Not Specified:** Polling for MVP (defer WebSocket until validated)
322
-
323
- ---
324
-
325
- ## 🟢 NICE-TO-HAVE (Defer to v2)
326
-
327
- ### 5. **Video/Reels Support**
328
- - Major complexity (video processing, streaming infrastructure)
329
- - Recommendation: Launch with photos only, add video after validation
330
-
331
- ### 6. **Direct Messaging**
332
- - Separate subsystem (chat infrastructure different from feed)
333
- - Recommendation: Use Pusher/Stream for real-time or defer entirely
334
-
335
- ---
336
-
337
- ## 📋 Summary
338
-
339
- | Decision | Recommendation | If Changed |
340
- |----------|----------------|------------|
341
- | Storage | Cloudinary | +3 hrs setup |
342
- | Feed | Follow-only | +2 hrs query optimization |
343
- | Auth | Clerk | -3 hrs dev time |
344
- | Real-time | Polling | +5 hrs WebSocket setup |
345
- | Video | Defer to v2 | N/A |
346
- | DM | Defer to v2 | N/A |
347
-
348
- **Total Estimated MVP Time:** 15-20 hours with recommendations above
349
- ```
350
-
351
- ---
352
-
353
- ## 🎯 Principles Recap
354
-
355
- 1. **Every question = Architectural decision** → Not data gathering
356
- 2. **Show trade-offs** → User understands consequences
357
- 3. **Prioritize blocking decisions** → Cannot proceed without
358
- 4. **Provide defaults** → If user doesn't answer, we proceed anyway
359
- 5. **Domain-aware** → Ecommerce questions ≠ Auth questions ≠ Real-time questions
360
- 6. **Iterative** → More questions as patterns emerge during implementation
@@ -1,43 +0,0 @@
1
- # Database Selection (2025)
2
-
3
- > Choose database based on context, not default.
4
-
5
- ## Decision Tree
6
-
7
- ```
8
- What are your requirements?
9
-
10
- ├── Full relational features needed
11
- │ ├── Self-hosted → PostgreSQL
12
- │ └── Serverless → Neon, Supabase
13
-
14
- ├── Edge deployment / Ultra-low latency
15
- │ └── Turso (edge SQLite)
16
-
17
- ├── AI / Vector search
18
- │ └── PostgreSQL + pgvector
19
-
20
- ├── Simple / Embedded / Local
21
- │ └── SQLite
22
-
23
- └── Global distribution
24
- └── PlanetScale, CockroachDB, Turso
25
- ```
26
-
27
- ## Comparison
28
-
29
- | Database | Best For | Trade-offs |
30
- |----------|----------|------------|
31
- | **PostgreSQL** | Full features, complex queries | Needs hosting |
32
- | **Neon** | Serverless PG, branching | PG complexity |
33
- | **Turso** | Edge, low latency | SQLite limitations |
34
- | **SQLite** | Simple, embedded, local | Single-writer |
35
- | **PlanetScale** | MySQL, global scale | No foreign keys |
36
-
37
- ## Questions to Ask
38
-
39
- 1. What's the deployment environment?
40
- 2. How complex are the queries?
41
- 3. Is edge/serverless important?
42
- 4. Vector search needed?
43
- 5. Global distribution required?
@@ -1,39 +0,0 @@
1
- # Indexing Principles
2
-
3
- > When and how to create indexes effectively.
4
-
5
- ## When to Create Indexes
6
-
7
- ```
8
- Index these:
9
- ├── Columns in WHERE clauses
10
- ├── Columns in JOIN conditions
11
- ├── Columns in ORDER BY
12
- ├── Foreign key columns
13
- └── Unique constraints
14
-
15
- Don't over-index:
16
- ├── Write-heavy tables (slower inserts)
17
- ├── Low-cardinality columns
18
- ├── Columns rarely queried
19
- ```
20
-
21
- ## Index Type Selection
22
-
23
- | Type | Use For |
24
- |------|---------|
25
- | **B-tree** | General purpose, equality & range |
26
- | **Hash** | Equality only, faster |
27
- | **GIN** | JSONB, arrays, full-text |
28
- | **GiST** | Geometric, range types |
29
- | **HNSW/IVFFlat** | Vector similarity (pgvector) |
30
-
31
- ## Composite Index Principles
32
-
33
- ```
34
- Order matters for composite indexes:
35
- ├── Equality columns first
36
- ├── Range columns last
37
- ├── Most selective first
38
- └── Match query pattern
39
- ```
@@ -1,48 +0,0 @@
1
- # Migration Principles
2
-
3
- > Safe migration strategy for zero-downtime changes.
4
-
5
- ## Safe Migration Strategy
6
-
7
- ```
8
- For zero-downtime changes:
9
-
10
- ├── Adding column
11
- │ └── Add as nullable → backfill → add NOT NULL
12
-
13
- ├── Removing column
14
- │ └── Stop using → deploy → remove column
15
-
16
- ├── Adding index
17
- │ └── CREATE INDEX CONCURRENTLY (non-blocking)
18
-
19
- └── Renaming column
20
- └── Add new → migrate data → deploy → drop old
21
- ```
22
-
23
- ## Migration Philosophy
24
-
25
- - Never make breaking changes in one step
26
- - Test migrations on data copy first
27
- - Have rollback plan
28
- - Run in transaction when possible
29
-
30
- ## Serverless Databases
31
-
32
- ### Neon (Serverless PostgreSQL)
33
-
34
- | Feature | Benefit |
35
- |---------|---------|
36
- | Scale to zero | Cost savings |
37
- | Instant branching | Dev/preview |
38
- | Full PostgreSQL | Compatibility |
39
- | Autoscaling | Traffic handling |
40
-
41
- ### Turso (Edge SQLite)
42
-
43
- | Feature | Benefit |
44
- |---------|---------|
45
- | Edge locations | Ultra-low latency |
46
- | SQLite compatible | Simple |
47
- | Generous free tier | Cost |
48
- | Global distribution | Performance |
@@ -1,36 +0,0 @@
1
- # Query Optimization
2
-
3
- > N+1 problem, EXPLAIN ANALYZE, optimization priorities.
4
-
5
- ## N+1 Problem
6
-
7
- ```
8
- What is N+1?
9
- ├── 1 query to get parent records
10
- ├── N queries to get related records
11
- └── Very slow!
12
-
13
- Solutions:
14
- ├── JOIN → Single query with all data
15
- ├── Eager loading → ORM handles JOIN
16
- ├── DataLoader → Batch and cache (GraphQL)
17
- └── Subquery → Fetch related in one query
18
- ```
19
-
20
- ## Query Analysis Mindset
21
-
22
- ```
23
- Before optimizing:
24
- ├── EXPLAIN ANALYZE the query
25
- ├── Look for Seq Scan (full table scan)
26
- ├── Check actual vs estimated rows
27
- └── Identify missing indexes
28
- ```
29
-
30
- ## Optimization Priorities
31
-
32
- 1. **Add missing indexes** (most common issue)
33
- 2. **Select only needed columns** (not SELECT *)
34
- 3. **Use proper JOINs** (avoid subqueries when possible)
35
- 4. **Limit early** (pagination at database level)
36
- 5. **Cache** (when appropriate)
@@ -1,30 +0,0 @@
1
- # ORM Selection (2025)
2
-
3
- > Choose ORM based on deployment and DX needs.
4
-
5
- ## Decision Tree
6
-
7
- ```
8
- What's the context?
9
-
10
- ├── Edge deployment / Bundle size matters
11
- │ └── Drizzle (smallest, SQL-like)
12
-
13
- ├── Best DX / Schema-first
14
- │ └── Prisma (migrations, studio)
15
-
16
- ├── Maximum control
17
- │ └── Raw SQL with query builder
18
-
19
- └── Python ecosystem
20
- └── SQLAlchemy 2.0 (async support)
21
- ```
22
-
23
- ## Comparison
24
-
25
- | ORM | Best For | Trade-offs |
26
- |-----|----------|------------|
27
- | **Drizzle** | Edge, TypeScript | Newer, less examples |
28
- | **Prisma** | DX, schema management | Heavier, not edge-ready |
29
- | **Kysely** | Type-safe SQL builder | Manual migrations |
30
- | **Raw SQL** | Complex queries, control | Manual type safety |
@@ -1,56 +0,0 @@
1
- # Schema Design Principles
2
-
3
- > Normalization, primary keys, timestamps, relationships.
4
-
5
- ## Normalization Decision
6
-
7
- ```
8
- When to normalize (separate tables):
9
- ├── Data is repeated across rows
10
- ├── Updates would need multiple changes
11
- ├── Relationships are clear
12
- └── Query patterns benefit
13
-
14
- When to denormalize (embed/duplicate):
15
- ├── Read performance critical
16
- ├── Data rarely changes
17
- ├── Always fetched together
18
- └── Simpler queries needed
19
- ```
20
-
21
- ## Primary Key Selection
22
-
23
- | Type | Use When |
24
- |------|----------|
25
- | **UUID** | Distributed systems, security |
26
- | **ULID** | UUID + sortable by time |
27
- | **Auto-increment** | Simple apps, single database |
28
- | **Natural key** | Rarely (business meaning) |
29
-
30
- ## Timestamp Strategy
31
-
32
- ```
33
- For every table:
34
- ├── created_at → When created
35
- ├── updated_at → Last modified
36
- └── deleted_at → Soft delete (if needed)
37
-
38
- Use TIMESTAMPTZ (with timezone) not TIMESTAMP
39
- ```
40
-
41
- ## Relationship Types
42
-
43
- | Type | When | Implementation |
44
- |------|------|----------------|
45
- | **One-to-One** | Extension data | Separate table with FK |
46
- | **One-to-Many** | Parent-children | FK on child table |
47
- | **Many-to-Many** | Both sides have many | Junction table |
48
-
49
- ## Foreign Key ON DELETE
50
-
51
- ```
52
- ├── CASCADE → Delete children with parent
53
- ├── SET NULL → Children become orphans
54
- ├── RESTRICT → Prevent delete if children exist
55
- └── SET DEFAULT → Children get default value
56
- ```