@eventmodelers/cli 1.0.36 → 1.0.37
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/package.json +1 -1
- package/shared/skills/learn-eventmodelers-api/SKILL.md +12 -10
- package/stacks/modeling-kit/templates/.claude/skills/add-next-slice/SKILL.md +2 -23
- package/stacks/modeling-kit/templates/.claude/skills/add-next-slice/references/api-fallback.md +11 -0
- package/stacks/modeling-kit/templates/.claude/skills/analyze-existing-model/SKILL.md +6 -57
- package/stacks/modeling-kit/templates/.claude/skills/analyze-existing-model/references/api-fallback.md +68 -0
- package/stacks/modeling-kit/templates/.claude/skills/attributes/SKILL.md +4 -61
- package/stacks/modeling-kit/templates/.claude/skills/attributes/references/api-fallback.md +39 -0
- package/stacks/modeling-kit/templates/.claude/skills/discover-storyboard/SKILL.md +9 -53
- package/stacks/modeling-kit/templates/.claude/skills/discover-storyboard/references/api-fallback.md +63 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-applying-conways-law/SKILL.md +9 -319
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-applying-conways-law/references/examples.md +329 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-brainstorming-events/SKILL.md +23 -199
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-brainstorming-events/references/api-fallback.md +97 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-brainstorming-events/references/examples.md +35 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-checking-completeness/SKILL.md +13 -410
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-checking-completeness/references/api-fallback.md +22 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-checking-completeness/references/examples.md +397 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-designing-automation-chains/SKILL.md +132 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-designing-automation-chains/references/api-fallback.md +21 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-designing-event-models/SKILL.md +9 -236
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-designing-event-models/references/examples.md +257 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-elaborating-scenarios/SKILL.md +28 -302
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-elaborating-scenarios/references/api-fallback.md +31 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-elaborating-scenarios/references/examples.md +216 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-identifying-inputs/SKILL.md +30 -343
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-identifying-inputs/references/api-fallback.md +79 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-identifying-inputs/references/examples.md +282 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-identifying-outputs/SKILL.md +51 -400
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-identifying-outputs/references/api-fallback.md +67 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-identifying-outputs/references/examples.md +273 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-optimizing-stream-design/SKILL.md +45 -152
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-optimizing-stream-design/references/domain-patterns.md +49 -90
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-optimizing-stream-design/references/patterns.md +64 -137
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-orchestrating-event-modeling/SKILL.md +74 -65
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-orchestrating-event-modeling/references/api-fallback.md +51 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-plotting-events/SKILL.md +1 -5
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-plotting-events/references/api-fallback.md +10 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-slicing-event-models/SKILL.md +19 -36
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-slicing-event-models/references/api-fallback.md +41 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-slicing-event-models/references/examples.md +12 -9
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-slicing-event-models/references/patterns.md +1 -10
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-storyboarding-events/SKILL.md +26 -332
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-storyboarding-events/references/api-fallback.md +77 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-storyboarding-events/references/examples.md +271 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-translating-external-events/SKILL.md +9 -294
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-translating-external-events/references/examples.md +306 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-validating-event-models/SKILL.md +12 -11
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-validating-event-models/references/api-fallback.md +14 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-validating-event-models-checklist/SKILL.md +6 -36
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-validating-event-models-checklist/references/api-fallback.md +14 -0
- package/stacks/modeling-kit/templates/.claude/skills/examples/SKILL.md +3 -110
- package/stacks/modeling-kit/templates/.claude/skills/examples/references/api-fallback.md +118 -0
- package/stacks/modeling-kit/templates/.claude/skills/handle-comment/SKILL.md +5 -25
- package/stacks/modeling-kit/templates/.claude/skills/handle-comment/references/api-fallback.md +35 -0
- package/stacks/modeling-kit/templates/.claude/skills/html-screen/SKILL.md +9 -44
- package/stacks/modeling-kit/templates/.claude/skills/html-screen/references/api-fallback.md +51 -0
- package/stacks/modeling-kit/templates/.claude/skills/place-element/SKILL.md +23 -183
- package/stacks/modeling-kit/templates/.claude/skills/place-element/references/api-fallback.md +193 -0
- package/stacks/modeling-kit/templates/.claude/skills/storyboard/SKILL.md +14 -81
- package/stacks/modeling-kit/templates/.claude/skills/storyboard/references/api-fallback.md +74 -0
- package/stacks/modeling-kit/templates/.claude/skills/storyboard-screen/SKILL.md +4 -45
- package/stacks/modeling-kit/templates/.claude/skills/storyboard-screen/references/api-fallback.md +44 -0
- package/stacks/modeling-kit/templates/.claude/skills/timeline/SKILL.md +19 -88
- package/stacks/modeling-kit/templates/.claude/skills/timeline/references/api-fallback.md +91 -0
- package/stacks/modeling-kit/templates/.claude/skills/update-prompt-status/SKILL.md +1 -9
- package/stacks/modeling-kit/templates/.claude/skills/update-prompt-status/references/api-fallback.md +14 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-integrating-legacy-systems/SKILL.md +0 -674
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-optimizing-stream-design/references/snapshotting.md +0 -204
package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-elaborating-scenarios/SKILL.md
CHANGED
|
@@ -294,52 +294,25 @@ collapsing into one reused schema for every command and read model alike.
|
|
|
294
294
|
|
|
295
295
|
For each command and view, write scenarios in Given-When-Then format:
|
|
296
296
|
|
|
297
|
+
The full worked example set for every category below (command scenarios, state validation, view scenarios, list-type views, error paths, compensation) lives in `references/examples.md` — one compact example per category is shown here.
|
|
298
|
+
|
|
297
299
|
### 1. Command Scenarios (Given-When-Then)
|
|
298
300
|
Specify command behavior:
|
|
299
301
|
|
|
300
302
|
```
|
|
301
|
-
Feature: Order Creation
|
|
302
|
-
|
|
303
303
|
Scenario: Create order successfully
|
|
304
304
|
Given a customer with ID "cust-123"
|
|
305
305
|
And products exist with IDs ["prod-1", "prod-2"]
|
|
306
|
-
And customer has valid shipping address
|
|
307
306
|
When the customer creates an order with items:
|
|
308
307
|
| productId | quantity | unitPrice |
|
|
309
308
|
| prod-1 | 2 | 50.00 |
|
|
310
|
-
| prod-2 | 1 | 30.00 |
|
|
311
309
|
Then the order should be created with status "Draft"
|
|
312
|
-
And
|
|
313
|
-
And an "OrderCreated" event is produced with:
|
|
314
|
-
| field | value |
|
|
315
|
-
| orderId | {uuid} |
|
|
316
|
-
| customerId | cust-123 |
|
|
317
|
-
| items | [...] |
|
|
318
|
-
| total | 130.00 |
|
|
319
|
-
| status | Draft |
|
|
310
|
+
And an "OrderCreated" event is produced with orderId, customerId, items, total, status
|
|
320
311
|
|
|
321
312
|
Scenario: Reject order with invalid customer
|
|
322
|
-
Given a customer ID "invalid-cust"
|
|
323
|
-
And no customer exists with that ID
|
|
324
|
-
When the customer tries to create an order
|
|
325
|
-
Then the command should be rejected
|
|
326
|
-
And the rejection reason is "Customer not found"
|
|
327
|
-
And no event is produced
|
|
328
|
-
|
|
329
|
-
Scenario: Reject order with empty items
|
|
330
|
-
Given a customer with ID "cust-123"
|
|
331
|
-
And an empty items list []
|
|
332
|
-
When the customer tries to create an order
|
|
333
|
-
Then the command should be rejected
|
|
334
|
-
And the rejection reason is "Order must contain items"
|
|
335
|
-
And no event is produced
|
|
336
|
-
|
|
337
|
-
Scenario: Reject order with invalid address
|
|
338
|
-
Given a customer with ID "cust-123"
|
|
339
|
-
And an incomplete shipping address (missing city)
|
|
313
|
+
Given a customer ID "invalid-cust" that doesn't exist
|
|
340
314
|
When the customer tries to create an order
|
|
341
|
-
Then the command should be rejected
|
|
342
|
-
And the rejection reason is "Invalid shipping address"
|
|
315
|
+
Then the command should be rejected, reason "Customer not found"
|
|
343
316
|
And no event is produced
|
|
344
317
|
```
|
|
345
318
|
|
|
@@ -347,99 +320,40 @@ And no event is produced
|
|
|
347
320
|
Specify how stream state affects command:
|
|
348
321
|
|
|
349
322
|
```
|
|
350
|
-
Feature: Order Confirmation
|
|
351
|
-
|
|
352
323
|
Scenario: Confirm order in Draft state
|
|
353
|
-
Given an order "order-456" in Draft state
|
|
354
|
-
And OrderCreated event exists
|
|
355
|
-
And no OrderConfirmed event exists
|
|
324
|
+
Given an order "order-456" in Draft state, OrderCreated event exists
|
|
356
325
|
When the customer confirms the order with payment method "card"
|
|
357
|
-
Then
|
|
358
|
-
And an "OrderConfirmed" event is produced with:
|
|
359
|
-
| field | value |
|
|
360
|
-
| orderId | order-456 |
|
|
361
|
-
| paymentMethod | card |
|
|
362
|
-
| confirmedAt | {timestamp} |
|
|
326
|
+
Then an "OrderConfirmed" event is produced with orderId, paymentMethod, confirmedAt
|
|
363
327
|
|
|
364
328
|
Scenario: Reject confirming already-confirmed order
|
|
365
|
-
Given an order "order-456" in Confirmed state
|
|
366
|
-
And OrderConfirmed event already exists
|
|
329
|
+
Given an order "order-456" in Confirmed state, OrderConfirmed event already exists
|
|
367
330
|
When the customer tries to confirm the order again
|
|
368
|
-
Then the command should be rejected
|
|
369
|
-
And the rejection reason is "Order already confirmed"
|
|
370
|
-
And no OrderConfirmed event is produced
|
|
371
|
-
|
|
372
|
-
Scenario: Reject confirming cancelled order
|
|
373
|
-
Given an order "order-456" in Cancelled state
|
|
374
|
-
And OrderCancelled event exists
|
|
375
|
-
When the customer tries to confirm the order
|
|
376
|
-
Then the command should be rejected
|
|
377
|
-
And the rejection reason is "Cannot confirm cancelled order"
|
|
378
|
-
And no event is produced
|
|
331
|
+
Then the command should be rejected, reason "Order already confirmed"
|
|
379
332
|
```
|
|
380
333
|
|
|
381
334
|
### 3. View Scenarios (Given-When-Then)
|
|
382
335
|
Specify how read models display data:
|
|
383
336
|
|
|
384
337
|
```
|
|
385
|
-
Feature: Order Status View
|
|
386
|
-
|
|
387
338
|
Scenario: Display order after creation
|
|
388
|
-
Given an OrderCreated event with
|
|
389
|
-
| field | value |
|
|
390
|
-
| orderId | order-789 |
|
|
391
|
-
| customerId | cust-123 |
|
|
392
|
-
| items | [{...}] |
|
|
393
|
-
| total | 150.00 |
|
|
339
|
+
Given an OrderCreated event with orderId, customerId, items, total
|
|
394
340
|
When the OrderStatusView processes this event
|
|
395
|
-
Then the view should display
|
|
396
|
-
| field | value |
|
|
397
|
-
| Order ID | order-789 |
|
|
398
|
-
| Status | Draft |
|
|
399
|
-
| Total | $150.00 |
|
|
400
|
-
| Items | 3 products |
|
|
401
|
-
| Created | {date} |
|
|
402
|
-
|
|
403
|
-
Scenario: Update status after confirmation
|
|
404
|
-
Given an OrderCreated event already processed
|
|
405
|
-
And OrderStatusView showing status "Draft"
|
|
406
|
-
When an OrderConfirmed event is received with:
|
|
407
|
-
| field | value |
|
|
408
|
-
| orderId | order-789 |
|
|
409
|
-
| confirmedAt | 2024-12-31T10:00:00Z |
|
|
410
|
-
Then the view should update to display:
|
|
411
|
-
| field | value |
|
|
412
|
-
| Status | Confirmed |
|
|
413
|
-
| Confirmed Date | 12/31/2024 10:00 AM |
|
|
341
|
+
Then the view should display Order ID, Status "Draft", Total, Items, Created
|
|
414
342
|
|
|
415
343
|
Scenario: Accumulate payment information
|
|
416
344
|
Given OrderConfirmed event processed (status=Confirmed)
|
|
417
|
-
When a PaymentAuthorized event arrives with
|
|
418
|
-
|
|
419
|
-
| orderId | order-789 |
|
|
420
|
-
| paymentId | pay-123 |
|
|
421
|
-
| authCode | AUTH-456 |
|
|
422
|
-
Then the view should accumulate:
|
|
423
|
-
| field | value |
|
|
424
|
-
| Payment ID | pay-123 |
|
|
425
|
-
| Auth Code | AUTH-456 |
|
|
426
|
-
| Payment Status | Authorized |
|
|
345
|
+
When a PaymentAuthorized event arrives with paymentId, authCode
|
|
346
|
+
Then the view should accumulate Payment ID, Auth Code, Payment Status "Authorized"
|
|
427
347
|
```
|
|
428
348
|
|
|
429
349
|
### 3b. List-type Read Model Scenarios
|
|
430
350
|
Specify expected rows and empty-list intent when the THEN readmodel is a list (`listElement: true`):
|
|
431
351
|
|
|
432
352
|
```
|
|
433
|
-
Feature: Product Catalog
|
|
434
|
-
|
|
435
353
|
Scenario: Products list shows all created products
|
|
436
|
-
Given a ProductCreated event with name "Shoes", index "0"
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
Then the list should contain:
|
|
440
|
-
| name | index | family_id |
|
|
441
|
-
| Shoes | 0 | 22222... |
|
|
442
|
-
| Clothing | 1 | 33333... |
|
|
354
|
+
Given a ProductCreated event with name "Shoes", index "0"
|
|
355
|
+
When the ProductList view processes this event
|
|
356
|
+
Then the list should contain: | name | index | ... | Shoes | 0 | ... |
|
|
443
357
|
|
|
444
358
|
Scenario: Products list is empty after last item is deleted
|
|
445
359
|
Given a ProductDeleted event for the last remaining item
|
|
@@ -451,61 +365,28 @@ Then the list should be empty
|
|
|
451
365
|
Specify how system handles failures:
|
|
452
366
|
|
|
453
367
|
```
|
|
454
|
-
Feature: Payment Authorization Failure
|
|
455
|
-
|
|
456
368
|
Scenario: Handle declined payment
|
|
457
369
|
Given an order "order-001" in Confirmed state
|
|
458
|
-
And customer initiates payment
|
|
459
370
|
When the payment gateway declines the card
|
|
460
|
-
Then a PaymentFailed event is produced with
|
|
461
|
-
| field | value |
|
|
462
|
-
| orderId | order-001 |
|
|
463
|
-
| reason | Card declined |
|
|
464
|
-
| timestamp | {now} |
|
|
465
|
-
|
|
466
|
-
Scenario: Update order view on payment failure
|
|
467
|
-
Given OrderStatusView shows status "Confirmed"
|
|
468
|
-
When PaymentFailed event arrives for order-001
|
|
469
|
-
Then the view should update:
|
|
470
|
-
| field | value |
|
|
471
|
-
| Payment Status | Failed |
|
|
472
|
-
| Failure Reason | Card declined |
|
|
473
|
-
| Retry Available | Yes |
|
|
371
|
+
Then a PaymentFailed event is produced with orderId, reason, timestamp
|
|
474
372
|
|
|
475
373
|
Scenario: Allow retry after payment failure
|
|
476
|
-
Given a PaymentFailed event exists
|
|
477
|
-
And order status is still "Confirmed"
|
|
374
|
+
Given a PaymentFailed event exists, order status is still "Confirmed"
|
|
478
375
|
When customer retries payment
|
|
479
376
|
Then the new AuthorizePayment command is accepted
|
|
480
|
-
And can produce new PaymentAuthorized event
|
|
481
377
|
```
|
|
482
378
|
|
|
483
379
|
### 5. Compensation Scenarios
|
|
484
380
|
Specify rollback/cancellation flows:
|
|
485
381
|
|
|
486
382
|
```
|
|
487
|
-
Feature: Order Cancellation
|
|
488
|
-
|
|
489
383
|
Scenario: Cancel order in Draft state
|
|
490
|
-
Given an order "order-555" in Draft state
|
|
491
|
-
And only OrderCreated event exists
|
|
384
|
+
Given an order "order-555" in Draft state, only OrderCreated event exists
|
|
492
385
|
When customer cancels the order with reason "Changed mind"
|
|
493
|
-
Then an OrderCancelled event is produced with
|
|
494
|
-
| field | value |
|
|
495
|
-
| orderId | order-555 |
|
|
496
|
-
| reason | Changed mind |
|
|
497
|
-
| cancelledAt | {timestamp} |
|
|
498
|
-
|
|
499
|
-
Scenario: Cannot cancel completed order
|
|
500
|
-
Given an order "order-555" in Delivered state
|
|
501
|
-
And DeliveryConfirmed event exists
|
|
502
|
-
When customer tries to cancel
|
|
503
|
-
Then the command should be rejected
|
|
504
|
-
And the rejection reason is "Cannot cancel delivered order"
|
|
386
|
+
Then an OrderCancelled event is produced with orderId, reason, cancelledAt
|
|
505
387
|
|
|
506
388
|
Scenario: Trigger compensation on cancellation
|
|
507
|
-
Given an order in Confirmed state
|
|
508
|
-
And PaymentAuthorized event exists
|
|
389
|
+
Given an order in Confirmed state, PaymentAuthorized event exists
|
|
509
390
|
When OrderCancelled event is produced
|
|
510
391
|
Then a RefundPayment command should be automatically triggered
|
|
511
392
|
And RefundInitiated event should follow
|
|
@@ -513,135 +394,7 @@ And RefundInitiated event should follow
|
|
|
513
394
|
|
|
514
395
|
## Output Format
|
|
515
396
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
````markdown
|
|
519
|
-
# Scenarios: [Domain Name]
|
|
520
|
-
|
|
521
|
-
## Commands
|
|
522
|
-
|
|
523
|
-
### Command: CreateOrder
|
|
524
|
-
|
|
525
|
-
**Description**: Customer creates a new order with items and shipping address.
|
|
526
|
-
|
|
527
|
-
#### Scenario 1: Successful Order Creation
|
|
528
|
-
```gherkin
|
|
529
|
-
Given a customer with ID "cust-123"
|
|
530
|
-
And products ["prod-1", "prod-2"] exist in catalog
|
|
531
|
-
And the shipping address is valid
|
|
532
|
-
When the customer creates an order:
|
|
533
|
-
| customerId | cust-123 |
|
|
534
|
-
| items | [{productId: prod-1, qty: 2}, {productId: prod-2, qty: 1}] |
|
|
535
|
-
| shippingAddress | {street, city, state, zip} |
|
|
536
|
-
Then the command succeeds
|
|
537
|
-
And an "OrderCreated" event is produced with all input data
|
|
538
|
-
And the order status is "Draft"
|
|
539
|
-
```
|
|
540
|
-
|
|
541
|
-
#### Scenario 2: Reject with Invalid Customer
|
|
542
|
-
```gherkin
|
|
543
|
-
Given a customer ID "invalid" that doesn't exist
|
|
544
|
-
When the customer tries to create an order
|
|
545
|
-
Then the command is rejected
|
|
546
|
-
And the error is "Customer not found"
|
|
547
|
-
And no event is produced
|
|
548
|
-
```
|
|
549
|
-
|
|
550
|
-
[Continue for each scenario]
|
|
551
|
-
|
|
552
|
-
---
|
|
553
|
-
|
|
554
|
-
### Command: ConfirmOrder
|
|
555
|
-
|
|
556
|
-
**Description**: Customer confirms order and selects payment method.
|
|
557
|
-
|
|
558
|
-
#### Scenario 1: Confirm Draft Order
|
|
559
|
-
```gherkin
|
|
560
|
-
Given an order in "Draft" state
|
|
561
|
-
And OrderCreated event exists
|
|
562
|
-
When the customer confirms with paymentMethod="card"
|
|
563
|
-
Then an "OrderConfirmed" event is produced
|
|
564
|
-
And the order status becomes "Confirmed"
|
|
565
|
-
```
|
|
566
|
-
|
|
567
|
-
#### Scenario 2: Prevent Duplicate Confirmation
|
|
568
|
-
```gherkin
|
|
569
|
-
Given an order already in "Confirmed" state
|
|
570
|
-
And OrderConfirmed event already exists
|
|
571
|
-
When the customer tries to confirm again
|
|
572
|
-
Then the command is rejected
|
|
573
|
-
And the error is "Order already confirmed"
|
|
574
|
-
And no new event is produced
|
|
575
|
-
```
|
|
576
|
-
|
|
577
|
-
---
|
|
578
|
-
|
|
579
|
-
## Views
|
|
580
|
-
|
|
581
|
-
### View: OrderStatusView
|
|
582
|
-
|
|
583
|
-
**Description**: Real-time order status display showing accumulated event data.
|
|
584
|
-
|
|
585
|
-
#### Scenario 1: Initial Display After Creation
|
|
586
|
-
```gherkin
|
|
587
|
-
Given an OrderCreated event with id, customer, items, total, address
|
|
588
|
-
When the view processes this event
|
|
589
|
-
Then the view displays:
|
|
590
|
-
- Order ID: order-123
|
|
591
|
-
- Status: Draft
|
|
592
|
-
- Total: $150.00
|
|
593
|
-
- Items: 3 products
|
|
594
|
-
- Customer: cust-456
|
|
595
|
-
```
|
|
596
|
-
|
|
597
|
-
#### Scenario 2: Update on Confirmation
|
|
598
|
-
```gherkin
|
|
599
|
-
Given the view displaying status="Draft"
|
|
600
|
-
When an OrderConfirmed event arrives
|
|
601
|
-
Then the view updates to:
|
|
602
|
-
- Status: Confirmed
|
|
603
|
-
- Confirmed At: {timestamp}
|
|
604
|
-
- Payment Method: (from event)
|
|
605
|
-
```
|
|
606
|
-
|
|
607
|
-
#### Scenario 3: Accumulate Payment Data
|
|
608
|
-
```gherkin
|
|
609
|
-
Given status="Confirmed"
|
|
610
|
-
When PaymentAuthorized event arrives
|
|
611
|
-
Then the view shows:
|
|
612
|
-
- Payment Status: Authorized
|
|
613
|
-
- Auth Code: (from event)
|
|
614
|
-
- Payment ID: (from event)
|
|
615
|
-
```
|
|
616
|
-
|
|
617
|
-
---
|
|
618
|
-
|
|
619
|
-
## Error Paths
|
|
620
|
-
|
|
621
|
-
### Scenario: Payment Decline
|
|
622
|
-
```gherkin
|
|
623
|
-
Given an order in "Confirmed" state
|
|
624
|
-
When payment gateway declines
|
|
625
|
-
Then PaymentFailed event is produced
|
|
626
|
-
And OrderStatusView updates to show:
|
|
627
|
-
- Payment Status: Failed
|
|
628
|
-
- Retry Available: true
|
|
629
|
-
```
|
|
630
|
-
|
|
631
|
-
---
|
|
632
|
-
|
|
633
|
-
## Compensation Flows
|
|
634
|
-
|
|
635
|
-
### Scenario: Order Cancellation with Refund
|
|
636
|
-
```gherkin
|
|
637
|
-
Given an order in "Confirmed" state
|
|
638
|
-
And PaymentAuthorized event exists
|
|
639
|
-
When OrderCancelled event is produced
|
|
640
|
-
Then a RefundPayment command is triggered
|
|
641
|
-
And RefundInitiated event follows
|
|
642
|
-
And inventory reservation is released
|
|
643
|
-
```
|
|
644
|
-
````
|
|
397
|
+
There is no markdown-document output for this step — the deliverable is the scenarios posted directly to the board's spec cells (see "Post Scenarios to Board" below), using the same command/view/list/error/compensation scenario shapes already illustrated in the Workflow section above (§1–5). Group scenarios under their command or view exactly as shown there; there's no separate presentation format to produce first.
|
|
645
398
|
|
|
646
399
|
## Post Scenarios to Board
|
|
647
400
|
|
|
@@ -656,11 +409,7 @@ Fetch all CHAPTER nodes to find the timeline.
|
|
|
656
409
|
mcp__eventmodelers__get_nodes { "boardId": "<BOARD_ID>", "type": "CHAPTER" }
|
|
657
410
|
```
|
|
658
411
|
|
|
659
|
-
**Fallback (no MCP):**
|
|
660
|
-
```bash
|
|
661
|
-
curl -s "$BASE_URL/api/org/$ORG_ID/boards/$BOARD_ID/nodes?type=CHAPTER" \
|
|
662
|
-
-H "x-token: $TOKEN"
|
|
663
|
-
```
|
|
412
|
+
**Fallback (no MCP):** see `references/api-fallback.md` — "Post Scenarios to Board — Step 1: Identify the Target Timeline and Column".
|
|
664
413
|
|
|
665
414
|
If there is more than one chapter, ask the user which timeline to target.
|
|
666
415
|
|
|
@@ -675,12 +424,7 @@ For each target timeline, call spec-info to discover the node IDs that may appea
|
|
|
675
424
|
mcp__eventmodelers__get_spec_info { "boardId": "<BOARD_ID>", "timelineId": "<TL>" }
|
|
676
425
|
```
|
|
677
426
|
|
|
678
|
-
**Fallback (no MCP):**
|
|
679
|
-
```bash
|
|
680
|
-
curl -s "$BASE_URL/api/org/$ORG_ID/boards/$BOARD_ID/timelines/$TL/spec-info" \
|
|
681
|
-
-H "x-token: $TOKEN"
|
|
682
|
-
# → { timelineId, elements: [{ id, title, type }] }
|
|
683
|
-
```
|
|
427
|
+
**Fallback (no MCP):** see `references/api-fallback.md` — "Post Scenarios to Board — Step 2: Load Valid Step Elements".
|
|
684
428
|
|
|
685
429
|
Build a lookup map: `title (lowercase) → { id, type }`. Use this to resolve scenario step names to node IDs.
|
|
686
430
|
|
|
@@ -700,22 +444,14 @@ mcp__eventmodelers__add_scenario {
|
|
|
700
444
|
"boardId": "<BOARD_ID>",
|
|
701
445
|
"timelineId": "<TL>",
|
|
702
446
|
"columnId": "<COL>",
|
|
703
|
-
"scenarios": [...scenario objects, same shape as below...]
|
|
447
|
+
"scenarios": [...scenario objects, same shape as below...],
|
|
448
|
+
"compact": true
|
|
704
449
|
}
|
|
705
450
|
```
|
|
451
|
+
Pass `compact: true` — you already hold every scenario object you sent, so the response only needs to confirm `{added, scenarioCount, isNewNode}`, not echo all of them back. Same for `add_storyline`. Across a full pass posting scenarios for every command and read model column, this is the bulk of the step's response tokens.
|
|
706
452
|
`given`/`when`/`then` are arrays of `{id, title?, type?, ...}` objects — **not** bare nodeId strings (this differs from the raw REST body shown in the fallback below). The examples in Steps 4b/4c/§Rejection already use this object shape; pass them straight through as the `scenarios` array. For a state-view scenario whose `when` needs to represent a query rather than a COMMAND, `when` may hold a single inline object that is **not** a board node: `{"id": "<generated-uuid>", "type": "QUERY", "title": "...", "fields": [{"name": "...", "example": "..."}]}`. Same server-side rules apply either way (see below).
|
|
707
453
|
|
|
708
|
-
**Fallback (no MCP):**
|
|
709
|
-
```bash
|
|
710
|
-
curl -s -X POST \
|
|
711
|
-
"$BASE_URL/api/org/$ORG_ID/boards/$BOARD_ID/timelines/$TL/columns/$COL/scenarios" \
|
|
712
|
-
-H "x-token: $TOKEN" \
|
|
713
|
-
-H "Content-Type: application/json" \
|
|
714
|
-
-d '[...scenario objects...]'
|
|
715
|
-
# → 201 { specNodeId, scenarios (all), added (count), isNewNode }
|
|
716
|
-
```
|
|
717
|
-
|
|
718
|
-
On `409` (duplicate title) or `400` (validation error), log the error and retry without the offending scenario. On `404`, check that the timeline and column IDs are correct.
|
|
454
|
+
**Fallback (no MCP):** see `references/api-fallback.md` — "Post Scenarios to Board — Step 4: Post All Scenarios for a Column in One Call".
|
|
719
455
|
|
|
720
456
|
**Rules enforced by the server (do not pre-validate — let the server reject):**
|
|
721
457
|
- `given`: EVENTs only
|
|
@@ -872,16 +608,6 @@ Bad:
|
|
|
872
608
|
Then there's an error
|
|
873
609
|
```
|
|
874
610
|
|
|
875
|
-
## Scenario Organization
|
|
876
|
-
|
|
877
|
-
1. **Happy Path**: Successful execution
|
|
878
|
-
2. **Validation Failures**: Invalid inputs
|
|
879
|
-
3. **State Violations**: Wrong pre-conditions
|
|
880
|
-
4. **Duplicate Actions**: Already processed
|
|
881
|
-
5. **Alternative Paths**: Different branches
|
|
882
|
-
6. **Error Handling**: Failures and recovery
|
|
883
|
-
7. **Compensation**: Rollback and cleanup
|
|
884
|
-
|
|
885
611
|
## Key Principles
|
|
886
612
|
|
|
887
613
|
1. **One Scenario = One Test**: Each scenario is testable
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Elaborating Scenarios — curl Fallback Calls
|
|
2
|
+
|
|
3
|
+
Only needed when MCP is not connected. Every call below has an MCP equivalent in the main SKILL.md — always prefer that.
|
|
4
|
+
|
|
5
|
+
## Post Scenarios to Board — Step 1: Identify the Target Timeline and Column
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
curl -s "$BASE_URL/api/org/$ORG_ID/boards/$BOARD_ID/nodes?type=CHAPTER" \
|
|
9
|
+
-H "x-token: $TOKEN"
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Post Scenarios to Board — Step 2: Load Valid Step Elements
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
curl -s "$BASE_URL/api/org/$ORG_ID/boards/$BOARD_ID/timelines/$TL/spec-info" \
|
|
16
|
+
-H "x-token: $TOKEN"
|
|
17
|
+
# → { timelineId, elements: [{ id, title, type }] }
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Post Scenarios to Board — Step 4: Post All Scenarios for a Column in One Call
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
curl -s -X POST \
|
|
24
|
+
"$BASE_URL/api/org/$ORG_ID/boards/$BOARD_ID/timelines/$TL/columns/$COL/scenarios" \
|
|
25
|
+
-H "x-token: $TOKEN" \
|
|
26
|
+
-H "Content-Type: application/json" \
|
|
27
|
+
-d '[...scenario objects...]'
|
|
28
|
+
# → 201 { specNodeId, scenarios (all), added (count), isNewNode }
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
On `409` (duplicate title) or `400` (validation error), log the error and retry without the offending scenario. On `404`, check that the timeline and column IDs are correct.
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# Elaborating Scenarios — Worked Examples
|
|
2
|
+
|
|
3
|
+
Full worked Given-When-Then examples for each scenario category, all drawn from one Order/Payment domain so the shapes are easy to compare. The main SKILL.md keeps one compact example per category — this file has the complete set.
|
|
4
|
+
|
|
5
|
+
## 1. Command Scenarios (Given-When-Then)
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Feature: Order Creation
|
|
9
|
+
|
|
10
|
+
Scenario: Create order successfully
|
|
11
|
+
Given a customer with ID "cust-123"
|
|
12
|
+
And products exist with IDs ["prod-1", "prod-2"]
|
|
13
|
+
And customer has valid shipping address
|
|
14
|
+
When the customer creates an order with items:
|
|
15
|
+
| productId | quantity | unitPrice |
|
|
16
|
+
| prod-1 | 2 | 50.00 |
|
|
17
|
+
| prod-2 | 1 | 30.00 |
|
|
18
|
+
Then the order should be created with status "Draft"
|
|
19
|
+
And the total should be calculated as 130.00
|
|
20
|
+
And an "OrderCreated" event is produced with:
|
|
21
|
+
| field | value |
|
|
22
|
+
| orderId | {uuid} |
|
|
23
|
+
| customerId | cust-123 |
|
|
24
|
+
| items | [...] |
|
|
25
|
+
| total | 130.00 |
|
|
26
|
+
| status | Draft |
|
|
27
|
+
|
|
28
|
+
Scenario: Reject order with invalid customer
|
|
29
|
+
Given a customer ID "invalid-cust"
|
|
30
|
+
And no customer exists with that ID
|
|
31
|
+
When the customer tries to create an order
|
|
32
|
+
Then the command should be rejected
|
|
33
|
+
And the rejection reason is "Customer not found"
|
|
34
|
+
And no event is produced
|
|
35
|
+
|
|
36
|
+
Scenario: Reject order with empty items
|
|
37
|
+
Given a customer with ID "cust-123"
|
|
38
|
+
And an empty items list []
|
|
39
|
+
When the customer tries to create an order
|
|
40
|
+
Then the command should be rejected
|
|
41
|
+
And the rejection reason is "Order must contain items"
|
|
42
|
+
And no event is produced
|
|
43
|
+
|
|
44
|
+
Scenario: Reject order with invalid address
|
|
45
|
+
Given a customer with ID "cust-123"
|
|
46
|
+
And an incomplete shipping address (missing city)
|
|
47
|
+
When the customer tries to create an order
|
|
48
|
+
Then the command should be rejected
|
|
49
|
+
And the rejection reason is "Invalid shipping address"
|
|
50
|
+
And no event is produced
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## 2. Command Scenarios — State Validation
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
Feature: Order Confirmation
|
|
57
|
+
|
|
58
|
+
Scenario: Confirm order in Draft state
|
|
59
|
+
Given an order "order-456" in Draft state
|
|
60
|
+
And OrderCreated event exists
|
|
61
|
+
And no OrderConfirmed event exists
|
|
62
|
+
When the customer confirms the order with payment method "card"
|
|
63
|
+
Then the order should be confirmed
|
|
64
|
+
And an "OrderConfirmed" event is produced with:
|
|
65
|
+
| field | value |
|
|
66
|
+
| orderId | order-456 |
|
|
67
|
+
| paymentMethod | card |
|
|
68
|
+
| confirmedAt | {timestamp} |
|
|
69
|
+
|
|
70
|
+
Scenario: Reject confirming already-confirmed order
|
|
71
|
+
Given an order "order-456" in Confirmed state
|
|
72
|
+
And OrderConfirmed event already exists
|
|
73
|
+
When the customer tries to confirm the order again
|
|
74
|
+
Then the command should be rejected
|
|
75
|
+
And the rejection reason is "Order already confirmed"
|
|
76
|
+
And no OrderConfirmed event is produced
|
|
77
|
+
|
|
78
|
+
Scenario: Reject confirming cancelled order
|
|
79
|
+
Given an order "order-456" in Cancelled state
|
|
80
|
+
And OrderCancelled event exists
|
|
81
|
+
When the customer tries to confirm the order
|
|
82
|
+
Then the command should be rejected
|
|
83
|
+
And the rejection reason is "Cannot confirm cancelled order"
|
|
84
|
+
And no event is produced
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## 3. View Scenarios (Given-When-Then)
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
Feature: Order Status View
|
|
91
|
+
|
|
92
|
+
Scenario: Display order after creation
|
|
93
|
+
Given an OrderCreated event with:
|
|
94
|
+
| field | value |
|
|
95
|
+
| orderId | order-789 |
|
|
96
|
+
| customerId | cust-123 |
|
|
97
|
+
| items | [{...}] |
|
|
98
|
+
| total | 150.00 |
|
|
99
|
+
When the OrderStatusView processes this event
|
|
100
|
+
Then the view should display:
|
|
101
|
+
| field | value |
|
|
102
|
+
| Order ID | order-789 |
|
|
103
|
+
| Status | Draft |
|
|
104
|
+
| Total | $150.00 |
|
|
105
|
+
| Items | 3 products |
|
|
106
|
+
| Created | {date} |
|
|
107
|
+
|
|
108
|
+
Scenario: Update status after confirmation
|
|
109
|
+
Given an OrderCreated event already processed
|
|
110
|
+
And OrderStatusView showing status "Draft"
|
|
111
|
+
When an OrderConfirmed event is received with:
|
|
112
|
+
| field | value |
|
|
113
|
+
| orderId | order-789 |
|
|
114
|
+
| confirmedAt | 2024-12-31T10:00:00Z |
|
|
115
|
+
Then the view should update to display:
|
|
116
|
+
| field | value |
|
|
117
|
+
| Status | Confirmed |
|
|
118
|
+
| Confirmed Date | 12/31/2024 10:00 AM |
|
|
119
|
+
|
|
120
|
+
Scenario: Accumulate payment information
|
|
121
|
+
Given OrderConfirmed event processed (status=Confirmed)
|
|
122
|
+
When a PaymentAuthorized event arrives with:
|
|
123
|
+
| field | value |
|
|
124
|
+
| orderId | order-789 |
|
|
125
|
+
| paymentId | pay-123 |
|
|
126
|
+
| authCode | AUTH-456 |
|
|
127
|
+
Then the view should accumulate:
|
|
128
|
+
| field | value |
|
|
129
|
+
| Payment ID | pay-123 |
|
|
130
|
+
| Auth Code | AUTH-456 |
|
|
131
|
+
| Payment Status | Authorized |
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## 3b. List-type Read Model Scenarios
|
|
135
|
+
|
|
136
|
+
Expected rows and empty-list intent when the THEN readmodel is a list (`listElement: true`):
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
Feature: Product Catalog
|
|
140
|
+
|
|
141
|
+
Scenario: Products list shows all created products
|
|
142
|
+
Given a ProductCreated event with name "Shoes", index "0", family_id "22222..."
|
|
143
|
+
And a ProductCreated event with name "Clothing", index "1", family_id "33333..."
|
|
144
|
+
When the ProductList view processes these events
|
|
145
|
+
Then the list should contain:
|
|
146
|
+
| name | index | family_id |
|
|
147
|
+
| Shoes | 0 | 22222... |
|
|
148
|
+
| Clothing | 1 | 33333... |
|
|
149
|
+
|
|
150
|
+
Scenario: Products list is empty after last item is deleted
|
|
151
|
+
Given a ProductDeleted event for the last remaining item
|
|
152
|
+
When the ProductList view processes this event
|
|
153
|
+
Then the list should be empty
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## 4. Error Path Scenarios
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
Feature: Payment Authorization Failure
|
|
160
|
+
|
|
161
|
+
Scenario: Handle declined payment
|
|
162
|
+
Given an order "order-001" in Confirmed state
|
|
163
|
+
And customer initiates payment
|
|
164
|
+
When the payment gateway declines the card
|
|
165
|
+
Then a PaymentFailed event is produced with:
|
|
166
|
+
| field | value |
|
|
167
|
+
| orderId | order-001 |
|
|
168
|
+
| reason | Card declined |
|
|
169
|
+
| timestamp | {now} |
|
|
170
|
+
|
|
171
|
+
Scenario: Update order view on payment failure
|
|
172
|
+
Given OrderStatusView shows status "Confirmed"
|
|
173
|
+
When PaymentFailed event arrives for order-001
|
|
174
|
+
Then the view should update:
|
|
175
|
+
| field | value |
|
|
176
|
+
| Payment Status | Failed |
|
|
177
|
+
| Failure Reason | Card declined |
|
|
178
|
+
| Retry Available | Yes |
|
|
179
|
+
|
|
180
|
+
Scenario: Allow retry after payment failure
|
|
181
|
+
Given a PaymentFailed event exists
|
|
182
|
+
And order status is still "Confirmed"
|
|
183
|
+
When customer retries payment
|
|
184
|
+
Then the new AuthorizePayment command is accepted
|
|
185
|
+
And can produce new PaymentAuthorized event
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## 5. Compensation Scenarios
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
Feature: Order Cancellation
|
|
192
|
+
|
|
193
|
+
Scenario: Cancel order in Draft state
|
|
194
|
+
Given an order "order-555" in Draft state
|
|
195
|
+
And only OrderCreated event exists
|
|
196
|
+
When customer cancels the order with reason "Changed mind"
|
|
197
|
+
Then an OrderCancelled event is produced with:
|
|
198
|
+
| field | value |
|
|
199
|
+
| orderId | order-555 |
|
|
200
|
+
| reason | Changed mind |
|
|
201
|
+
| cancelledAt | {timestamp} |
|
|
202
|
+
|
|
203
|
+
Scenario: Cannot cancel completed order
|
|
204
|
+
Given an order "order-555" in Delivered state
|
|
205
|
+
And DeliveryConfirmed event exists
|
|
206
|
+
When customer tries to cancel
|
|
207
|
+
Then the command should be rejected
|
|
208
|
+
And the rejection reason is "Cannot cancel delivered order"
|
|
209
|
+
|
|
210
|
+
Scenario: Trigger compensation on cancellation
|
|
211
|
+
Given an order in Confirmed state
|
|
212
|
+
And PaymentAuthorized event exists
|
|
213
|
+
When OrderCancelled event is produced
|
|
214
|
+
Then a RefundPayment command should be automatically triggered
|
|
215
|
+
And RefundInitiated event should follow
|
|
216
|
+
```
|