eva4j 1.0.17 → 1.0.18
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/AGENTS.md +2 -0
- package/DOMAIN_YAML_GUIDE.md +3 -1
- package/QUICK_REFERENCE.md +8 -4
- package/bin/eva4j.js +70 -2
- package/config/defaults.json +1 -0
- package/docs/CAMUNDA_DMN_GUIDE.md +1380 -0
- package/docs/KAFKA_PRODUCTION_CONFIG.md +441 -0
- package/docs/RABBITMQ_PRODUCTION_CONFIG.md +227 -0
- package/docs/commands/ADD_RABBITMQ_CLIENT.md +192 -0
- package/docs/commands/EVALUATE_SYSTEM.md +272 -8
- package/docs/commands/GENERATE_RABBITMQ_EVENT.md +341 -0
- package/docs/commands/GENERATE_RABBITMQ_LISTENER.md +595 -0
- package/docs/commands/GENERATE_TEMPORAL_FLOW.md +52 -12
- package/docs/commands/INDEX.md +27 -3
- package/docs/prototype/TEMPORAL_COMMUNICATION_PATTERNS.md +731 -0
- package/docs/prototype/TEMPORAL_DESIGN_METHODOLOGY.md +740 -0
- package/docs/prototype/system/RISKS.md +277 -0
- package/docs/prototype/system/customers.yaml +133 -0
- package/docs/prototype/system/inventory.yaml +109 -0
- package/docs/prototype/system/notifications.yaml +131 -0
- package/docs/prototype/system/orders.yaml +241 -0
- package/docs/prototype/system/payments.yaml +256 -0
- package/docs/prototype/system/products.yaml +168 -0
- package/docs/prototype/system/system.yaml +269 -0
- package/examples/domain-endpoints-multi-aggregate.yaml +140 -0
- package/examples/domain-read-models.yaml +2 -2
- package/examples/system/customer.yaml +89 -0
- package/examples/system/orders.yaml +119 -0
- package/examples/system/product.yaml +27 -0
- package/examples/system/system.yaml +80 -0
- package/package.json +1 -1
- package/src/agents/design-gap-analyst-temporal.agent.md +452 -0
- package/src/agents/design-gap-analyst.agent.md +383 -0
- package/src/agents/design-reviewer-temporal.agent.md +412 -0
- package/src/agents/design-reviewer.agent.md +31 -5
- package/src/agents/implement-use-cases.prompt.md +179 -0
- package/src/agents/ux-gap-analyst.agent.md +412 -0
- package/src/commands/add-rabbitmq-client.js +261 -0
- package/src/commands/add-temporal-client.js +22 -2
- package/src/commands/build.js +267 -11
- package/src/commands/evaluate-system.js +700 -13
- package/src/commands/generate-entities.js +308 -16
- package/src/commands/generate-rabbitmq-event.js +665 -0
- package/src/commands/generate-rabbitmq-listener.js +205 -0
- package/src/commands/generate-temporal-activity.js +968 -34
- package/src/commands/generate-temporal-flow.js +95 -38
- package/src/commands/generate-temporal-system.js +708 -0
- package/src/skills/build-system-yaml/SKILL.md +222 -2
- package/src/skills/build-system-yaml/references/domain-yaml-spec.md +50 -4
- package/src/skills/build-system-yaml/references/module-spec.md +57 -8
- package/src/skills/build-temporal-system/SKILL.md +752 -0
- package/src/skills/build-temporal-system/references/temporal-communication-patterns.md +167 -0
- package/src/skills/build-temporal-system/references/temporal-domain-yaml-spec.md +449 -0
- package/src/skills/build-temporal-system/references/temporal-module-spec.md +353 -0
- package/src/skills/build-temporal-system/references/temporal-system-yaml-spec.md +326 -0
- package/src/skills/implement-use-case/SKILL.md +350 -0
- package/src/skills/implement-use-case/references/use-case-patterns.md +980 -0
- package/src/skills/requirements-elicitation/SKILL.md +228 -0
- package/src/skills/requirements-elicitation/references/interview-framework.md +260 -0
- package/src/skills/requirements-elicitation/references/output-templates.md +368 -0
- package/src/utils/bounded-context-diagram.js +844 -0
- package/src/utils/domain-validator.js +266 -4
- package/src/utils/naming.js +10 -0
- package/src/utils/system-validator.js +169 -11
- package/src/utils/system-yaml-parser.js +318 -0
- package/src/utils/temporal-validator.js +497 -0
- package/src/utils/yaml-to-entity.js +10 -7
- package/templates/aggregate/DomainEventHandler.java.ejs +116 -22
- package/templates/aggregate/JpaAggregateRoot.java.ejs +2 -2
- package/templates/aggregate/JpaEntity.java.ejs +2 -2
- package/templates/base/docker/rabbitmq-services.yaml.ejs +12 -0
- package/templates/base/resources/parameters/develop/kafka.yaml.ejs +5 -0
- package/templates/base/resources/parameters/develop/rabbitmq.yaml.ejs +15 -0
- package/templates/base/resources/parameters/develop/temporal.yaml.ejs +0 -3
- package/templates/base/resources/parameters/local/kafka.yaml.ejs +5 -0
- package/templates/base/resources/parameters/local/rabbitmq.yaml.ejs +15 -0
- package/templates/base/resources/parameters/local/temporal.yaml.ejs +0 -3
- package/templates/base/resources/parameters/production/kafka.yaml.ejs +39 -8
- package/templates/base/resources/parameters/production/rabbitmq.yaml.ejs +32 -0
- package/templates/base/resources/parameters/production/temporal.yaml.ejs +0 -3
- package/templates/base/resources/parameters/test/kafka.yaml.ejs +12 -6
- package/templates/base/resources/parameters/test/rabbitmq.yaml.ejs +15 -0
- package/templates/base/resources/parameters/test/temporal.yaml.ejs +0 -3
- package/templates/base/root/AGENTS.md.ejs +1 -1
- package/templates/crud/EndpointsController.java.ejs +1 -1
- package/templates/crud/ScaffoldCommand.java.ejs +5 -2
- package/templates/crud/ScaffoldCommandHandler.java.ejs +3 -1
- package/templates/crud/ScaffoldQuery.java.ejs +5 -2
- package/templates/crud/ScaffoldQueryHandler.java.ejs +3 -1
- package/templates/crud/SubEntityRemoveCommand.java.ejs +1 -1
- package/templates/evaluate/report.html.ejs +1447 -90
- package/templates/kafka-event/KafkaConfigBean.java.ejs +1 -1
- package/templates/kafka-event/KafkaMessageBroker.java.ejs +3 -3
- package/templates/ports/PortAclMapper.java.ejs +35 -0
- package/templates/ports/PortFeignAdapter.java.ejs +7 -22
- package/templates/ports/PortFeignClient.java.ejs +4 -0
- package/templates/ports/PortResponseDto.java.ejs +1 -1
- package/templates/rabbitmq-event/RabbitConfigBean.java.ejs +33 -0
- package/templates/rabbitmq-event/RabbitConfigExchange.java.ejs +12 -0
- package/templates/rabbitmq-event/RabbitMessageBroker.java.ejs +35 -0
- package/templates/rabbitmq-event/RabbitMessageBrokerMethod.java.ejs +9 -0
- package/templates/rabbitmq-listener/RabbitConfigConsumerBean.java.ejs +33 -0
- package/templates/rabbitmq-listener/RabbitConfigConsumerExchange.java.ejs +12 -0
- package/templates/rabbitmq-listener/RabbitListenerClass.java.ejs +82 -0
- package/templates/rabbitmq-listener/RabbitListenerSimple.java.ejs +56 -0
- package/templates/read-model/ReadModelJpa.java.ejs +1 -1
- package/templates/read-model/ReadModelJpaRepository.java.ejs +2 -0
- package/templates/read-model/ReadModelRabbitListener.java.ejs +71 -0
- package/templates/read-model/ReadModelRepositoryImpl.java.ejs +9 -5
- package/templates/read-model/ReadModelSyncHandler.java.ejs +2 -0
- package/templates/shared/configurations/kafkaConfig/KafkaConfig.java.ejs +18 -4
- package/templates/shared/configurations/rabbitmqConfig/RabbitMQConfig.java.ejs +100 -0
- package/templates/shared/configurations/temporalConfig/TemporalConfig.java.ejs +2 -64
- package/templates/shared/configurations/temporalConfig/TemporalWorkerFactoryLifecycle.java.ejs +41 -0
- package/templates/temporal-activity/ActivityImpl.java.ejs +68 -2
- package/templates/temporal-activity/ActivityInput.java.ejs +14 -0
- package/templates/temporal-activity/ActivityInterface.java.ejs +7 -1
- package/templates/temporal-activity/ActivityOutput.java.ejs +14 -0
- package/templates/temporal-activity/NestedType.java.ejs +12 -0
- package/templates/temporal-activity/SharedActivityInput.java.ejs +14 -0
- package/templates/temporal-activity/SharedActivityInterface.java.ejs +15 -0
- package/templates/temporal-activity/SharedActivityOutput.java.ejs +14 -0
- package/templates/temporal-activity/SharedNestedType.java.ejs +12 -0
- package/templates/temporal-flow/ModuleHeavyActivity.java.ejs +6 -0
- package/templates/temporal-flow/ModuleLightActivity.java.ejs +6 -0
- package/templates/temporal-flow/ModuleTemporalWorkerConfig.java.ejs +58 -0
- package/templates/temporal-flow/WorkFlowImpl.java.ejs +172 -12
- package/templates/temporal-flow/WorkFlowInput.java.ejs +11 -0
- package/templates/temporal-flow/WorkFlowInterface.java.ejs +5 -4
- package/templates/temporal-flow/WorkFlowService.java.ejs +42 -12
- package/COMMAND_EVALUATION.md +0 -911
- package/test-c2010.js +0 -49
- package/test-update-compat.js +0 -109
- package/test-update-lifecycle.js +0 -121
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
# Output Templates — Requirements Elicitation
|
|
2
|
+
|
|
3
|
+
Templates exactos para los tres artefactos generados en la Fase 4. Todo contenido en inglés.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Template 1: FUNCTIONAL_REQUIREMENTS.md
|
|
8
|
+
|
|
9
|
+
```markdown
|
|
10
|
+
# Functional Requirements — [Product Name]
|
|
11
|
+
|
|
12
|
+
> Generated by requirements-elicitation skill. Intended as input for build-system-yaml.
|
|
13
|
+
> Last updated: [date]
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Product Overview
|
|
18
|
+
|
|
19
|
+
**Problem Statement:** [1–2 sentences describing the core problem this product solves]
|
|
20
|
+
|
|
21
|
+
**Target Users:** [Who this is built for, in business terms]
|
|
22
|
+
|
|
23
|
+
**Core Value Proposition:** [The "aha moment" — what the user gains from using this system]
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Actors
|
|
28
|
+
|
|
29
|
+
| Actor | Description | Primary Actions |
|
|
30
|
+
|-------|-------------|-----------------|
|
|
31
|
+
| [Actor1] | [Role description] | [Comma-separated key actions] |
|
|
32
|
+
| [Actor2] | [Role description] | [Comma-separated key actions] |
|
|
33
|
+
| [System/Cron] | [If applicable] | [Automated actions] |
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Modules (Bounded Contexts)
|
|
38
|
+
|
|
39
|
+
> These are the suggested bounded contexts derived from the functional requirements.
|
|
40
|
+
> The build-system-yaml skill will use these as starting points for module design.
|
|
41
|
+
|
|
42
|
+
| Module | Responsibility | Key Entities |
|
|
43
|
+
|--------|---------------|--------------|
|
|
44
|
+
| [module-name] | [One-line responsibility] | [Entity1, Entity2] |
|
|
45
|
+
| [module-name] | [One-line responsibility] | [Entity1, Entity2] |
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Use Cases
|
|
50
|
+
|
|
51
|
+
### UC-001 — [Use Case Name]
|
|
52
|
+
|
|
53
|
+
**Actor:** [Who performs this action]
|
|
54
|
+
**Module:** [Which module handles this]
|
|
55
|
+
**Trigger:** [What initiates this use case]
|
|
56
|
+
|
|
57
|
+
**Preconditions:**
|
|
58
|
+
- [Condition that must be true before this can happen]
|
|
59
|
+
- [Another precondition]
|
|
60
|
+
|
|
61
|
+
**Main Flow:**
|
|
62
|
+
1. [Step 1]
|
|
63
|
+
2. [Step 2]
|
|
64
|
+
3. [Step 3]
|
|
65
|
+
...
|
|
66
|
+
|
|
67
|
+
**Postconditions:**
|
|
68
|
+
- [What is true after this succeeds]
|
|
69
|
+
- [Side effects: notifications sent, states changed, records created]
|
|
70
|
+
|
|
71
|
+
**Business Rules Applied:**
|
|
72
|
+
- BR-001: [Reference to validation rule]
|
|
73
|
+
- BR-005: [Reference to another rule]
|
|
74
|
+
|
|
75
|
+
**Alternative Flows:**
|
|
76
|
+
- [Condition] → [What happens instead]
|
|
77
|
+
- [Error condition] → [Error handling]
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
### UC-002 — [Use Case Name]
|
|
82
|
+
|
|
83
|
+
[Same structure as above]
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Entity Lifecycles
|
|
88
|
+
|
|
89
|
+
### [EntityName] State Machine
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
[INITIAL_STATE] --(create: Actor)--> [STATE_A]
|
|
93
|
+
[STATE_A] --(action: Actor / condition)--> [STATE_B]
|
|
94
|
+
[STATE_A] --(cancel: Actor)--> [CANCELLED]
|
|
95
|
+
[STATE_B] --(complete: Actor/System)--> [COMPLETED]
|
|
96
|
+
[CANCELLED] — terminal state, no further transitions
|
|
97
|
+
[COMPLETED] — terminal state, no further transitions
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**State descriptions:**
|
|
101
|
+
- `INITIAL_STATE` — [What this state means in business terms]
|
|
102
|
+
- `STATE_A` — [Business meaning]
|
|
103
|
+
- `STATE_B` — [Business meaning]
|
|
104
|
+
- `CANCELLED` — [Under what conditions an entity reaches this state]
|
|
105
|
+
- `COMPLETED` — [What completion means for this entity]
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## External Integrations
|
|
110
|
+
|
|
111
|
+
| System | Type | Purpose | Failure Behavior |
|
|
112
|
+
|--------|------|---------|-----------------|
|
|
113
|
+
| [Payment Gateway] | Sync HTTP | Process payments | Retry 3x, then mark order as payment_failed |
|
|
114
|
+
| [Email Service] | Async | Send notifications | Queue for retry, non-blocking |
|
|
115
|
+
| [ERP System] | Async | Sync inventory | Log failure, alert ops team |
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Non-Functional Requirements (Business-Defined)
|
|
120
|
+
|
|
121
|
+
- **Availability:** [e.g., "The checkout process must be available 99.9% of the time"]
|
|
122
|
+
- **Data Retention:** [e.g., "Order history must be kept for 7 years"]
|
|
123
|
+
- **Audit:** [e.g., "All status changes must be logged with who and when"]
|
|
124
|
+
- **Notifications:** [e.g., "Customers must receive email within 5 minutes of order placement"]
|
|
125
|
+
- **Concurrency:** [e.g., "Stock reservation must be atomic — two simultaneous purchases cannot both succeed for the last item"]
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Template 2: PRODUCT_FLOWS.md
|
|
131
|
+
|
|
132
|
+
```markdown
|
|
133
|
+
# Product Flows — [Product Name]
|
|
134
|
+
|
|
135
|
+
> Captures step-by-step interactions between actors and the system.
|
|
136
|
+
> Includes happy paths, alternative flows, and edge cases per actor.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Actor: [Actor1 Name]
|
|
141
|
+
|
|
142
|
+
### Flow 1 — [Main Flow Name]
|
|
143
|
+
|
|
144
|
+
**Goal:** [What the actor is trying to achieve]
|
|
145
|
+
**Entry Point:** [Where/how the flow starts]
|
|
146
|
+
**Success Outcome:** [What success looks like for this actor]
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
Step 1: [Actor] [verb] [object]
|
|
150
|
+
→ System [response/validation]
|
|
151
|
+
|
|
152
|
+
Step 2: [Actor] [verb] [object]
|
|
153
|
+
→ System [response/validation]
|
|
154
|
+
→ System triggers: [background action, notification, state change]
|
|
155
|
+
|
|
156
|
+
Step 3: ...
|
|
157
|
+
|
|
158
|
+
✅ Success: [Final state / confirmation to user]
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
**Alternative Path — [Condition]:**
|
|
162
|
+
```
|
|
163
|
+
At Step [N]: [Condition occurs]
|
|
164
|
+
→ System: [Response]
|
|
165
|
+
→ [Actor]: [Options presented]
|
|
166
|
+
→ Flow continues at Step [M] / Flow ends with [outcome]
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
**Error Path — [Error Condition]:**
|
|
170
|
+
```
|
|
171
|
+
At Step [N]: [Error condition]
|
|
172
|
+
→ System: [Error message / recovery action]
|
|
173
|
+
→ [Actor]: [What they see / can do]
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
### Flow 2 — [Another Flow for same actor]
|
|
179
|
+
|
|
180
|
+
[Same structure]
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Actor: [Actor2 Name]
|
|
185
|
+
|
|
186
|
+
### Flow 1 — [Flow Name]
|
|
187
|
+
|
|
188
|
+
[Same structure]
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## System-Initiated Flows (Automated)
|
|
193
|
+
|
|
194
|
+
### Auto-Flow 1 — [Flow Name]
|
|
195
|
+
|
|
196
|
+
**Trigger:** [What event or schedule initiates this]
|
|
197
|
+
**Actors notified:** [Who receives output of this flow]
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
Trigger: [Event / schedule]
|
|
201
|
+
→ System: [Action 1]
|
|
202
|
+
→ System: [Action 2]
|
|
203
|
+
→ Notification sent to: [Actor] via [channel]
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Cross-Actor Flows (Multiple actors involved)
|
|
209
|
+
|
|
210
|
+
### [Flow Name] — [Actor1] initiates, [Actor2] approves
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
[Actor1]:
|
|
214
|
+
Step 1: [Creates/submits something]
|
|
215
|
+
→ System: [Saves, notifies Actor2]
|
|
216
|
+
|
|
217
|
+
[Actor2]:
|
|
218
|
+
Step 2: Reviews [what was submitted]
|
|
219
|
+
→ Decision: Approve / Reject
|
|
220
|
+
|
|
221
|
+
If Approve:
|
|
222
|
+
→ System: [State change, notification to Actor1]
|
|
223
|
+
|
|
224
|
+
If Reject:
|
|
225
|
+
→ System: [State change, notification to Actor1 with reason]
|
|
226
|
+
|
|
227
|
+
[Actor1]:
|
|
228
|
+
Step 3: [Receives notification, takes follow-up action if needed]
|
|
229
|
+
```
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Template 3: BUSINESS_RULES.md
|
|
235
|
+
|
|
236
|
+
```markdown
|
|
237
|
+
# Business Rules — [Product Name]
|
|
238
|
+
|
|
239
|
+
> Defines all business invariants, validation rules, and constraint enforcement logic.
|
|
240
|
+
> These rules are the source of truth for what the system must enforce.
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Business Rules Reference
|
|
245
|
+
|
|
246
|
+
| ID | Rule | Context | Enforcement Point | Violation Response |
|
|
247
|
+
|----|------|---------|-------------------|-------------------|
|
|
248
|
+
| BR-001 | [Rule description] | [When it applies] | [Create / Update / Transition] | [Error message / behavior] |
|
|
249
|
+
| BR-002 | [Rule description] | [When it applies] | [Create / Update / Transition] | [Error message / behavior] |
|
|
250
|
+
| BR-003 | [Rule description] | [When it applies] | [Create / Update / Transition] | [Error message / behavior] |
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## Validation Rules by Operation
|
|
255
|
+
|
|
256
|
+
### [UseCase / Operation Name]
|
|
257
|
+
|
|
258
|
+
**Input validations** (enforced before processing):
|
|
259
|
+
|
|
260
|
+
| Field | Rule | Error if violated |
|
|
261
|
+
|-------|------|-------------------|
|
|
262
|
+
| [fieldName] | Must not be null | "Field X is required" |
|
|
263
|
+
| [fieldName] | Must be positive | "Amount must be greater than 0" |
|
|
264
|
+
| [fieldName] | Must match pattern | "Invalid format for field X" |
|
|
265
|
+
|
|
266
|
+
**Business validations** (enforced after input parsing, against domain state):
|
|
267
|
+
|
|
268
|
+
| Rule | Check | Error if violated |
|
|
269
|
+
|------|-------|-------------------|
|
|
270
|
+
| BR-001 | [What is checked] | "[Business error message]" |
|
|
271
|
+
| BR-004 | [What is checked] | "[Business error message]" |
|
|
272
|
+
|
|
273
|
+
**Post-conditions** (enforced after operation completes):
|
|
274
|
+
- [State guaranteed to be true after success]
|
|
275
|
+
- [Side effect guaranteed to occur]
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
### [Another UseCase]
|
|
280
|
+
|
|
281
|
+
[Same structure]
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## State Transition Guards
|
|
286
|
+
|
|
287
|
+
For each transition in the entity lifecycle, define the guard conditions:
|
|
288
|
+
|
|
289
|
+
### [EntityName] Transitions
|
|
290
|
+
|
|
291
|
+
| From State | To State | Trigger | Guard Conditions | Violation Response |
|
|
292
|
+
|-----------|---------|---------|-----------------|-------------------|
|
|
293
|
+
| [STATE_A] | [STATE_B] | [method/action] | [Condition that must be true] | [Error] |
|
|
294
|
+
| [STATE_A] | [CANCELLED] | cancel | Not in terminal state | "Cannot cancel a [state] [entity]" |
|
|
295
|
+
| [STATE_B] | [COMPLETED] | complete | [Condition] | [Error] |
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
## Concurrency & Race Conditions
|
|
300
|
+
|
|
301
|
+
| Scenario | Risk | Resolution Strategy |
|
|
302
|
+
|---------|------|---------------------|
|
|
303
|
+
| Two users buying the last item simultaneously | Oversell | Atomic stock reservation; first transaction wins, second gets "out of stock" error |
|
|
304
|
+
| Two admins approving the same request | Double processing | Optimistic locking; second approval fails with "already processed" |
|
|
305
|
+
| [Another scenario] | [Risk] | [How system handles it] |
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## Time-Based Rules
|
|
310
|
+
|
|
311
|
+
| Rule | Entity | Condition | Automatic Action |
|
|
312
|
+
|------|--------|-----------|-----------------|
|
|
313
|
+
| Order expires if unpaid | Order | 30 minutes after creation without payment | Status → EXPIRED; stock released |
|
|
314
|
+
| Reservation reminder | Appointment | 24 hours before scheduled time | Email/SMS sent to customer |
|
|
315
|
+
| [Other time rule] | [Entity] | [Condition] | [Action] |
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
## Cross-Module Validation Dependencies
|
|
320
|
+
|
|
321
|
+
When a module needs to validate data from another module before proceeding:
|
|
322
|
+
|
|
323
|
+
| Requesting Module | Data Needed From | Check | Failure Behavior |
|
|
324
|
+
|-----------------|-----------------|-------|-----------------|
|
|
325
|
+
| [orders] | [inventory] | Product exists and has stock | Return error "Product unavailable" |
|
|
326
|
+
| [bookings] | [schedules] | Time slot is available | Return error "Slot already taken" |
|
|
327
|
+
| [payments] | [orders] | Order is in correct state for payment | Return error "Order cannot be paid in current state" |
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
## Error Catalog
|
|
332
|
+
|
|
333
|
+
| Code | Message | HTTP Status | When Raised |
|
|
334
|
+
|------|---------|-------------|-------------|
|
|
335
|
+
| [ENTITY]_NOT_FOUND | "[Entity] with id {id} not found" | 404 | Any operation on non-existent entity |
|
|
336
|
+
| [ENTITY]_INVALID_STATE | "Cannot [action] a [state] [entity]" | 422 | State transition violation |
|
|
337
|
+
| [ENTITY]_VALIDATION_ERROR | "[Specific validation message]" | 400 | Input or business rule violation |
|
|
338
|
+
| INSUFFICIENT_[RESOURCE] | "[Resource] is insufficient for this operation" | 422 | Stock, balance, quota exceeded |
|
|
339
|
+
| CONCURRENT_MODIFICATION | "[Entity] was modified by another operation" | 409 | Optimistic locking failure |
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
## Notes on Using These Templates
|
|
345
|
+
|
|
346
|
+
### What to fill vs. what to leave for build-system-yaml
|
|
347
|
+
|
|
348
|
+
**Fill completely in this skill:**
|
|
349
|
+
- All use case names and their flows
|
|
350
|
+
- All business rules (with BR-XXX IDs)
|
|
351
|
+
- All state machine transitions including guards
|
|
352
|
+
- All external integrations and their failure behavior
|
|
353
|
+
- All error messages and codes
|
|
354
|
+
|
|
355
|
+
**Leave for build-system-yaml to decide:**
|
|
356
|
+
- Exact entity field names and types
|
|
357
|
+
- Whether to use Kafka, RabbitMQ, or HTTP for cross-module communication
|
|
358
|
+
- Database schema details
|
|
359
|
+
- API path structures (beyond what's in the flows)
|
|
360
|
+
- Exact module splits (the skill will propose split based on the requirements)
|
|
361
|
+
|
|
362
|
+
### Naming Conventions for Generated Files
|
|
363
|
+
|
|
364
|
+
- Use case names: `PascalCase` (e.g., `ConfirmOrder`, `CancelBooking`)
|
|
365
|
+
- Business rule IDs: `BR-NNN` (sequential, module-agnostic at this stage)
|
|
366
|
+
- State names: `SCREAMING_SNAKE_CASE` (maps directly to Java enums)
|
|
367
|
+
- Actor names: `PascalCase` (e.g., `Customer`, `Admin`, `DeliveryDriver`)
|
|
368
|
+
- Module names in tables: `kebab-case` (e.g., `orders`, `inventory`, `notifications`)
|