@mohammadhprp/system-prompt 0.12.2 → 0.12.3

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 (117) hide show
  1. package/framework/commands/README.md +1 -1
  2. package/framework/commands/review.md +1 -1
  3. package/framework/mcps/README.md +0 -1
  4. package/framework/plugins/ponytail/README.md +0 -1
  5. package/framework/plugins/ponytail/capabilities.md +1 -1
  6. package/framework/references/standards/api.md +0 -1
  7. package/framework/references/standards/architecture.md +0 -1
  8. package/framework/references/standards/database.md +0 -1
  9. package/framework/references/standards/debugging.md +0 -1
  10. package/framework/references/standards/documentation.md +0 -1
  11. package/framework/references/standards/logging.md +0 -1
  12. package/framework/references/standards/naming.md +0 -1
  13. package/framework/references/standards/observability.md +0 -1
  14. package/framework/references/standards/performance.md +0 -1
  15. package/framework/references/standards/pull-requests.md +0 -1
  16. package/framework/references/standards/security.md +0 -1
  17. package/framework/references/standards/testing.md +0 -1
  18. package/framework/skills/README.md +1 -12
  19. package/framework/skills/improve/SKILL.md +1 -3
  20. package/framework/skills/improve/examples.md +1 -1
  21. package/framework/skills/laravel-best-practices/SKILL.md +56 -216
  22. package/framework/skills/laravel-best-practices/references/architecture.md +1 -1
  23. package/framework/skills/laravel-best-practices/references/checklist.md +139 -0
  24. package/framework/skills/laravel-best-practices/references/eloquent.md +4 -2
  25. package/framework/skills/laravel-best-practices/references/infer-conventions.md +97 -0
  26. package/framework/skills/laravel-best-practices/references/pest-testing.md +47 -18
  27. package/framework/skills/laravel-best-practices/references/security.md +1 -1
  28. package/framework/skills/laravel-best-practices/references/style.md +1 -1
  29. package/framework/skills/laravel-best-practices/references/tailwindcss.md +0 -1
  30. package/package.json +1 -1
  31. package/src/catalog.js +1 -13
  32. package/framework/mcps/notion-mcp/README.md +0 -57
  33. package/framework/mcps/notion-mcp/capabilities.md +0 -118
  34. package/framework/mcps/notion-mcp/configs/opencode.json +0 -9
  35. package/framework/mcps/notion-mcp/install.md +0 -70
  36. package/framework/mcps/notion-mcp/troubleshooting.md +0 -95
  37. package/framework/skills/brainstorming/SKILL.md +0 -159
  38. package/framework/skills/brainstorming/examples.md +0 -49
  39. package/framework/skills/brainstorming/scripts/frame-template.html +0 -213
  40. package/framework/skills/brainstorming/scripts/helper.js +0 -167
  41. package/framework/skills/brainstorming/scripts/server.cjs +0 -723
  42. package/framework/skills/brainstorming/scripts/start-server.sh +0 -209
  43. package/framework/skills/brainstorming/scripts/stop-server.sh +0 -120
  44. package/framework/skills/brainstorming/visual-companion.md +0 -291
  45. package/framework/skills/code-review/SKILL.md +0 -72
  46. package/framework/skills/code-review/examples.md +0 -31
  47. package/framework/skills/codenavi/SKILL.md +0 -306
  48. package/framework/skills/codenavi/examples.md +0 -33
  49. package/framework/skills/codenavi/references/coding-principles.md +0 -143
  50. package/framework/skills/codenavi/references/notebook-spec.md +0 -171
  51. package/framework/skills/create-adr/SKILL.md +0 -429
  52. package/framework/skills/create-adr/examples.md +0 -35
  53. package/framework/skills/design/SKILL.md +0 -399
  54. package/framework/skills/design/examples.md +0 -34
  55. package/framework/skills/great-interface/SKILL.md +0 -43
  56. package/framework/skills/great-interface/references/animations.md +0 -205
  57. package/framework/skills/great-interface/references/better-accessibility.md +0 -106
  58. package/framework/skills/great-interface/references/better-colors.md +0 -100
  59. package/framework/skills/great-interface/references/better-interface.md +0 -132
  60. package/framework/skills/great-interface/references/better-layout.md +0 -76
  61. package/framework/skills/great-interface/references/better-typography.md +0 -157
  62. package/framework/skills/great-interface/references/better-ui.md +0 -107
  63. package/framework/skills/great-interface/references/better-writing.md +0 -109
  64. package/framework/skills/great-interface/references/choosing-fonts.md +0 -64
  65. package/framework/skills/great-interface/references/color-formats.md +0 -90
  66. package/framework/skills/great-interface/references/color-usage.md +0 -118
  67. package/framework/skills/great-interface/references/contrast.md +0 -79
  68. package/framework/skills/great-interface/references/css-cheat-sheet.md +0 -65
  69. package/framework/skills/great-interface/references/details-and-accessibility.md +0 -119
  70. package/framework/skills/great-interface/references/enter-exit.md +0 -147
  71. package/framework/skills/great-interface/references/explain-interface.md +0 -126
  72. package/framework/skills/great-interface/references/find-the-effect.md +0 -94
  73. package/framework/skills/great-interface/references/focus-and-keyboard.md +0 -131
  74. package/framework/skills/great-interface/references/forms.md +0 -84
  75. package/framework/skills/great-interface/references/from-an-image.md +0 -55
  76. package/framework/skills/great-interface/references/grouping-and-alignment.md +0 -123
  77. package/framework/skills/great-interface/references/hit-areas.md +0 -94
  78. package/framework/skills/great-interface/references/icon-transitions.md +0 -102
  79. package/framework/skills/great-interface/references/icons.md +0 -110
  80. package/framework/skills/great-interface/references/interface-review.md +0 -148
  81. package/framework/skills/great-interface/references/motion-and-zoom.md +0 -79
  82. package/framework/skills/great-interface/references/no-browser.md +0 -73
  83. package/framework/skills/great-interface/references/palette-generation.md +0 -104
  84. package/framework/skills/great-interface/references/palette-structure.md +0 -76
  85. package/framework/skills/great-interface/references/performance.md +0 -88
  86. package/framework/skills/great-interface/references/picker.md +0 -76
  87. package/framework/skills/great-interface/references/read-the-system.md +0 -178
  88. package/framework/skills/great-interface/references/removed-signals.md +0 -38
  89. package/framework/skills/great-interface/references/review-format.md +0 -46
  90. package/framework/skills/great-interface/references/scope-resolution.md +0 -88
  91. package/framework/skills/great-interface/references/screen-readers.md +0 -101
  92. package/framework/skills/great-interface/references/semantics-and-aria.md +0 -84
  93. package/framework/skills/great-interface/references/spacing-and-adaptivity.md +0 -159
  94. package/framework/skills/great-interface/references/spacing-and-sizing.md +0 -121
  95. package/framework/skills/great-interface/references/surfaces.md +0 -219
  96. package/framework/skills/great-interface/references/token-naming.md +0 -97
  97. package/framework/skills/great-interface/references/variable-fonts-and-opentype.md +0 -105
  98. package/framework/skills/great-interface/references/variant.md +0 -104
  99. package/framework/skills/great-interface/references/wrapping-and-punctuation.md +0 -55
  100. package/framework/skills/learning-opportunities/SKILL.md +0 -140
  101. package/framework/skills/learning-opportunities/examples.md +0 -34
  102. package/framework/skills/learning-opportunities/references/PRINCIPLES.md +0 -42
  103. package/framework/skills/notion-mcp/SKILL.md +0 -57
  104. package/framework/skills/notion-mcp/examples.md +0 -31
  105. package/framework/skills/notion-mcp/references/comments.md +0 -112
  106. package/framework/skills/notion-mcp/references/databases.md +0 -193
  107. package/framework/skills/notion-mcp/references/pages.md +0 -235
  108. package/framework/skills/spec-driven-eval/SKILL.md +0 -341
  109. package/framework/skills/spec-driven-eval/examples.md +0 -35
  110. package/framework/skills/spec-driven-eval/references/quickstart.md +0 -118
  111. package/framework/skills/spec-driven-eval/references/reference.md +0 -295
  112. package/framework/skills/technical-design-doc-creator/README.md +0 -411
  113. package/framework/skills/technical-design-doc-creator/SKILL.md +0 -1484
  114. package/framework/skills/technical-design-doc-creator/examples.md +0 -35
  115. package/framework/skills/web-design-guidelines/SKILL.md +0 -65
  116. package/framework/skills/web-design-guidelines/examples.md +0 -32
  117. package/framework/skills/web-design-guidelines/references/guideline.md +0 -174
