@dzhechkov/skills-idea2prd 0.1.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.
- package/LICENSE +21 -0
- package/README.md +71 -0
- package/bin/cli.js +5 -0
- package/package.json +49 -0
- package/sources.json +25 -0
- package/src/cli.js +108 -0
- package/src/commands/doctor.js +340 -0
- package/src/commands/init.js +168 -0
- package/src/commands/list.js +146 -0
- package/src/commands/remove.js +182 -0
- package/src/commands/update.js +170 -0
- package/src/utils.js +154 -0
- package/templates/.claude/commands/idea2prd-manual.md +35 -0
- package/templates/.claude/skills/explore/SKILL.md +218 -0
- package/templates/.claude/skills/explore/references/questioning-techniques.md +151 -0
- package/templates/.claude/skills/explore/references/task-brief-templates.md +355 -0
- package/templates/.claude/skills/goap-research-ed25519/SKILL.md +418 -0
- package/templates/.claude/skills/goap-research-ed25519/references/ed25519-verification.md +658 -0
- package/templates/.claude/skills/goap-research-ed25519/references/research-actions.md +544 -0
- package/templates/.claude/skills/goap-research-ed25519/references/source-evaluation.md +560 -0
- package/templates/.claude/skills/goap-research-ed25519/scripts/ed25519_verifier.py +662 -0
- package/templates/.claude/skills/goap-research-ed25519/scripts/goap_planner.py +720 -0
- package/templates/.claude/skills/idea2prd-manual/SKILL.md +695 -0
- package/templates/.claude/skills/idea2prd-manual/references/adr-catalog.md +288 -0
- package/templates/.claude/skills/idea2prd-manual/references/c4-model.md +277 -0
- package/templates/.claude/skills/idea2prd-manual/references/completion-checklist-template.md +446 -0
- package/templates/.claude/skills/idea2prd-manual/references/ddd-patterns.md +261 -0
- package/templates/.claude/skills/idea2prd-manual/references/fitness-functions-catalog.md +414 -0
- package/templates/.claude/skills/idea2prd-manual/references/pseudocode-style.md +404 -0
- package/templates/.claude/skills/idea2prd-manual/scripts/ai_context_builder.py +491 -0
- package/templates/.claude/skills/idea2prd-manual/scripts/c4_generator.py +311 -0
- package/templates/.claude/skills/idea2prd-manual/scripts/fitness_validator.py +451 -0
- package/templates/.claude/skills/idea2prd-manual/scripts/pseudocode_generator.py +430 -0
- package/templates/.claude/skills/problem-solver-enhanced/SKILL.md +565 -0
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
# ADR Catalog: Templates and Common Decisions
|
|
2
|
+
|
|
3
|
+
Каталог типовых Architecture Decision Records для idea2prd skills.
|
|
4
|
+
|
|
5
|
+
## ADR Template
|
|
6
|
+
|
|
7
|
+
```markdown
|
|
8
|
+
# ADR-[NNN]: [Title]
|
|
9
|
+
|
|
10
|
+
## Status
|
|
11
|
+
[Proposed | Accepted | Deprecated | Superseded by ADR-XXX]
|
|
12
|
+
|
|
13
|
+
## Context
|
|
14
|
+
[Situation requiring decision. Reference requirements.]
|
|
15
|
+
|
|
16
|
+
**Related Requirements:**
|
|
17
|
+
- FR-XXX: [requirement]
|
|
18
|
+
- NFR-XXX: [requirement]
|
|
19
|
+
|
|
20
|
+
**Related Bounded Contexts:**
|
|
21
|
+
- [Context Name]
|
|
22
|
+
|
|
23
|
+
## Decision Drivers
|
|
24
|
+
- [Driver 1]: [Why it matters]
|
|
25
|
+
- [Driver 2]: [Why it matters]
|
|
26
|
+
|
|
27
|
+
## Considered Options
|
|
28
|
+
1. [Option A]
|
|
29
|
+
2. [Option B]
|
|
30
|
+
3. [Option C]
|
|
31
|
+
|
|
32
|
+
## Decision
|
|
33
|
+
[Chosen option] because [rationale].
|
|
34
|
+
|
|
35
|
+
## Consequences
|
|
36
|
+
|
|
37
|
+
### Positive
|
|
38
|
+
- [Benefit]
|
|
39
|
+
|
|
40
|
+
### Negative
|
|
41
|
+
- [Trade-off]
|
|
42
|
+
|
|
43
|
+
### Risks
|
|
44
|
+
- [Risk]: Mitigation: [approach]
|
|
45
|
+
|
|
46
|
+
## Related ADRs
|
|
47
|
+
- ADR-XXX: [relationship]
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Standard ADRs (Required)
|
|
53
|
+
|
|
54
|
+
### ADR-001: System Architecture Style
|
|
55
|
+
|
|
56
|
+
**Common Options:**
|
|
57
|
+
|
|
58
|
+
| Option | When to Use | Trade-offs |
|
|
59
|
+
|--------|-------------|------------|
|
|
60
|
+
| **Modular Monolith** | MVP, small team, unclear boundaries | Simple deployment, harder to scale independently |
|
|
61
|
+
| **Microservices** | Large team, clear boundaries, need independent scaling | Complex ops, eventual consistency |
|
|
62
|
+
| **Serverless** | Event-driven, variable load, cost optimization | Cold starts, vendor lock-in |
|
|
63
|
+
| **Hybrid** | Mix of needs | Complexity of multiple patterns |
|
|
64
|
+
|
|
65
|
+
**Default:** Modular Monolith (safest for MVP)
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
### ADR-002: Database Technology
|
|
70
|
+
|
|
71
|
+
**Common Options:**
|
|
72
|
+
|
|
73
|
+
| Option | Strengths | When to Use |
|
|
74
|
+
|--------|-----------|-------------|
|
|
75
|
+
| **PostgreSQL** | ACID, JSON support, extensions | Most applications |
|
|
76
|
+
| **MySQL/MariaDB** | Wide support, replication | High-read workloads |
|
|
77
|
+
| **MongoDB** | Schema flexibility, horizontal scale | Document-centric, rapid iteration |
|
|
78
|
+
| **DynamoDB** | Serverless, auto-scaling | AWS-native, key-value access patterns |
|
|
79
|
+
|
|
80
|
+
**Default:** PostgreSQL (most versatile)
|
|
81
|
+
|
|
82
|
+
**Decision Drivers:**
|
|
83
|
+
- Data model complexity
|
|
84
|
+
- Consistency requirements
|
|
85
|
+
- Scale requirements
|
|
86
|
+
- Team expertise
|
|
87
|
+
- Cloud platform
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
### ADR-003: API Design
|
|
92
|
+
|
|
93
|
+
**Common Options:**
|
|
94
|
+
|
|
95
|
+
| Option | Strengths | When to Use |
|
|
96
|
+
|--------|-----------|------------|
|
|
97
|
+
| **REST + JSON** | Simple, cacheable, tooling | CRUD operations, public APIs |
|
|
98
|
+
| **GraphQL** | Flexible queries, single endpoint | Complex data graphs, mobile apps |
|
|
99
|
+
| **gRPC** | Performance, streaming, contracts | Internal services, high-throughput |
|
|
100
|
+
| **REST + JSON:API** | Standardized REST | Complex resource relationships |
|
|
101
|
+
|
|
102
|
+
**Default:** REST + JSON (simplest, most supported)
|
|
103
|
+
|
|
104
|
+
**Decision Drivers:**
|
|
105
|
+
- Client needs (web, mobile, third-party)
|
|
106
|
+
- Data complexity
|
|
107
|
+
- Performance requirements
|
|
108
|
+
- Team expertise
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
### ADR-004: Authentication & Authorization
|
|
113
|
+
|
|
114
|
+
**Common Options:**
|
|
115
|
+
|
|
116
|
+
| Option | Strengths | When to Use |
|
|
117
|
+
|--------|-----------|-------------|
|
|
118
|
+
| **JWT + OAuth 2.0** | Stateless, standard, SSO-ready | Most applications |
|
|
119
|
+
| **Session-based** | Simple, server-controlled | Traditional web apps |
|
|
120
|
+
| **API Keys** | Simple for M2M | Internal APIs, integrations |
|
|
121
|
+
| **OIDC** | Full identity, SSO | Enterprise, multiple IdPs |
|
|
122
|
+
|
|
123
|
+
**Default:** JWT + OAuth 2.0 (modern standard)
|
|
124
|
+
|
|
125
|
+
**Decision Drivers:**
|
|
126
|
+
- User types (human, machine)
|
|
127
|
+
- SSO requirements
|
|
128
|
+
- Session management needs
|
|
129
|
+
- Compliance requirements
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
### ADR-005: Inter-Context Communication
|
|
134
|
+
|
|
135
|
+
**Common Options:**
|
|
136
|
+
|
|
137
|
+
| Option | Strengths | When to Use |
|
|
138
|
+
|--------|-----------|-------------|
|
|
139
|
+
| **Domain Events (async)** | Loose coupling, resilience | Cross-context state changes |
|
|
140
|
+
| **Direct API calls (sync)** | Simple, immediate | Query data, low latency needs |
|
|
141
|
+
| **Shared Database** | Simple (anti-pattern) | Legacy, tight deadlines |
|
|
142
|
+
| **Event Sourcing** | Full audit trail | Compliance, complex workflows |
|
|
143
|
+
|
|
144
|
+
**Default:** Domain Events for commands, Direct calls for queries
|
|
145
|
+
|
|
146
|
+
**Decision Drivers:**
|
|
147
|
+
- Coupling tolerance
|
|
148
|
+
- Consistency requirements
|
|
149
|
+
- Audit requirements
|
|
150
|
+
- Team experience
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
### ADR-006: Deployment Architecture
|
|
155
|
+
|
|
156
|
+
**Common Options:**
|
|
157
|
+
|
|
158
|
+
| Option | Strengths | When to Use |
|
|
159
|
+
|--------|-----------|-------------|
|
|
160
|
+
| **Docker + Kubernetes** | Portable, scalable | Production workloads |
|
|
161
|
+
| **Docker + Docker Compose** | Simple, local dev | Small deployments, staging |
|
|
162
|
+
| **Serverless (Lambda/Functions)** | No ops, pay-per-use | Event-driven, variable load |
|
|
163
|
+
| **PaaS (Heroku, Railway)** | Zero ops | MVPs, small teams |
|
|
164
|
+
|
|
165
|
+
**Default:** Docker + Kubernetes-ready (prepare for scale)
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
### ADR-007: Frontend Technology
|
|
170
|
+
|
|
171
|
+
**Common Options:**
|
|
172
|
+
|
|
173
|
+
| Option | Strengths | When to Use |
|
|
174
|
+
|--------|-----------|-------------|
|
|
175
|
+
| **React** | Ecosystem, hiring, flexibility | Most applications |
|
|
176
|
+
| **Vue.js** | Gentle learning curve | Smaller teams, rapid dev |
|
|
177
|
+
| **Next.js** | SSR, SEO, full-stack | Content-heavy, SEO-critical |
|
|
178
|
+
| **SvelteKit** | Performance, simplicity | Performance-critical |
|
|
179
|
+
|
|
180
|
+
**Default:** React + TypeScript (largest ecosystem)
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
### ADR-008: State Management
|
|
185
|
+
|
|
186
|
+
**Common Options:**
|
|
187
|
+
|
|
188
|
+
| Option | Strengths | When to Use |
|
|
189
|
+
|--------|-----------|-------------|
|
|
190
|
+
| **React Query + Zustand** | Server state + client state separation | Most React apps |
|
|
191
|
+
| **Redux Toolkit** | Predictable, devtools | Complex client state |
|
|
192
|
+
| **Jotai/Recoil** | Atomic, simple | Simpler state needs |
|
|
193
|
+
| **MobX** | Observable, less boilerplate | OOP preference |
|
|
194
|
+
|
|
195
|
+
**Default:** React Query (server) + Zustand (client)
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
### ADR-009: Error Handling
|
|
200
|
+
|
|
201
|
+
**Common Options:**
|
|
202
|
+
|
|
203
|
+
| Option | Strengths | When to Use |
|
|
204
|
+
|--------|-----------|-------------|
|
|
205
|
+
| **RFC 7807 Problem Details** | Standard, machine-readable | REST APIs |
|
|
206
|
+
| **Custom Error Schema** | Flexible | Specific needs |
|
|
207
|
+
| **GraphQL Errors** | Native | GraphQL APIs |
|
|
208
|
+
|
|
209
|
+
**Default:** RFC 7807 Problem Details
|
|
210
|
+
|
|
211
|
+
**Example:**
|
|
212
|
+
```json
|
|
213
|
+
{
|
|
214
|
+
"type": "https://api.example.com/errors/validation",
|
|
215
|
+
"title": "Validation Error",
|
|
216
|
+
"status": 400,
|
|
217
|
+
"detail": "Email format is invalid",
|
|
218
|
+
"instance": "/users/123"
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
### ADR-010: Observability
|
|
225
|
+
|
|
226
|
+
**Common Options:**
|
|
227
|
+
|
|
228
|
+
| Aspect | Options | Default |
|
|
229
|
+
|--------|---------|---------|
|
|
230
|
+
| **Logging** | Structured JSON, ELK, Loki | Structured JSON |
|
|
231
|
+
| **Metrics** | Prometheus, CloudWatch, Datadog | Prometheus |
|
|
232
|
+
| **Tracing** | OpenTelemetry, Jaeger | OpenTelemetry |
|
|
233
|
+
| **Alerting** | PagerDuty, OpsGenie | Based on platform |
|
|
234
|
+
|
|
235
|
+
**Default Stack:** Structured JSON logs + OpenTelemetry + Prometheus
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## Additional ADRs (As Needed)
|
|
240
|
+
|
|
241
|
+
| ADR | Topic | When Needed |
|
|
242
|
+
|-----|-------|-------------|
|
|
243
|
+
| ADR-011 | Caching Strategy | High-read, performance-critical |
|
|
244
|
+
| ADR-012 | Search Technology | Full-text search requirements |
|
|
245
|
+
| ADR-013 | File Storage | User uploads, media |
|
|
246
|
+
| ADR-014 | Background Jobs | Async processing |
|
|
247
|
+
| ADR-015 | Email/Notifications | User communication |
|
|
248
|
+
| ADR-016 | Payment Processing | E-commerce |
|
|
249
|
+
| ADR-017 | Internationalization | Multi-language |
|
|
250
|
+
| ADR-018 | Feature Flags | Gradual rollout |
|
|
251
|
+
| ADR-019 | Rate Limiting | API protection |
|
|
252
|
+
| ADR-020 | Data Encryption | Compliance |
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## ADR Naming Convention
|
|
257
|
+
|
|
258
|
+
```
|
|
259
|
+
ADR-[NNN]-[kebab-case-title].md
|
|
260
|
+
|
|
261
|
+
Examples:
|
|
262
|
+
ADR-001-system-architecture.md
|
|
263
|
+
ADR-002-database-technology.md
|
|
264
|
+
ADR-003-api-design.md
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## ADR Index Template
|
|
268
|
+
|
|
269
|
+
```markdown
|
|
270
|
+
# Architecture Decision Records
|
|
271
|
+
|
|
272
|
+
## Accepted
|
|
273
|
+
|
|
274
|
+
| ADR | Title | Date | Summary |
|
|
275
|
+
|-----|-------|------|---------|
|
|
276
|
+
| [ADR-001](ADR-001-system-architecture.md) | System Architecture | YYYY-MM-DD | Modular Monolith |
|
|
277
|
+
| [ADR-002](ADR-002-database.md) | Database Technology | YYYY-MM-DD | PostgreSQL |
|
|
278
|
+
|
|
279
|
+
## Proposed
|
|
280
|
+
|
|
281
|
+
| ADR | Title | Date | Summary |
|
|
282
|
+
|-----|-------|------|---------|
|
|
283
|
+
|
|
284
|
+
## Deprecated
|
|
285
|
+
|
|
286
|
+
| ADR | Title | Date | Superseded By |
|
|
287
|
+
|-----|-------|------|---------------|
|
|
288
|
+
```
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
# C4 Model Guidelines
|
|
2
|
+
|
|
3
|
+
Справочник по C4 Model для idea2prd skills.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
C4 Model — иерархический подход к визуализации архитектуры:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
Level 1: System Context — Система и её окружение
|
|
11
|
+
Level 2: Container — Высокоуровневые компоненты системы
|
|
12
|
+
Level 3: Component — Компоненты внутри контейнера
|
|
13
|
+
Level 4: Code — Классы/модули (обычно не нужен)
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Level 1: System Context
|
|
17
|
+
|
|
18
|
+
**Цель:** Показать систему в контексте пользователей и внешних систем.
|
|
19
|
+
|
|
20
|
+
**Что включать:**
|
|
21
|
+
- Основные пользователи (personas)
|
|
22
|
+
- Вашу систему (один блок)
|
|
23
|
+
- Внешние системы (интеграции)
|
|
24
|
+
- Связи между ними
|
|
25
|
+
|
|
26
|
+
**Mermaid Template:**
|
|
27
|
+
|
|
28
|
+
```mermaid
|
|
29
|
+
C4Context
|
|
30
|
+
title System Context Diagram: [Product Name]
|
|
31
|
+
|
|
32
|
+
Person(user, "End User", "Description of user")
|
|
33
|
+
Person(admin, "Administrator", "Manages the system")
|
|
34
|
+
|
|
35
|
+
System(system, "Product Name", "Brief description of what the system does")
|
|
36
|
+
|
|
37
|
+
System_Ext(email, "Email Service", "Sends emails")
|
|
38
|
+
System_Ext(payment, "Payment Gateway", "Processes payments")
|
|
39
|
+
System_Ext(auth, "Identity Provider", "SSO authentication")
|
|
40
|
+
|
|
41
|
+
Rel(user, system, "Uses", "HTTPS")
|
|
42
|
+
Rel(admin, system, "Manages", "HTTPS")
|
|
43
|
+
Rel(system, email, "Sends emails via", "SMTP/API")
|
|
44
|
+
Rel(system, payment, "Processes payments via", "REST API")
|
|
45
|
+
Rel(system, auth, "Authenticates via", "OIDC")
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Правила:**
|
|
49
|
+
- Максимум 10-15 элементов
|
|
50
|
+
- Показывать только ключевых пользователей
|
|
51
|
+
- Группировать похожие внешние системы
|
|
52
|
+
- Указывать протокол/формат связи
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Level 2: Container Diagram
|
|
57
|
+
|
|
58
|
+
**Цель:** Показать высокоуровневую структуру системы.
|
|
59
|
+
|
|
60
|
+
**Что включать:**
|
|
61
|
+
- Приложения (web app, mobile app, CLI)
|
|
62
|
+
- Сервисы (API, workers, microservices)
|
|
63
|
+
- Базы данных
|
|
64
|
+
- Очереди сообщений
|
|
65
|
+
- Файловые хранилища
|
|
66
|
+
|
|
67
|
+
**Mermaid Template:**
|
|
68
|
+
|
|
69
|
+
```mermaid
|
|
70
|
+
C4Container
|
|
71
|
+
title Container Diagram: [Product Name]
|
|
72
|
+
|
|
73
|
+
Person(user, "User")
|
|
74
|
+
|
|
75
|
+
System_Boundary(system, "Product Name") {
|
|
76
|
+
Container(spa, "Web Application", "React, TypeScript", "User interface")
|
|
77
|
+
Container(mobile, "Mobile App", "React Native", "Mobile interface")
|
|
78
|
+
Container(api, "API Server", "Node.js, Express", "Business logic and API")
|
|
79
|
+
Container(worker, "Background Worker", "Node.js", "Async job processing")
|
|
80
|
+
ContainerDb(db, "Database", "PostgreSQL", "Stores application data")
|
|
81
|
+
ContainerDb(cache, "Cache", "Redis", "Session and cache storage")
|
|
82
|
+
ContainerQueue(queue, "Message Queue", "Redis/RabbitMQ", "Job queue")
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
System_Ext(email, "Email Service")
|
|
86
|
+
System_Ext(storage, "Cloud Storage", "S3")
|
|
87
|
+
|
|
88
|
+
Rel(user, spa, "Uses", "HTTPS")
|
|
89
|
+
Rel(user, mobile, "Uses", "HTTPS")
|
|
90
|
+
Rel(spa, api, "Calls", "REST/JSON, HTTPS")
|
|
91
|
+
Rel(mobile, api, "Calls", "REST/JSON, HTTPS")
|
|
92
|
+
Rel(api, db, "Reads/Writes", "SQL, TCP")
|
|
93
|
+
Rel(api, cache, "Caches", "Redis Protocol")
|
|
94
|
+
Rel(api, queue, "Enqueues jobs", "Redis Protocol")
|
|
95
|
+
Rel(worker, queue, "Processes jobs", "Redis Protocol")
|
|
96
|
+
Rel(worker, db, "Reads/Writes", "SQL")
|
|
97
|
+
Rel(api, storage, "Stores files", "S3 API")
|
|
98
|
+
Rel(worker, email, "Sends via", "SMTP/API")
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Container Types:**
|
|
102
|
+
|
|
103
|
+
| Type | Mermaid | Example |
|
|
104
|
+
|------|---------|---------|
|
|
105
|
+
| Application | `Container` | Web app, API, Worker |
|
|
106
|
+
| Database | `ContainerDb` | PostgreSQL, MongoDB |
|
|
107
|
+
| Queue | `ContainerQueue` | RabbitMQ, Redis Queue |
|
|
108
|
+
| External | `System_Ext` | Third-party APIs |
|
|
109
|
+
|
|
110
|
+
**Правила:**
|
|
111
|
+
- Один Container = один deployable unit
|
|
112
|
+
- Показывать технологии
|
|
113
|
+
- Указывать протоколы связи
|
|
114
|
+
- Группировать в System_Boundary
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Level 3: Component Diagram
|
|
119
|
+
|
|
120
|
+
**Цель:** Показать внутреннюю структуру контейнера.
|
|
121
|
+
|
|
122
|
+
**Когда создавать:**
|
|
123
|
+
- Для Core bounded contexts (обязательно)
|
|
124
|
+
- Для сложных контейнеров
|
|
125
|
+
- Когда нужна детализация для разработки
|
|
126
|
+
|
|
127
|
+
**Mermaid Template:**
|
|
128
|
+
|
|
129
|
+
```mermaid
|
|
130
|
+
C4Component
|
|
131
|
+
title Component Diagram: API Server - [Bounded Context]
|
|
132
|
+
|
|
133
|
+
Container_Boundary(api, "API Server") {
|
|
134
|
+
Component(ctrl, "REST Controllers", "Express Router", "HTTP request handling")
|
|
135
|
+
Component(auth, "Auth Middleware", "Passport.js", "Authentication & authorization")
|
|
136
|
+
Component(app, "Application Services", "TypeScript", "Use case orchestration")
|
|
137
|
+
Component(domain, "Domain Model", "TypeScript", "Business logic & rules")
|
|
138
|
+
Component(repo, "Repositories", "TypeScript", "Data access abstraction")
|
|
139
|
+
Component(events, "Event Publisher", "TypeScript", "Domain event publishing")
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
ContainerDb(db, "Database", "PostgreSQL")
|
|
143
|
+
ContainerQueue(queue, "Message Queue", "Redis")
|
|
144
|
+
|
|
145
|
+
Rel(ctrl, auth, "Uses")
|
|
146
|
+
Rel(ctrl, app, "Calls")
|
|
147
|
+
Rel(app, domain, "Uses")
|
|
148
|
+
Rel(app, repo, "Uses")
|
|
149
|
+
Rel(app, events, "Publishes to")
|
|
150
|
+
Rel(repo, db, "SQL")
|
|
151
|
+
Rel(events, queue, "Publishes")
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Layered Architecture Components:**
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
┌─────────────────────────────────────────┐
|
|
158
|
+
│ Controllers/Routes │ ← HTTP handling
|
|
159
|
+
├─────────────────────────────────────────┤
|
|
160
|
+
│ Application Services │ ← Use case orchestration
|
|
161
|
+
├─────────────────────────────────────────┤
|
|
162
|
+
│ Domain Model │ ← Business logic
|
|
163
|
+
├─────────────────────────────────────────┤
|
|
164
|
+
│ Repositories / Gateways │ ← Data access
|
|
165
|
+
└─────────────────────────────────────────┘
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**Правила:**
|
|
169
|
+
- Один diagram per Bounded Context
|
|
170
|
+
- Показывать слои архитектуры
|
|
171
|
+
- Указывать направление зависимостей
|
|
172
|
+
- Не более 15 компонентов
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Mapping to Bounded Contexts
|
|
177
|
+
|
|
178
|
+
**Правило:** Один Container может содержать multiple Bounded Contexts, или один Bounded Context может span multiple Containers.
|
|
179
|
+
|
|
180
|
+
**Modular Monolith:**
|
|
181
|
+
```
|
|
182
|
+
Container: API Server
|
|
183
|
+
├── Bounded Context: Orders
|
|
184
|
+
│ └── Components: OrderController, OrderService, OrderRepository
|
|
185
|
+
├── Bounded Context: Catalog
|
|
186
|
+
│ └── Components: CatalogController, CatalogService, CatalogRepository
|
|
187
|
+
└── Bounded Context: Identity
|
|
188
|
+
└── Components: AuthController, UserService, UserRepository
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
**Microservices:**
|
|
192
|
+
```
|
|
193
|
+
Container: Order Service → Bounded Context: Orders
|
|
194
|
+
Container: Catalog Service → Bounded Context: Catalog
|
|
195
|
+
Container: Identity Service → Bounded Context: Identity
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Mermaid Syntax Reference
|
|
201
|
+
|
|
202
|
+
### Elements
|
|
203
|
+
|
|
204
|
+
```mermaid
|
|
205
|
+
%% Persons
|
|
206
|
+
Person(alias, "Label", "Description")
|
|
207
|
+
Person_Ext(alias, "Label", "Description")
|
|
208
|
+
|
|
209
|
+
%% Systems
|
|
210
|
+
System(alias, "Label", "Description")
|
|
211
|
+
System_Ext(alias, "Label", "Description")
|
|
212
|
+
|
|
213
|
+
%% Containers
|
|
214
|
+
Container(alias, "Label", "Technology", "Description")
|
|
215
|
+
ContainerDb(alias, "Label", "Technology", "Description")
|
|
216
|
+
ContainerQueue(alias, "Label", "Technology", "Description")
|
|
217
|
+
|
|
218
|
+
%% Components
|
|
219
|
+
Component(alias, "Label", "Technology", "Description")
|
|
220
|
+
|
|
221
|
+
%% Boundaries
|
|
222
|
+
System_Boundary(alias, "Label") { ... }
|
|
223
|
+
Container_Boundary(alias, "Label") { ... }
|
|
224
|
+
|
|
225
|
+
%% Relationships
|
|
226
|
+
Rel(from, to, "Label")
|
|
227
|
+
Rel(from, to, "Label", "Technology")
|
|
228
|
+
Rel_D(from, to, "Label") %% Down
|
|
229
|
+
Rel_U(from, to, "Label") %% Up
|
|
230
|
+
Rel_L(from, to, "Label") %% Left
|
|
231
|
+
Rel_R(from, to, "Label") %% Right
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Styling
|
|
235
|
+
|
|
236
|
+
```mermaid
|
|
237
|
+
%% Update styles
|
|
238
|
+
UpdateElementStyle(alias, $bgColor="blue", $fontColor="white")
|
|
239
|
+
UpdateRelStyle(from, to, $textColor="blue", $lineColor="blue")
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Best Practices
|
|
245
|
+
|
|
246
|
+
1. **Start at Level 1** — Always create System Context first
|
|
247
|
+
2. **Progressive Detail** — Add levels only when needed
|
|
248
|
+
3. **Consistent Notation** — Use same symbols throughout
|
|
249
|
+
4. **Show Key Relationships** — Don't include every connection
|
|
250
|
+
5. **Label with Technology** — Specify frameworks, protocols
|
|
251
|
+
6. **Version Control** — Store diagrams as code (Mermaid)
|
|
252
|
+
7. **Keep Updated** — Diagrams should reflect current architecture
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## Checklist
|
|
257
|
+
|
|
258
|
+
### Level 1 (System Context)
|
|
259
|
+
- [ ] All user personas shown
|
|
260
|
+
- [ ] System clearly identified
|
|
261
|
+
- [ ] All external systems shown
|
|
262
|
+
- [ ] Relationships labeled with protocol/format
|
|
263
|
+
- [ ] ≤15 elements total
|
|
264
|
+
|
|
265
|
+
### Level 2 (Container)
|
|
266
|
+
- [ ] All containers shown (apps, DBs, queues)
|
|
267
|
+
- [ ] Technologies specified
|
|
268
|
+
- [ ] Relationships show data flow
|
|
269
|
+
- [ ] Grouped in System_Boundary
|
|
270
|
+
- [ ] Maps to deployment units
|
|
271
|
+
|
|
272
|
+
### Level 3 (Component)
|
|
273
|
+
- [ ] Created for Core bounded contexts
|
|
274
|
+
- [ ] Shows internal structure
|
|
275
|
+
- [ ] Layers clearly visible
|
|
276
|
+
- [ ] ≤15 components per diagram
|
|
277
|
+
- [ ] Dependencies flow downward
|