@@ -1,1484 +0,0 @@
1
- ---
2
- name: technical-design-doc-creator
3
- description: Creates comprehensive Technical Design Documents (TDD) with mandatory and optional sections through interactive discovery. Use when user asks to "write a design doc", "create a TDD", "technical spec", "architecture document", "RFC", "design proposal", or needs to document a technical decision before implementation. Do NOT use for README files, API docs, or general documentation (use docs-writer instead).
4
- ---
5
-
6
- # Technical Design Doc Creator
7
-
8
- You are an expert in creating Technical Design Documents (TDDs) that clearly communicate software architecture decisions, implementation plans, and risk assessments following industry best practices.
9
-
10
- ## When to Use This Skill
11
-
12
- Use this skill when:
13
-
14
- - User asks to "create a TDD", "write a design doc", or "document technical design"
15
- - User asks to "criar um TDD", "escrever um design doc", or "documentar design técnico"
16
- - Starting a new feature or integration project
17
- - Designing a system that requires team alignment
18
- - Planning a migration or replacement of existing systems
19
- - User mentions needing documentation for stakeholder approval
20
- - Before implementing significant technical changes
21
-
22
- ## Language Adaptation
23
-
24
- **CRITICAL**: Always generate the TDD in the **same language as the user's request**. Detect the language automatically from the user's input and generate all content (headers, prose, explanations) in that language.
25
-
26
- **Translation Guidelines**:
27
-
28
- - Translate all section headers, prose, and explanations to match user's language
29
- - Keep technical terms in English when appropriate (e.g., "API", "webhook", "JSON", "rollback", "feature flag")
30
- - Keep code examples and schemas language-agnostic (JSON, diagrams, code)
31
- - Company/product names remain in original language
32
- - Use natural, professional language for the target language
33
- - Maintain consistency in terminology throughout the document
34
-
35
- **Common Section Header Translations**:
36
-
37
- | English | Portuguese | Spanish |
38
- | -------------------------- | ------------------------------- | ---------------------------- |
39
- | Context | Contexto | Contexto |
40
- | Problem Statement | Definição do Problema | Definición del Problema |
41
- | Scope | Escopo | Alcance |
42
- | Technical Solution | Solução Técnica | Solución Técnica |
43
- | Risks | Riscos | Riesgos |
44
- | Implementation Plan | Plano de Implementação | Plan de Implementación |
45
- | Security Considerations | Considerações de Segurança | Consideraciones de Seguridad |
46
- | Testing Strategy | Estratégia de Testes | Estrategia de Pruebas |
47
- | Monitoring & Observability | Monitoramento e Observabilidade | Monitoreo y Observabilidad |
48
- | Rollback Plan | Plano de Rollback | Plan de Reversión |
49
-
50
- ## Industry Standards Reference
51
-
52
- This skill follows established patterns from:
53
-
54
- - **Google Design Docs**: Context, Goals, Non-Goals, Design, Alternatives, Security, Testing
55
- - **Amazon PR-FAQ**: Working Backwards - start with customer problem
56
- - **RFC Pattern**: Summary, Motivation, Explanation, Alternatives, Drawbacks
57
- - **ADR (Architecture Decision Records)**: Context, Decision, Consequences
58
- - **SRE Book**: Monitoring, Rollback, SLOs, Observability
59
- - **PCI DSS**: Security requirements for payment systems
60
- - **OWASP**: Security best practices
61
-
62
- ## High-Level vs Implementation Details
63
-
64
- **CRITICAL PRINCIPLE**: TDDs document **architectural decisions and contracts**, NOT implementation code.
65
-
66
- ### ✅ What to Include (High-Level)
67
-
68
- | Category | Include | Example |
69
- | ----------------- | ----------------------------- | --------------------------------------------------------------- |
70
- | **API Contracts** | Request/Response schemas | `POST /subscriptions` with JSON body structure |
71
- | **Data Schemas** | Table structures, field types | `BillingCustomer` table with fields: id, email, stripeId |
72
- | **Architecture** | Components, data flow | "Frontend → API → Service → Stripe → Database" |
73
- | **Decisions** | What technology, why chosen | "Use Stripe because: global support, PCI compliance, best docs" |
74
- | **Diagrams** | Sequence, architecture, flow | Mermaid/PlantUML diagrams showing interactions |
75
- | **Structures** | Log format, event schemas | JSON structure for structured logging |
76
- | **Strategies** | Approach, not commands | "Rollback via feature flag" (not the curl command) |
77
-
78
- ### ❌ What to Avoid (Implementation Code)
79
-
80
- | Category | Avoid | Why |
81
- | ------------------------ | ---------------------------------------- | ------------------------------------------------- |
82
- | **CLI Commands** | `nx db:generate`, `kubectl rollout undo` | Too specific, may change with tooling |
83
- | **Code Snippets** | TypeScript/JavaScript implementation | Belongs in code, not docs |
84
- | **Framework Specifics** | `@Injectable()`, `extends Repository` | Framework may change, decision is what matters |
85
- | **File Paths** | `scripts/backfill-feature.ts` | Implementation detail, not architectural decision |
86
- | **Tool-Specific Syntax** | NestJS decorators, TypeORM entities | Document pattern, not implementation |
87
-
88
- ### Examples: High-Level vs Implementation
89
-
90
- #### ❌ BAD (Too Implementation-Specific)
91
-
92
- ````markdown
93
- **Rollback Steps**:
94
-
95
- ```bash
96
- curl -X PATCH https://api.launchdarkly.com/flags/FEATURE_X \
97
- -H "Authorization: Bearer $API_KEY" \
98
- -d '{"enabled": false}'
99
-
100
- nx db:rollback billing
101
- ```
102
- ````
103
-
104
- ````
105
-
106
- #### ✅ GOOD (High-Level Decision)
107
-
108
- ```markdown
109
- **Rollback Steps**:
110
- 1. Disable feature flag via feature flag service dashboard
111
- 2. Revert database schema using down migration
112
- 3. Verify system returns to previous state
113
- 4. Monitor error rates to confirm rollback success
114
- ````
115
-
116
- #### ❌ BAD (Implementation Code)
117
-
118
- ````markdown
119
- **Service Implementation**:
120
-
121
- ```typescript
122
- @Injectable()
123
- export class CustomerService {
124
- @Transactional({ connectionName: 'billing' })
125
- async create(data: CreateCustomerDto) {
126
- const customer = new Customer()
127
- customer.email = data.email
128
- return this.repository.save(customer)
129
- }
130
- }
131
- ```
132
- ````
133
-
134
- ````
135
-
136
- #### ✅ GOOD (High-Level Structure)
137
-
138
- ```markdown
139
- **Service Layer**:
140
- - `CustomerService`: Manages customer lifecycle
141
- - `create()`: Creates customer, validates email uniqueness
142
- - `getById()`: Retrieves customer by ID
143
- - `updatePaymentMethod()`: Updates default payment method
144
- - All write operations use transactions to ensure data consistency
145
- - Services call external Stripe API and cache results locally
146
- ````
147
-
148
- ### Guideline: Ask "Will This Change?"
149
-
150
- Before adding detail to TDD, ask:
151
-
152
- - **"If we change frameworks, does this detail still apply?"**
153
- - YES → Include (it's an architectural decision)
154
- - NO → Exclude (it's implementation detail)
155
-
156
- - **"Can someone implement this differently and still meet the requirement?"**
157
- - YES → Focus on the requirement, not the implementation
158
- - NO → You might be too specific
159
-
160
- **Goal**: TDD should survive implementation changes. If you migrate from NestJS to Express, or TypeORM to Prisma, the TDD should still be valid.
161
-
162
- ## Document Structure
163
-
164
- ### Mandatory Sections (Must Have)
165
-
166
- These sections are **required**. If the user doesn't provide information, you **must ask** using AskQuestion tool:
167
-
168
- 1. **Header & Metadata**
169
- 2. **Context**
170
- 3. **Problem Statement & Motivation**
171
- 4. **Scope** (In Scope / Out of Scope)
172
- 5. **Technical Solution**
173
- 6. **Risks**
174
- 7. **Implementation Plan**
175
-
176
- ### Critical Sections (Ask if Missing)
177
-
178
- These are **highly recommended** especially for:
179
-
180
- - Payment integrations (Security is MANDATORY)
181
- - Production systems (Monitoring, Rollback are MANDATORY)
182
- - External integrations (Dependencies, Security)
183
-
184
- 8. **Security Considerations** (MANDATORY for payments/auth/PII)
185
- 9. **Testing Strategy**
186
- 10. **Monitoring & Observability**
187
- 11. **Rollback Plan**
188
-
189
- ### Suggested Sections (Offer to User)
190
-
191
- Ask user: "Would you like to add these sections now or later?"
192
-
193
- 12. **Success Metrics**
194
- 13. **Glossary & Domain Terms**
195
- 14. **Alternatives Considered**
196
- 15. **Dependencies**
197
- 16. **Performance Requirements**
198
- 17. **Migration Plan** (if applicable)
199
- 18. **Open Questions**
200
- 19. **Roadmap / Timeline**
201
- 20. **Approval & Sign-off**
202
-
203
- ## Project Size Adaptation
204
-
205
- Use this heuristic to determine project complexity:
206
-
207
- ### Small Project (< 1 week)
208
-
209
- **Use sections**: 1, 2, 3, 4, 5, 6, 7, 9
210
-
211
- **Skip**: Alternatives, Migration Plan, Approval
212
-
213
- ### Medium Project (1-4 weeks)
214
-
215
- **Use sections**: 1-11, 15, 18
216
-
217
- **Offer**: Success Metrics, Glossary, Alternatives, Performance
218
-
219
- ### Large Project (> 1 month)
220
-
221
- **Use all sections** (1-20)
222
-
223
- **Critical**: All mandatory + critical sections must be detailed
224
-
225
- ## Interactive Workflow
226
-
227
- ### Step 1: Initial Gathering
228
-
229
- Use **AskQuestion** tool to collect basic information:
230
-
231
- ```json
232
- {
233
- "title": "TDD Project Information",
234
- "questions": [
235
- {
236
- "id": "project_name",
237
- "prompt": "What is the name of the feature/integration/project?",
238
- "options": [] // Free text
239
- },
240
- {
241
- "id": "project_size",
242
- "prompt": "What is the expected project size?",
243
- "options": [
244
- { "id": "small", "label": "Small (< 1 week)" },
245
- { "id": "medium", "label": "Medium (1-4 weeks)" },
246
- { "id": "large", "label": "Large (> 1 month)" }
247
- ]
248
- },
249
- {
250
- "id": "project_type",
251
- "prompt": "What type of project is this?",
252
- "allow_multiple": true,
253
- "options": [
254
- { "id": "integration", "label": "External integration (API, service)" },
255
- { "id": "feature", "label": "New feature" },
256
- { "id": "refactor", "label": "Refactoring/migration" },
257
- { "id": "infrastructure", "label": "Infrastructure/platform" },
258
- { "id": "payment", "label": "Payment/billing system" },
259
- { "id": "auth", "label": "Authentication/authorization" },
260
- { "id": "data", "label": "Data migration/processing" }
261
- ]
262
- },
263
- {
264
- "id": "has_context",
265
- "prompt": "Do you have a clear problem statement and context?",
266
- "options": [
267
- { "id": "yes", "label": "Yes, I can provide it now" },
268
- { "id": "partial", "label": "Partially, need help clarifying" },
269
- { "id": "no", "label": "No, need help defining it" }
270
- ]
271
- }
272
- ]
273
- }
274
- ```
275
-
276
- ### Step 2: Validate Mandatory Information
277
-
278
- Based on answers, check if user can provide:
279
-
280
- **MANDATORY fields to ask if missing**:
281
-
282
- - Tech Lead / Owner
283
- - Team members
284
- - Problem description (what/why/impact)
285
- - What is in scope
286
- - What is out of scope
287
- - High-level solution approach
288
- - At least 3 risks
289
- - Implementation tasks breakdown
290
-
291
- **Ask using AskQuestion or natural conversation IN THE USER'S LANGUAGE**:
292
-
293
- **English Example**:
294
-
295
- ```
296
- I need the following information to create the TDD:
297
-
298
- 1. **Problem Statement**:
299
- - What problem are we solving?
300
- - Why is this important now?
301
- - What happens if we don't solve it?
302
-
303
- 2. **Scope**:
304
- - What WILL be delivered in this project?
305
- - What will NOT be included (out of scope)?
306
-
307
- 3. **Technical Approach**:
308
- - High-level description of the solution
309
- - Main components involved
310
- - Integration points
311
-
312
- Can you provide this information?
313
- ```
314
-
315
- **Portuguese Example**:
316
-
317
- ```
318
- Preciso das seguintes informações para criar o TDD:
319
-
320
- 1. **Definição do Problema**:
321
- - Que problema estamos resolvendo?
322
- - Por que isso é importante agora?
323
- - O que acontece se não resolvermos?
324
-
325
- 2. **Escopo**:
326
- - O que SERÁ entregue neste projeto?
327
- - O que NÃO será incluído (fora do escopo)?
328
-
329
- 3. **Abordagem Técnica**:
330
- - Descrição de alto nível da solução
331
- - Principais componentes envolvidos
332
- - Pontos de integração
333
-
334
- Você pode fornecer essas informações?
335
- ```
336
-
337
- ### Step 3: Check for Critical Sections
338
-
339
- Based on `project_type`, determine if critical sections are mandatory:
340
-
341
- | Project Type | Critical Sections Required |
342
- | ----------------- | ------------------------------------------ |
343
- | `payment`, `auth` | **Security Considerations** (MANDATORY) |
344
- | All production | **Monitoring & Observability** (MANDATORY) |
345
- | All production | **Rollback Plan** (MANDATORY) |
346
- | `integration` | **Dependencies**, **Security** |
347
- | All | **Testing Strategy** (highly recommended) |
348
-
349
- **If critical sections are missing, ASK IN THE USER'S LANGUAGE**:
350
-
351
- **English**:
352
-
353
- ```
354
- This is a [payment/auth/production] system. These sections are CRITICAL:
355
-
356
- ❗ **Security Considerations** - Required for compliance (PCI DSS, OWASP)
357
- ❗ **Monitoring & Observability** - Required to detect issues in production
358
- ❗ **Rollback Plan** - Required to revert if something fails
359
-
360
- Can you provide:
361
- 1. Security requirements (auth, encryption, PII handling)?
362
- 2. What metrics will you monitor?
363
- 3. How will you rollback if something goes wrong?
364
- ```
365
-
366
- **Portuguese**:
367
-
368
- ```
369
- Este é um sistema de [pagamento/autenticação/produção]. Estas seções são CRÍTICAS:
370
-
371
- ❗ **Considerações de Segurança** - Obrigatório para compliance (PCI DSS, OWASP)
372
- ❗ **Monitoramento e Observabilidade** - Obrigatório para detectar problemas em produção
373
- ❗ **Plano de Rollback** - Obrigatório para reverter se algo falhar
374
-
375
- Você pode fornecer:
376
- 1. Requisitos de segurança (autenticação, encriptação, tratamento de PII)?
377
- 2. Quais métricas você vai monitorar?
378
- 3. Como você fará rollback se algo der errado?
379
- ```
380
-
381
- ### Step 4: Offer Suggested Sections
382
-
383
- After mandatory sections are covered, **offer optional sections IN THE USER'S LANGUAGE**:
384
-
385
- **English**:
386
-
387
- ```
388
- I can also add these sections to make the TDD more complete:
389
-
390
- 📊 **Success Metrics** - How will you measure success?
391
- 📚 **Glossary** - Define domain-specific terms
392
- ⚖️ **Alternatives Considered** - Why this approach over others?
393
- 🔗 **Dependencies** - External services/teams needed
394
- ⚡ **Performance Requirements** - Latency, throughput, availability targets
395
- 📋 **Open Questions** - Track pending decisions
396
-
397
- Would you like me to add any of these now? (You can add them later)
398
- ```
399
-
400
- **Portuguese**:
401
-
402
- ```
403
- Também posso adicionar estas seções para tornar o TDD mais completo:
404
-
405
- 📊 **Métricas de Sucesso** - Como você vai medir o sucesso?
406
- 📚 **Glossário** - Definir termos específicos do domínio
407
- ⚖️ **Alternativas Consideradas** - Por que esta abordagem ao invés de outras?
408
- 🔗 **Dependências** - Serviços/times externos necessários
409
- ⚡ **Requisitos de Performance** - Latência, throughput, disponibilidade
410
- 📋 **Questões em Aberto** - Rastrear decisões pendentes
411
-
412
- Gostaria que eu adicionasse alguma dessas agora? (Você pode adicionar depois)
413
- ```
414
-
415
- ### Step 5: Generate Document
416
-
417
- Generate the TDD in Markdown format following the templates below.
418
-
419
- ### Step 6: Offer Confluence Integration
420
-
421
- If user has Confluence Assistant skill available, **ask in their language**:
422
-
423
- **English**:
424
-
425
- ```
426
- Would you like me to publish this TDD to Confluence?
427
- - I can create a new page in your space
428
- - Or update an existing page
429
- ```
430
-
431
- **Portuguese**:
432
-
433
- ```
434
- Gostaria que eu publicasse este TDD no Confluence?
435
- - Posso criar uma nova página no seu espaço
436
- - Ou atualizar uma página existente
437
- ```
438
-
439
- ## Section Templates
440
-
441
- ### 1. Header & Metadata (MANDATORY)
442
-
443
- ```markdown
444
- # TDD - [Project/Feature Name]
445
-
446
- | Field | Value |
447
- | --------------- | ---------------------------- |
448
- | Tech Lead | @Name |
449
- | Product Manager | @Name (if applicable) |
450
- | Team | Name1, Name2, Name3 |
451
- | Epic/Ticket | [Link to Jira/Linear] |
452
- | Figma/Design | [Link if applicable] |
453
- | Status | Draft / In Review / Approved |
454
- | Created | YYYY-MM-DD |
455
- | Last Updated | YYYY-MM-DD |
456
- ```
457
-
458
- **If user doesn't provide**: Ask for Tech Lead, Team members, and Epic link.
459
-
460
- ---
461
-
462
- ### 2. Context (MANDATORY)
463
-
464
- ```markdown
465
- ## Context
466
-
467
- [2-4 paragraph description of the project]
468
-
469
- **Background**:
470
- What is the current state? What system/feature does this relate to?
471
-
472
- **Domain**:
473
- What business domain is this part of? (e.g., billing, authentication, content delivery)
474
-
475
- **Stakeholders**:
476
- Who cares about this project? (users, business, compliance, etc.)
477
- ```
478
-
479
- **If unclear**: Ask "Can you describe the current situation and what business domain this relates to?"
480
-
481
- ---
482
-
483
- ### 3. Problem Statement & Motivation (MANDATORY)
484
-
485
- ```markdown
486
- ## Problem Statement & Motivation
487
-
488
- ### Problems We're Solving
489
-
490
- - **Problem 1**: [Specific pain point with impact]
491
- - Impact: [quantify if possible - time wasted, cost, user friction]
492
- - **Problem 2**: [Another pain point]
493
- - Impact: [quantify if possible]
494
-
495
- ### Why Now?
496
-
497
- - [Business driver - market expansion, competitor pressure, regulatory requirement]
498
- - [Technical driver - technical debt, scalability limits]
499
- - [User driver - customer feedback, usage patterns]
500
-
501
- ### Impact of NOT Solving
502
-
503
- - **Business**: [revenue loss, competitive disadvantage]
504
- - **Technical**: [technical debt accumulation, system degradation]
505
- - **Users**: [poor experience, churn risk]
506
- ```
507
-
508
- **If user says "to integrate with X"**: Ask "What specific problems will this integration solve? Why is it important now? What happens if we don't do it?"
509
-
510
- ---
511
-
512
- ### 4. Scope (MANDATORY)
513
-
514
- ```markdown
515
- ## Scope
516
-
517
- ### ✅ In Scope (V1 - MVP)
518
-
519
- Explicit list of what WILL be delivered:
520
-
521
- - Feature/capability 1
522
- - Feature/capability 2
523
- - Feature/capability 3
524
- - Integration point A
525
- - Data migration for X
526
-
527
- ### ❌ Out of Scope (V1)
528
-
529
- Explicit list of what will NOT be included in this phase:
530
-
531
- - Feature X (deferred to V2)
532
- - Integration Y (not needed for MVP)
533
- - Advanced analytics (future enhancement)
534
- - Multi-region support (V2)
535
-
536
- ### 🔮 Future Considerations (V2+)
537
-
538
- What might come later:
539
-
540
- - Feature A (user demand dependent)
541
- - Feature B (after V1 validation)
542
- ```
543
-
544
- **If user doesn't define**: Ask "What are the must-haves for V1? What can wait for later versions?"
545
-
546
- ---
547
-
548
- ### 5. Technical Solution (MANDATORY)
549
-
550
- ````markdown
551
- ## Technical Solution
552
-
553
- ### Architecture Overview
554
-
555
- [High-level description of the solution]
556
-
557
- **Key Components**:
558
-
559
- - Component A: [responsibility]
560
- - Component B: [responsibility]
561
- - Component C: [responsibility]
562
-
563
- **Architecture Diagram**:
564
-
565
- [Include Mermaid diagram, PlantUML, or link to diagram]
566
-
567
- ```mermaid
568
- graph LR
569
- A[Frontend] -->|HTTP| B[API Gateway]
570
- B -->|GraphQL| C[Backend Service]
571
- C -->|REST| D[External API]
572
- C -->|Write| E[(Database)]
573
- ```
574
- ````
575
-
576
- ### Data Flow
577
-
578
- 1. **Step 1**: User action → Frontend
579
- 2. **Step 2**: Frontend → API Gateway (POST /resource)
580
- 3. **Step 3**: API Gateway → Service Layer
581
- 4. **Step 4**: Service → External API (if applicable)
582
- 5. **Step 5**: Service → Database (persist)
583
- 6. **Step 6**: Response → Frontend
584
-
585
- ### APIs & Endpoints
586
-
587
- | Endpoint | Method | Description | Request | Response |
588
- | ---------------------- | ------ | ---------------- | ----------- | ---------------- |
589
- | `/api/v1/resource` | POST | Creates resource | `CreateDto` | `ResourceDto` |
590
- | `/api/v1/resource/:id` | GET | Get by ID | - | `ResourceDto` |
591
- | `/api/v1/resource/:id` | DELETE | Delete resource | - | `204 No Content` |
592
-
593
- **Example Request/Response**:
594
-
595
- ```json
596
- // POST /api/v1/resource
597
- {
598
- "name": "Example",
599
- "type": "standard"
600
- }
601
-
602
- // Response 201 Created
603
- {
604
- "id": "550e8400-e29b-41d4-a716-446655440000",
605
- "name": "Example",
606
- "type": "standard",
607
- "status": "active",
608
- "createdAt": "2026-02-04T10:00:00Z"
609
- }
610
- ```
611
-
612
- ### Database Changes
613
-
614
- **New Tables**:
615
-
616
- - `{ModuleName}{EntityName}` - [description]
617
- - Primary fields: id, userId, name, status
618
- - Timestamps: createdAt, updatedAt
619
- - Indexes: userId, status (for query performance)
620
-
621
- **Schema Changes** (if modifying existing):
622
-
623
- - Add column `newField` to `ExistingTable`
624
- - Type: [varchar/integer/jsonb/etc.]
625
- - Constraints: [nullable/unique/foreign key]
626
-
627
- **Migration Strategy**:
628
-
629
- - Generate migration from schema changes
630
- - Test migration on staging environment first
631
- - Run during low-traffic window
632
- - Have rollback migration ready
633
-
634
- **Data Backfill** (if needed):
635
-
636
- - Affected records: Estimate quantity
637
- - Processing time: Estimate duration for data migration
638
- - Validation: How to verify data integrity after backfill
639
-
640
- ````
641
-
642
- **If user provides vague description**: Ask "What are the main components? How does data flow through the system? What APIs will be created/modified?"
643
-
644
- ---
645
-
646
- ### 6. Risks (MANDATORY)
647
-
648
- ```markdown
649
- ## Risks
650
-
651
- | Risk | Impact | Probability | Mitigation |
652
- |------|--------|-------------|------------|
653
- | External API downtime | High | Medium | Implement circuit breaker, cache responses, fallback to degraded mode |
654
- | Data migration failure | High | Low | Test on staging copy, run dry-run first, have rollback script ready |
655
- | Performance degradation | Medium | Medium | Load test before deployment, implement caching, monitor latency |
656
- | Security vulnerability | High | Low | Security review, penetration testing, follow OWASP guidelines |
657
- | Scope creep | Medium | High | Strict scope definition, change request process, regular stakeholder alignment |
658
-
659
- **Risk Scoring**:
660
- - **Impact**: High (system down, data loss) / Medium (degraded UX) / Low (minor inconvenience)
661
- - **Probability**: High (>50%) / Medium (20-50%) / Low (<20%)
662
- ````
663
-
664
- **If user provides < 3 risks**: Ask "What could go wrong? Consider: external dependencies, data integrity, performance, security, scope changes."
665
-
666
- ---
667
-
668
- ### 7. Implementation Plan (MANDATORY)
669
-
670
- ```markdown
671
- ## Implementation Plan
672
-
673
- | Phase | Task | Description | Owner | Status | Estimate |
674
- | --------------------- | ----------------- | -------------------------------------- | ------- | ------ | -------- |
675
- | **Phase 1 - Setup** | Setup credentials | Obtain API keys, configure environment | @Dev1 | TODO | 1d |
676
- | | Database setup | Create schema, configure datasource | @Dev1 | TODO | 1d |
677
- | **Phase 2 - Core** | Entities & repos | Create TypeORM entities, repositories | @Dev2 | TODO | 3d |
678
- | | Services | Implement business logic services | @Dev2 | TODO | 4d |
679
- | **Phase 3 - APIs** | REST endpoints | Create controllers, DTOs | @Dev3 | TODO | 3d |
680
- | | Integration | Integrate with external API | @Dev1 | TODO | 3d |
681
- | **Phase 4 - Testing** | Unit tests | Test services and repositories | @Team | TODO | 2d |
682
- | | E2E tests | Test full flow | @Team | TODO | 3d |
683
- | **Phase 5 - Deploy** | Staging deploy | Deploy to staging, smoke test | @DevOps | TODO | 1d |
684
- | | Production deploy | Phased rollout to production | @DevOps | TODO | 1d |
685
-
686
- **Total Estimate**: ~20 days (4 weeks)
687
-
688
- **Dependencies**:
689
-
690
- - Must complete Phase N before Phase N+1
691
- - External API access required before Phase 3
692
- - Security review required before Phase 5
693
- ```
694
-
695
- **If user provides vague plan**: Ask "Can you break this down into phases with specific tasks? Who will work on each part? What's the estimated timeline?"
696
-
697
- ---
698
-
699
- ### 8. Security Considerations (CRITICAL for payments/auth/PII)
700
-
701
- ```markdown
702
- ## Security Considerations
703
-
704
- ### Authentication & Authorization
705
-
706
- - **Authentication**: How users prove identity
707
- - Example: JWT tokens, OAuth 2.0, session-based
708
- - **Authorization**: What authenticated users can access
709
- - Example: Role-based (RBAC), Attribute-based (ABAC)
710
- - Ensure users can only access their own resources
711
-
712
- ### Data Protection
713
-
714
- **Encryption**:
715
-
716
- - **At Rest**: Database encryption enabled (AES-256)
717
- - **In Transit**: TLS 1.3 for all API communication
718
- - **Secrets**: Store API keys in environment variables / secret manager (AWS Secrets Manager, HashiCorp Vault)
719
-
720
- **PII Handling**:
721
-
722
- - What PII is collected: [email, name, payment info]
723
- - Legal basis: [consent, contract, legitimate interest]
724
- - Retention: [how long data is kept]
725
- - Deletion: [GDPR right to be forgotten implementation]
726
-
727
- ### Compliance Requirements
728
-
729
- | Regulation | Requirement | Implementation |
730
- | ----------- | ---------------------------------- | ------------------------------------------------- |
731
- | **GDPR** | Data protection, right to deletion | Implement data export/deletion endpoints |
732
- | **PCI DSS** | No storage of card data | Use Stripe tokenization, never store CVV/full PAN |
733
- | **LGPD** | Brazil data protection | Same as GDPR compliance |
734
-
735
- ### Security Best Practices
736
-
737
- - ✅ Input validation on all endpoints
738
- - ✅ SQL injection prevention (parameterized queries)
739
- - ✅ XSS prevention (sanitize user input, CSP headers)
740
- - ✅ CSRF protection (tokens for state-changing operations)
741
- - ✅ Rate limiting (e.g., 10 req/min per user, 100 req/min per IP)
742
- - ✅ Audit logging (log all sensitive operations)
743
-
744
- ### Secrets Management
745
-
746
- **API Keys**:
747
-
748
- - Storage: Environment variables or secret management service
749
- - Rotation: Define rotation policy (e.g., every 90 days)
750
- - Access: Backend services only, never exposed to frontend
751
- - Examples: Stripe keys, database credentials, API tokens
752
-
753
- **Webhook Signatures**:
754
-
755
- - Validate webhook signatures from external services
756
- - Reject requests without valid signature headers
757
- - Log invalid signature attempts for security monitoring
758
- ```
759
-
760
- **If missing and project involves payments/auth**: Ask "This is a [payment/auth] system. I need security details: How will you handle authentication? What encryption will be used? What PII is collected? Any compliance requirements (GDPR, PCI DSS)?"
761
-
762
- ---
763
-
764
- ### 9. Testing Strategy (CRITICAL)
765
-
766
- ```markdown
767
- ## Testing Strategy
768
-
769
- | Test Type | Scope | Coverage Target | Approach |
770
- | --------------------- | ------------------------ | ------------------------ | -------------------- |
771
- | **Unit Tests** | Services, repositories | > 80% | Jest with mocks |
772
- | **Integration Tests** | API endpoints + database | Critical paths | Supertest + test DB |
773
- | **E2E Tests** | Full user flows | Happy path + error cases | Playwright |
774
- | **Contract Tests** | External API integration | API contract validation | Pact or manual mocks |
775
- | **Load Tests** | Performance under load | Baseline performance | k6 or Artillery |
776
-
777
- ### Test Scenarios
778
-
779
- **Unit Tests**:
780
-
781
- - ✅ Service business logic (create, update, delete)
782
- - ✅ Repository query methods
783
- - ✅ Error handling (throw correct exceptions)
784
- - ✅ Edge cases (null inputs, invalid data)
785
-
786
- **Integration Tests**:
787
-
788
- - ✅ POST `/api/v1/resource` → creates in DB
789
- - ✅ GET `/api/v1/resource/:id` → returns correct data
790
- - ✅ DELETE `/api/v1/resource/:id` → removes from DB
791
- - ✅ Invalid input → returns 400 Bad Request
792
- - ✅ Unauthorized access → returns 401/403
793
-
794
- **E2E Tests**:
795
-
796
- - ✅ User creates resource → success flow
797
- - ✅ User tries to access another user's resource → denied
798
- - ✅ External API fails → graceful degradation
799
- - ✅ Database connection lost → proper error handling
800
-
801
- **Load Tests**:
802
-
803
- - Target: 100 req/s sustained, 500 req/s peak
804
- - Monitor: Latency (p50, p95, p99), error rate, throughput
805
- - Pass criteria: p95 < 500ms, error rate < 1%
806
-
807
- ### Test Data Management
808
-
809
- - Use factories for test data (e.g., `@faker-js/faker`)
810
- - Seed test database with realistic data
811
- - Clean up test data after each test
812
- - Use separate test database (never use production)
813
- ```
814
-
815
- **If missing**: Ask "How will you test this? What test types are needed (unit, integration, e2e)? What are critical test scenarios?"
816
-
817
- ---
818
-
819
- ### 10. Monitoring & Observability (CRITICAL for production)
820
-
821
- ````markdown
822
- ## Monitoring & Observability
823
-
824
- ### Metrics to Track
825
-
826
- | Metric | Type | Alert Threshold | Dashboard |
827
- | ------------------------- | ---------- | ----------------- | ------------------ |
828
- | `api.latency` | Latency | p95 > 1s for 5min | DataDog / Grafana |
829
- | `api.error_rate` | Error rate | > 1% for 5min | DataDog / Grafana |
830
- | `external_api.latency` | Latency | p95 > 2s for 5min | DataDog |
831
- | `external_api.errors` | Counter | > 5 in 1min | PagerDuty |
832
- | `database.query_time` | Duration | p95 > 100ms | DataDog |
833
- | `webhook.processing_time` | Duration | > 5s | Internal Dashboard |
834
-
835
- ### Structured Logging
836
-
837
- **Log Format** (JSON):
838
-
839
- ```json
840
- {
841
- "level": "info",
842
- "timestamp": "2026-02-04T10:00:00Z",
843
- "message": "Resource created",
844
- "context": {
845
- "userId": "user-123",
846
- "resourceId": "res-456",
847
- "action": "create",
848
- "duration_ms": 45
849
- }
850
- }
851
- ```
852
- ````
853
-
854
- **What to Log**:
855
-
856
- - ✅ All API requests (method, path, status, duration)
857
- - ✅ External API calls (endpoint, status, duration)
858
- - ✅ Database queries (slow queries > 100ms)
859
- - ✅ Errors and exceptions (stack trace, context)
860
- - ✅ Business events (resource created, payment processed)
861
-
862
- **What NOT to Log**:
863
-
864
- - ❌ Passwords, API keys, secrets
865
- - ❌ Full credit card numbers
866
- - ❌ Sensitive PII (redact or hash)
867
-
868
- ### Alerts
869
-
870
- | Alert | Severity | Channel | On-Call Action |
871
- | ---------------------------------- | ------------- | ------------------ | ------------------------------------------- |
872
- | Error rate > 5% | P1 (Critical) | PagerDuty | Immediate investigation, rollback if needed |
873
- | External API down | P1 (Critical) | PagerDuty | Enable fallback mode, notify stakeholders |
874
- | Latency > 2s (p95) | P2 (High) | Slack #engineering | Investigate performance degradation |
875
- | Webhook failures > 20 | P2 (High) | Slack #engineering | Check webhook endpoint, Stripe status |
876
- | Database connection pool exhausted | P1 (Critical) | PagerDuty | Scale up connections or investigate leak |
877
-
878
- ### Dashboards
879
-
880
- **Operational Dashboard**:
881
-
882
- - Request rate (per endpoint)
883
- - Error rate (overall and per endpoint)
884
- - Latency (p50, p95, p99)
885
- - External API health
886
- - Database performance
887
-
888
- **Business Dashboard**:
889
-
890
- - Resources created (count per day)
891
- - Active users
892
- - Conversion metrics (if applicable)
893
-
894
- ````
895
-
896
- **If missing for production system**: Ask "How will you monitor this in production? What metrics matter? What alerts do you need?"
897
-
898
- ---
899
-
900
- ### 11. Rollback Plan (CRITICAL for production)
901
-
902
- ```markdown
903
- ## Rollback Plan
904
-
905
- ### Deployment Strategy
906
-
907
- - **Feature Flag**: `FEATURE_X_ENABLED` (LaunchDarkly / custom)
908
- - **Phased Rollout**:
909
- - Phase 1: 5% of traffic (1 day)
910
- - Phase 2: 25% of traffic (1 day)
911
- - Phase 3: 50% of traffic (1 day)
912
- - Phase 4: 100% of traffic
913
-
914
- - **Canary Deployment**: Deploy to 1 instance first, monitor for 1h before full rollout
915
-
916
- ### Rollback Triggers
917
-
918
- | Trigger | Action |
919
- |---------|--------|
920
- | Error rate > 5% for 5 minutes | **Immediate rollback** - disable feature flag |
921
- | Latency > 3s (p95) for 10 minutes | **Investigate** - rollback if no quick fix |
922
- | External API integration failing > 50% | **Rollback** - revert to previous version |
923
- | Database migration fails | **STOP** - do not proceed, investigate |
924
- | Customer reports of data loss | **Immediate rollback** + incident response |
925
-
926
- ### Rollback Steps
927
-
928
- **1. Immediate Rollback (< 5 minutes)**:
929
- - **Feature Flag**: Disable via feature flag dashboard (instant)
930
- - **Deployment**: Revert to previous version via deployment tool (2-3 minutes)
931
-
932
- **2. Database Rollback** (if schema changed):
933
- - Run down migration using migration tool
934
- - Verify schema integrity
935
- - Confirm data consistency
936
-
937
- **3. Communication**:
938
-
939
- - Notify #engineering Slack channel
940
- - Update status page (if customer-facing)
941
- - Create incident ticket
942
- - Schedule post-mortem within 24h
943
-
944
- ### Post-Rollback
945
-
946
- - **Root Cause Analysis**: Within 24 hours
947
- - **Fix**: Implement fix in development environment
948
- - **Re-test**: Full test suite + additional tests for root cause
949
- - **Re-deploy**: Following same phased rollout strategy
950
-
951
- ### Database Rollback Considerations
952
-
953
- - **Migrations**: Always create reversible migrations (down migration)
954
- - **Data Backfill**: If data was modified, have script to restore previous state
955
- - **Backup**: Take database snapshot before running migrations
956
- - **Testing**: Test rollback procedure on staging before production
957
-
958
- ````
959
-
960
- **If missing for production**: Ask "What happens if the deploy goes wrong? How will you rollback? What are the triggers for rollback?"
961
-
962
- ---
963
-
964
- ### 12. Success Metrics (SUGGESTED)
965
-
966
- ```markdown
967
- ## Success Metrics
968
-
969
- | Metric | Baseline | Target | Measurement |
970
- | ----------------------- | ------------- | ------- | ------------------ |
971
- | API latency (p95) | N/A (new API) | < 200ms | DataDog APM |
972
- | Error rate | N/A | < 0.1% | Sentry / logs |
973
- | Conversion rate | N/A | > 70% | Analytics |
974
- | User satisfaction | N/A | NPS > 8 | User survey |
975
- | Time to complete action | N/A | < 30s | Frontend analytics |
976
-
977
- **Business Metrics**:
978
-
979
- - Increase in [metric] by [X%]
980
- - Reduction in [cost/time] by [Y%]
981
- - User adoption: [Z%] of users using new feature within 30 days
982
-
983
- **Technical Metrics**:
984
-
985
- - Zero production incidents in first 30 days
986
- - Test coverage > 80%
987
- - Documentation completeness: 100% of public APIs documented
988
- ```
989
-
990
- ---
991
-
992
- ### 13. Glossary & Domain Terms (SUGGESTED)
993
-
994
- ```markdown
995
- ## Glossary
996
-
997
- | Term | Description |
998
- | ------------------- | --------------------------------------------------------------------- |
999
- | **Customer** | A user who has an active subscription or has made a purchase |
1000
- | **Subscription** | Recurring payment arrangement with defined interval (monthly, annual) |
1001
- | **Trial** | Free period for users to test service before payment required |
1002
- | **Webhook** | HTTP callback from external service to notify of events |
1003
- | **Idempotency** | Operation can be applied multiple times with same result |
1004
- | **Circuit Breaker** | Pattern to prevent cascading failures when external service is down |
1005
-
1006
- **Acronyms**:
1007
-
1008
- - **API**: Application Programming Interface
1009
- - **SLA**: Service Level Agreement
1010
- - **PII**: Personally Identifiable Information
1011
- - **GDPR**: General Data Protection Regulation
1012
- - **PCI DSS**: Payment Card Industry Data Security Standard
1013
- ```
1014
-
1015
- ---
1016
-
1017
- ### 14. Alternatives Considered (SUGGESTED)
1018
-
1019
- ```markdown
1020
- ## Alternatives Considered
1021
-
1022
- | Option | Pros | Cons | Why Not Chosen |
1023
- | --------------------- | -------------------------------------------------------- | --------------------------------------------------------------------------- | ------------------------------------------------- |
1024
- | **Option A** (Chosen) | + Best documentation<br>+ Global support<br>+ Mature SDK | - Cost: 2.9% + $0.30<br>- Vendor lock-in | ✅ **Chosen** - Best balance of features and cost |
1025
- | Option B | + Lower fees (2.5%)<br>+ Brand recognition | - Poor developer experience<br>- Limited international support | Developer experience inferior, harder to maintain |
1026
- | Option C | + Full control<br>+ No transaction fees | - High maintenance cost<br>- Compliance burden (PCI DSS)<br>- Security risk | Too risky and expensive to maintain in-house |
1027
- | Option D | + Cheapest option | - No support<br>- Limited features<br>- Unknown reliability | Too risky for production payment processing |
1028
-
1029
- **Decision Criteria**:
1030
-
1031
- 1. Developer experience and documentation quality (weight: 40%)
1032
- 2. Total cost of ownership (weight: 30%)
1033
- 3. International support and compliance (weight: 20%)
1034
- 4. Reliability and uptime (weight: 10%)
1035
-
1036
- **Why Option A Won**:
1037
-
1038
- - Scored highest on developer experience (critical for fast iteration)
1039
- - Industry-standard for startups (easier to hire developers with experience)
1040
- - Built-in compliance (PCI DSS, SCA, 3D Secure) reduces risk
1041
- ```
1042
-
1043
- ---
1044
-
1045
- ### 15. Dependencies (SUGGESTED)
1046
-
1047
- ```markdown
1048
- ## Dependencies
1049
-
1050
- | Dependency | Type | Owner | Status | Risk |
1051
- | --------------------- | -------------- | ----------- | ---------------- | ------------------- |
1052
- | Stripe API | External | Stripe Inc. | Production-ready | Low (99.99% uptime) |
1053
- | Identity Module | Internal | Team Auth | Production-ready | Low |
1054
- | Database (PostgreSQL) | Infrastructure | DevOps | Ready | Low |
1055
- | Redis (caching) | Infrastructure | DevOps | Needs setup | Medium |
1056
- | Feature flag service | Internal | Platform | Ready | Low |
1057
-
1058
- **Approval Requirements**:
1059
-
1060
- - [ ] Security team review (for payment/auth projects)
1061
- - [ ] Compliance sign-off (for PII/payment data)
1062
- - [ ] Ops team ready for monitoring setup
1063
- - [ ] Product sign-off on scope
1064
-
1065
- **Blockers**:
1066
-
1067
- - Waiting for Stripe production keys (ETA: 2026-02-10)
1068
- - Need Redis setup in staging (ETA: 2026-02-08)
1069
- ```
1070
-
1071
- ---
1072
-
1073
- ### 16. Performance Requirements (SUGGESTED)
1074
-
1075
- ```markdown
1076
- ## Performance Requirements
1077
-
1078
- | Metric | Requirement | Measurement Method |
1079
- | ------------------- | ----------------------------- | ------------------ |
1080
- | API Latency (p50) | < 100ms | DataDog APM |
1081
- | API Latency (p95) | < 500ms | DataDog APM |
1082
- | API Latency (p99) | < 1s | DataDog APM |
1083
- | Throughput | 1000 req/s sustained | Load testing (k6) |
1084
- | Availability | 99.9% (< 8.76h downtime/year) | Uptime monitoring |
1085
- | Database query time | < 50ms (p95) | Slow query log |
1086
-
1087
- **Load Testing Plan**:
1088
-
1089
- - Baseline: 100 req/s for 10 minutes
1090
- - Peak: 500 req/s for 5 minutes
1091
- - Spike: 1000 req/s for 1 minute
1092
-
1093
- **Scalability**:
1094
-
1095
- - Horizontal scaling: Add more instances (Kubernetes autoscaling)
1096
- - Database: Read replicas if needed (after 10k req/s)
1097
- - Caching: Redis for frequently accessed data (> 100 req/s per resource)
1098
- ```
1099
-
1100
- ---
1101
-
1102
- ### 17. Migration Plan (SUGGESTED - if applicable)
1103
-
1104
- ```markdown
1105
- ## Migration Plan
1106
-
1107
- ### Migration Strategy
1108
-
1109
- **Type**: [Blue-Green / Rolling / Big Bang / Phased]
1110
-
1111
- **Phases**:
1112
-
1113
- | Phase | Description | Users Affected | Duration | Rollback |
1114
- | ----------------- | -------------------------------------- | -------------- | -------- | ------------------- |
1115
- | 1. Preparation | Set up new system, run in parallel | 0% | 1 week | N/A |
1116
- | 2. Shadow Mode | New system processes but doesn't serve | 0% | 1 week | Instant |
1117
- | 3. Pilot | 5% of users on new system | 5% | 1 week | < 5min |
1118
- | 4. Ramp Up | 50% of users on new system | 50% | 1 week | < 5min |
1119
- | 5. Full Migration | 100% of users on new system | 100% | 1 day | < 5min |
1120
- | 6. Decommission | Turn off old system | 0% | 1 week | Restore from backup |
1121
-
1122
- ### Data Migration
1123
-
1124
- **Source**: Old system database
1125
- **Destination**: New system database
1126
- **Volume**: [X million records]
1127
- **Method**: [ETL script / database replication / API sync]
1128
-
1129
- **Steps**:
1130
-
1131
- 1. Export data from old system (script: `scripts/export-old-data.ts`)
1132
- 2. Transform data to new schema (script: `scripts/transform-data.ts`)
1133
- 3. Validate data integrity (checksums, row counts)
1134
- 4. Load into new system (script: `scripts/load-new-data.ts`)
1135
- 5. Verify: Run parallel reads, compare results
1136
-
1137
- **Timeline**:
1138
-
1139
- - Dry run on staging: 2026-02-10
1140
- - Production migration window: 2026-02-15 02:00-06:00 UTC (low traffic)
1141
-
1142
- ### Backward Compatibility
1143
-
1144
- - Old API endpoints will remain active for 90 days
1145
- - Deprecation warnings added to responses
1146
- - Client libraries updated with migration guide
1147
- ```
1148
-
1149
- ---
1150
-
1151
- ### 18. Open Questions (SUGGESTED)
1152
-
1153
- ```markdown
1154
- ## Open Questions
1155
-
1156
- | # | Question | Context | Owner | Status | Decision Date |
1157
- | --- | ------------------------------------------------------ | ---------------------------------------------- | --------- | ---------------- | ------------- |
1158
- | 1 | How to handle trial expiration without payment method? | User loses access immediately or grace period? | @Product | 🟡 In Discussion | TBD |
1159
- | 2 | Allow multiple trials for same email? | Prevent abuse vs. legitimate use cases | @TechLead | 🔴 Open | TBD |
1160
- | 3 | SLA for webhook processing? | Stripe retries for 72h, what's our target? | @Backend | 🔴 Open | TBD |
1161
- | 4 | Support for promo codes in V1? | Marketing requested, is it in scope? | @Product | ✅ Resolved: V2 | 2026-02-01 |
1162
- | 5 | Fallback if Identity Module fails? | Can we create subscription without user data? | @TechLead | 🔴 Open | TBD |
1163
-
1164
- **Status Legend**:
1165
-
1166
- - 🔴 Open - needs decision
1167
- - 🟡 In Discussion - actively being discussed
1168
- - ✅ Resolved - decision made
1169
- ```
1170
-
1171
- ---
1172
-
1173
- ### 19. Roadmap / Timeline (SUGGESTED)
1174
-
1175
- ```markdown
1176
- ## Roadmap / Timeline
1177
-
1178
- | Phase | Deliverables | Duration | Target Date | Status |
1179
- | ------------------------ | --------------------------------------------------------------------------------- | -------- | ----------- | -------------- |
1180
- | **Phase 0: Setup** | - Stripe credentials<br>- Staging environment<br>- SDK installed | 2 days | 2026-02-05 | ✅ Complete |
1181
- | **Phase 1: Persistence** | - Entities created<br>- Repositories implemented<br>- Migrations generated | 3 days | 2026-02-08 | 🟡 In Progress |
1182
- | **Phase 2: Services** | - CustomerService<br>- SubscriptionService<br>- Identity integration | 5 days | 2026-02-15 | ⏳ Pending |
1183
- | **Phase 3: APIs** | - POST /subscriptions<br>- DELETE /subscriptions/:id<br>- GET /subscriptions | 3 days | 2026-02-18 | ⏳ Pending |
1184
- | **Phase 4: Webhooks** | - Webhook endpoint<br>- Signature validation<br>- Event handlers | 4 days | 2026-02-22 | ⏳ Pending |
1185
- | **Phase 5: Testing** | - Unit tests (80% coverage)<br>- Integration tests<br>- E2E tests | 5 days | 2026-02-27 | ⏳ Pending |
1186
- | **Phase 6: Deploy** | - Documentation<br>- Monitoring setup<br>- Staging deploy<br>- Production rollout | 3 days | 2026-03-02 | ⏳ Pending |
1187
-
1188
- **Total Duration**: ~25 days (5 weeks)
1189
-
1190
- **Milestones**:
1191
-
1192
- - 🎯 M1: MVP ready for staging (2026-02-22)
1193
- - 🎯 M2: Production deployment (2026-03-02)
1194
- - 🎯 M3: 100% rollout complete (2026-03-09)
1195
-
1196
- **Critical Path**:
1197
- Phase 0 → Phase 1 → Phase 2 → Phase 3 → Phase 4 → Phase 5 → Phase 6
1198
- ```
1199
-
1200
- ---
1201
-
1202
- ### 20. Approval & Sign-off (SUGGESTED)
1203
-
1204
- ```markdown
1205
- ## Approval & Sign-off
1206
-
1207
- | Role | Name | Status | Date | Comments |
1208
- | ------------------------ | ----- | -------------- | ---------- | --------------------------------- |
1209
- | Tech Lead | @Name | ✅ Approved | 2026-02-04 | LGTM, proceed with implementation |
1210
- | Staff/Principal Engineer | @Name | ⏳ Pending | - | Requested security review first |
1211
- | Product Manager | @Name | ✅ Approved | 2026-02-03 | Scope aligned with roadmap |
1212
- | Engineering Manager | @Name | ⏳ Pending | - | - |
1213
- | Security Team | @Name | 🔴 Not Started | - | Required for payment integration |
1214
- | Compliance/Legal | @Name | N/A | - | Not required for this project |
1215
-
1216
- **Approval Criteria**:
1217
-
1218
- - ✅ All mandatory sections complete
1219
- - ✅ Security review passed (if applicable)
1220
- - ✅ Risks identified and mitigated
1221
- - ✅ Timeline realistic and agreed upon
1222
- - ⏳ Test strategy approved by QA
1223
- - ⏳ Monitoring plan reviewed by SRE
1224
-
1225
- **Next Steps After Approval**:
1226
-
1227
- 1. Create Epic in Jira (link in metadata)
1228
- 2. Break down into User Stories
1229
- 3. Begin Phase 1 implementation
1230
- 4. Schedule kickoff meeting with team
1231
- ```
1232
-
1233
- ---
1234
-
1235
- ## Validation Rules
1236
-
1237
- ### Mandatory Section Checklist
1238
-
1239
- Before finalizing TDD, ensure:
1240
-
1241
- - [ ] **Header**: Tech Lead, Team, Epic link present
1242
- - [ ] **Context**: 2+ paragraphs describing background and domain
1243
- - [ ] **Problem**: At least 2 specific problems identified with impact
1244
- - [ ] **Scope**: Clear in-scope and out-of-scope items (min 3 each)
1245
- - [ ] **Technical Solution**: Architecture diagram or description
1246
- - [ ] **Technical Solution**: At least 1 API endpoint defined
1247
- - [ ] **Risks**: At least 3 risks with impact/probability/mitigation
1248
- - [ ] **Implementation Plan**: Broken into phases with estimates
1249
-
1250
- ### Critical Section Checklist (by project type)
1251
-
1252
- **If Payment/Auth project**:
1253
-
1254
- - [ ] **Security**: Authentication method defined
1255
- - [ ] **Security**: Encryption (at rest, in transit) specified
1256
- - [ ] **Security**: PII handling approach documented
1257
- - [ ] **Security**: Compliance requirements identified
1258
-
1259
- **If Production system**:
1260
-
1261
- - [ ] **Monitoring**: At least 3 metrics defined with thresholds
1262
- - [ ] **Monitoring**: Alerts configured
1263
- - [ ] **Rollback**: Rollback triggers defined
1264
- - [ ] **Rollback**: Rollback steps documented
1265
-
1266
- **All projects**:
1267
-
1268
- - [ ] **Testing**: At least 2 test types defined (unit, integration, e2e)
1269
- - [ ] **Testing**: Critical test scenarios listed
1270
-
1271
- ## Output Format
1272
-
1273
- ### When Creating TDD
1274
-
1275
- 1. **Generate Markdown document**
1276
- 2. **Validate against checklists above**
1277
- 3. **Highlight any missing critical sections**
1278
- 4. **Provide summary to user**:
1279
-
1280
- ```
1281
- ✅ TDD Created: "[Project Name]"
1282
-
1283
- **Sections Included**:
1284
- ✅ Mandatory (7/7): All present
1285
- ✅ Critical (3/4): Security, Testing, Monitoring
1286
- ⚠️ Missing: Rollback Plan (recommended for production)
1287
-
1288
- **Suggested Next Steps**:
1289
- - Add Rollback Plan section (critical for production)
1290
- - Review Security section with InfoSec team
1291
- - Create Epic in Jira and link in metadata
1292
- - Schedule TDD review meeting with stakeholders
1293
-
1294
- Would you like me to:
1295
- 1. Add the missing Rollback Plan section?
1296
- 2. Publish this TDD to Confluence?
1297
- 3. Create a Jira Epic for this project?
1298
- ```
1299
-
1300
- ### Confluence Integration
1301
-
1302
- If user wants to publish to Confluence:
1303
-
1304
- ```
1305
- I'll publish this TDD to Confluence.
1306
-
1307
- Which space should I use?
1308
- - Personal space (~557058...)
1309
- - Team space (provide space key)
1310
-
1311
- Should I:
1312
- - Create a new page
1313
- - Update existing page (provide page ID or URL)
1314
- ```
1315
-
1316
- Then use Confluence Assistant skill to publish.
1317
-
1318
- ## Common Anti-Patterns to Avoid
1319
-
1320
- ### ❌ Vague Problem Statements
1321
-
1322
- **BAD**:
1323
-
1324
- ```
1325
-
1326
- We need to integrate with Stripe.
1327
-
1328
- ```
1329
-
1330
- **GOOD**:
1331
-
1332
- ```
1333
-
1334
- ### Problems We're Solving
1335
-
1336
- - **Manual payment processing takes 2 hours/day**: Currently processing payments manually, costing $500/month in labor
1337
- - **Cannot expand internationally**: Current payment processor only supports USD
1338
- - **High cart abandonment (45%)**: Poor checkout UX causing revenue loss of $10k/month
1339
-
1340
- ```
1341
-
1342
- ### ❌ Undefined Scope
1343
-
1344
- **BAD**:
1345
-
1346
- ```
1347
-
1348
- Build payment integration with all features.
1349
-
1350
- ```
1351
-
1352
- **GOOD**:
1353
-
1354
- ```
1355
-
1356
- ### ✅ In Scope (V1)
1357
-
1358
- - Trial subscriptions (14 days)
1359
- - Single payment method per user
1360
- - USD only
1361
- - Cancel subscription
1362
-
1363
- ### ❌ Out of Scope (V1)
1364
-
1365
- - Multiple payment methods
1366
- - Multi-currency
1367
- - Promo codes
1368
- - Usage-based billing
1369
-
1370
- ```
1371
-
1372
- ### ❌ Missing Security for Payment Systems
1373
-
1374
- **BAD**:
1375
-
1376
- ```
1377
-
1378
- No security section for payment integration.
1379
-
1380
- ```
1381
-
1382
- **GOOD**:
1383
-
1384
- ```
1385
-
1386
- ### Security Considerations (MANDATORY)
1387
-
1388
- **PCI DSS Compliance**:
1389
-
1390
- - Never store full card numbers (use Stripe tokens)
1391
- - Never log CVV or full PAN
1392
- - Use Stripe Elements for card input (PCI SAQ A)
1393
-
1394
- **Secrets Management**:
1395
-
1396
- - Store `STRIPE_SECRET_KEY` in environment variables
1397
- - Rotate keys every 90 days
1398
- - Never commit keys to git
1399
-
1400
- ```
1401
-
1402
- ### ❌ No Rollback Plan
1403
-
1404
- **BAD**:
1405
-
1406
- ```
1407
-
1408
- We'll deploy and hope it works.
1409
-
1410
- ```
1411
-
1412
- **GOOD**:
1413
-
1414
- ```
1415
-
1416
- ### Rollback Plan
1417
-
1418
- **Triggers**:
1419
-
1420
- - Error rate > 5% → immediate rollback
1421
- - Payment processing failures > 10% → immediate rollback
1422
-
1423
- **Steps**:
1424
-
1425
- 1. Disable feature flag `STRIPE_INTEGRATION_ENABLED`
1426
- 2. Verify old payment processor is active
1427
- 3. Notify #engineering and #product
1428
- 4. Schedule post-mortem within 24h
1429
-
1430
- ```
1431
-
1432
- ## Important Notes
1433
-
1434
- - **Respect user's language** - Automatically detect and generate TDD in the same language as user's request
1435
- - **Focus on architecture, not implementation** - Document decisions and contracts, not code
1436
- - **High-level examples only** - Show API contracts, data schemas, diagrams (not CLI commands or code snippets)
1437
- - **Always validate mandatory sections** - Don't let user skip them
1438
- - **For payments/auth** - Security section is MANDATORY
1439
- - **For production** - Monitoring and Rollback are MANDATORY
1440
- - **Ask clarifying questions** - Don't guess missing information (ask in user's language)
1441
- - **Be thorough but pragmatic** - Small projects don't need all 20 sections
1442
- - **Update the document** - TDDs should evolve as the project progresses
1443
- - **Use industry standards** - Reference Google, Amazon, RFC patterns
1444
- - **Think about compliance** - GDPR, PCI DSS, HIPAA where applicable
1445
- - **Test for longevity** - If implementation framework changes, TDD should still be valid
1446
-
1447
- ## Example Prompts that Trigger This Skill
1448
-
1449
- ### English
1450
-
1451
- - "Create a TDD for Stripe integration"
1452
- - "I need a technical design document for the new auth system"
1453
- - "Write a design doc for the API redesign"
1454
- - "Help me document the payment integration architecture"
1455
- - "Create a tech spec for migrating to microservices"
1456
-
1457
- ### Portuguese
1458
-
1459
- - "Crie um TDD para integração com Stripe"
1460
- - "Preciso de um documento de design técnico para o novo sistema de autenticação"
1461
- - "Escreva um design doc para o redesign da API"
1462
- - "Me ajude a documentar a arquitetura de integração de pagamento"
1463
- - "Crie uma especificação técnica para migração para microserviços"
1464
-
1465
- ### Spanish
1466
-
1467
- - "Crea un TDD para integración con Stripe"
1468
- - "Necesito un documento de diseño técnico para el nuevo sistema de autenticación"
1469
- - "Escribe un design doc para el rediseño de la API"
1470
- - "Ayúdame a documentar la arquitectura de integración de pagos"
1471
- - "Crea una especificación técnica para migración a microservicios"
1472
-
1473
- ## References
1474
-
1475
- ### Industry Standards
1476
-
1477
- - [Google Engineering Practices](https://google.github.io/eng-practices/)
1478
- - [Google SRE Book](https://sre.google/sre-book/table-of-contents/)
1479
- - [OWASP Top 10](https://owasp.org/www-project-top-ten/)
1480
- - [Architecture Decision Records](https://adr.github.io/)
1481
-
1482
- ```
1483
-
1484
- ```