@cratis/pi 7.6.5 → 7.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/package/corpus/agents/backend-developer.md +14 -0
  2. package/package/corpus/agents/code-reviewer.md +16 -0
  3. package/package/corpus/agents/coordinator.md +17 -0
  4. package/package/corpus/agents/frontend-developer.md +17 -0
  5. package/package/corpus/agents/orchestrator.md +18 -0
  6. package/package/corpus/agents/planner.md +24 -0
  7. package/package/corpus/agents/screenplay-modeler.md +57 -0
  8. package/package/corpus/agents/screenplay-renderer.md +42 -0
  9. package/package/corpus/agents/screenplay-reviewer.md +45 -0
  10. package/package/corpus/agents/slice-implementer.md +32 -5
  11. package/package/corpus/agents/spec-writer.md +16 -3
  12. package/package/corpus/prompts/add-reactor.prompt.md +5 -3
  13. package/package/corpus/prompts/new-vertical-slice.prompt.md +16 -5
  14. package/package/corpus/prompts/write-specs.prompt.md +12 -6
  15. package/package/corpus/rules/application-profile.md +7 -3
  16. package/package/corpus/rules/general.md +8 -3
  17. package/package/corpus/rules/glossary.md +1 -1
  18. package/package/corpus/rules/profiles.md +42 -4
  19. package/package/corpus/rules/reactors.md +30 -22
  20. package/package/corpus/rules/vertical-slices.md +3 -1
  21. package/package/corpus/skills/cratis-application-react-specifications/SKILL.md +13 -0
  22. package/package/corpus/skills/cratis-application-slice-conformance/LICENSE +2 -0
  23. package/package/corpus/skills/cratis-application-slice-conformance/SKILL.md +173 -0
  24. package/package/corpus/skills/cratis-application-slice-conformance/references/checklists.md +66 -0
  25. package/package/corpus/skills/cratis-application-slice-conformance/references/contract-and-precedence.md +49 -0
  26. package/package/corpus/skills/cratis-application-slice-conformance/references/provenance.md +23 -0
  27. package/package/corpus/skills/cratis-application-slice-conformance/references/worked-example.md +91 -0
  28. package/package/corpus/skills/cratis-application-slice-conformance/verification.json +14 -0
  29. package/package/corpus/skills/cratis-application-slice-specifications/SKILL.md +57 -1
  30. package/package/corpus/skills/cratis-application-slice-specifications/references/provenance.md +16 -0
  31. package/package/corpus/skills/cratis-arc-command/SKILL.md +10 -0
  32. package/package/corpus/skills/cratis-arc-command-execution/SKILL.md +10 -0
  33. package/package/corpus/skills/cratis-arc-command-validation/SKILL.md +10 -0
  34. package/package/corpus/skills/cratis-arc-observable-query-http/SKILL.md +10 -0
  35. package/package/corpus/skills/cratis-arc-query-paging/SKILL.md +10 -0
  36. package/package/corpus/skills/cratis-arc-react-page/SKILL.md +68 -8
  37. package/package/corpus/skills/cratis-arc-react-page/references/from-screenplay.md +199 -0
  38. package/package/corpus/skills/cratis-arc-react-page/references/provenance.md +13 -0
  39. package/package/corpus/skills/cratis-chronicle-event-constraints/SKILL.md +10 -0
  40. package/package/corpus/skills/cratis-chronicle-event-modeling/SKILL.md +38 -10
  41. package/package/corpus/skills/cratis-chronicle-event-type-migration/SKILL.md +13 -0
  42. package/package/corpus/skills/cratis-chronicle-projection/SKILL.md +13 -0
  43. package/package/corpus/skills/cratis-chronicle-reactor/SKILL.md +58 -6
  44. package/package/corpus/skills/cratis-chronicle-reactor/references/provenance.md +9 -0
  45. package/package/corpus/skills/cratis-chronicle-read-model/SKILL.md +13 -0
  46. package/package/corpus/skills/cratis-chronicle-read-model-specifications/SKILL.md +47 -0
  47. package/package/corpus/skills/cratis-chronicle-read-model-specifications/references/provenance.md +11 -0
  48. package/package/corpus/skills/cratis-chronicle-reducer/SKILL.md +13 -0
  49. package/package/corpus/skills/cratis-components-stepper-command-dialog/SKILL.md +13 -0
  50. package/package/corpus/skills/cratis-event-model-diagram/SKILL.md +35 -16
  51. package/package/corpus/skills/cratis-screenplay-automations-and-translations/LICENSE +28 -0
  52. package/package/corpus/skills/cratis-screenplay-automations-and-translations/SKILL.md +166 -0
  53. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/audit-format.md +31 -0
  54. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/automation-patterns.md +139 -0
  55. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/cases-to-specify.md +69 -0
  56. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/effects-and-idempotency.md +88 -0
  57. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/integration-contracts.md +64 -0
  58. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/provenance.md +37 -0
  59. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/realization-and-gap-fill.md +34 -0
  60. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/todo-list-example.md +208 -0
  61. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/translate-example.md +126 -0
  62. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/translation-patterns.md +93 -0
  63. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/worked-integration.md +98 -0
  64. package/package/corpus/skills/cratis-screenplay-automations-and-translations/verification.json +15 -0
  65. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/SKILL.md +267 -50
  66. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/complete-examples.md +185 -0
  67. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/verification.json +60 -12
  68. package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +42 -12
  69. package/package/corpus/skills/cratis-screenplay-discovery/LICENSE +30 -0
  70. package/package/corpus/skills/cratis-screenplay-discovery/SKILL.md +229 -0
  71. package/package/corpus/skills/cratis-screenplay-discovery/references/divergent-sweep.md +37 -0
  72. package/package/corpus/skills/cratis-screenplay-discovery/references/event-naming.md +64 -0
  73. package/package/corpus/skills/cratis-screenplay-discovery/references/facilitation.md +62 -0
  74. package/package/corpus/skills/cratis-screenplay-discovery/references/human-workshop.md +222 -0
  75. package/package/corpus/skills/cratis-screenplay-discovery/references/interview-questions.md +66 -0
  76. package/package/corpus/skills/cratis-screenplay-discovery/references/personas-and-causes.md +152 -0
  77. package/package/corpus/skills/cratis-screenplay-discovery/references/plotting-and-handoff.md +111 -0
  78. package/package/corpus/skills/cratis-screenplay-discovery/references/provenance.md +37 -0
  79. package/package/corpus/skills/cratis-screenplay-discovery/references/storming-loop.md +119 -0
  80. package/package/corpus/skills/cratis-screenplay-discovery/references/worked-session.md +87 -0
  81. package/package/corpus/skills/cratis-screenplay-discovery/verification.json +15 -0
  82. package/package/corpus/skills/cratis-screenplay-event-modeling/SKILL.md +140 -77
  83. package/package/corpus/skills/cratis-screenplay-event-modeling/references/invoicing-example.md +51 -0
  84. package/package/corpus/skills/cratis-screenplay-event-modeling/references/nine-steps.md +114 -28
  85. package/package/corpus/skills/cratis-screenplay-event-modeling/references/parsed-not-runnable.md +50 -0
  86. package/package/corpus/skills/cratis-screenplay-event-modeling/verification.json +28 -3
  87. package/package/corpus/skills/cratis-screenplay-legacy-extraction/LICENSE +31 -0
  88. package/package/corpus/skills/cratis-screenplay-legacy-extraction/SKILL.md +239 -0
  89. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/chronicle-observations.md +25 -0
  90. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/evidence-table-template.md +79 -0
  91. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/expert-verification.md +48 -0
  92. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/generate-notes.md +75 -0
  93. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/intent-example.md +164 -0
  94. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/interview-findings.md +88 -0
  95. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/loss-report-template.md +47 -0
  96. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/prologue-safety.md +147 -0
  97. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/provenance.md +10 -0
  98. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/rule-modeling.md +36 -0
  99. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/side-car-migration.md +126 -0
  100. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/signal-to-intent.md +57 -0
  101. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/ui-observation.md +52 -0
  102. package/package/corpus/skills/cratis-screenplay-legacy-extraction/verification.json +17 -0
  103. package/package/corpus/skills/cratis-screenplay-model-authoring/SKILL.md +77 -57
  104. package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md +50 -20
  105. package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-loop.md +211 -0
  106. package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-tools.md +44 -6
  107. package/package/corpus/skills/cratis-screenplay-model-authoring/references/provenance.md +13 -0
  108. package/package/corpus/skills/cratis-screenplay-model-authoring/verification.json +64 -10
  109. package/package/corpus/skills/cratis-screenplay-model-review/LICENSE +34 -0
  110. package/package/corpus/skills/cratis-screenplay-model-review/SKILL.md +209 -0
  111. package/package/corpus/skills/cratis-screenplay-model-review/references/anti-patterns.md +89 -0
  112. package/package/corpus/skills/cratis-screenplay-model-review/references/business-questions.md +128 -0
  113. package/package/corpus/skills/cratis-screenplay-model-review/references/checklist.md +176 -0
  114. package/package/corpus/skills/cratis-screenplay-model-review/references/provenance.md +36 -0
  115. package/package/corpus/skills/cratis-screenplay-model-review/references/report-template.md +149 -0
  116. package/package/corpus/skills/cratis-screenplay-model-review/references/review-questions.md +59 -0
  117. package/package/corpus/skills/cratis-screenplay-model-review/references/worked-example.md +255 -0
  118. package/package/corpus/skills/cratis-screenplay-model-review/verification.json +13 -0
  119. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/LICENSE +32 -0
  120. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/SKILL.md +239 -0
  121. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/code-reading-and-tokens.md +55 -0
  122. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/handoff-template.md +124 -0
  123. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/identity-and-edits.md +84 -0
  124. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/opt-in.md +48 -0
  125. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/phase-report-inventories.md +25 -0
  126. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/phases.md +162 -0
  127. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/principles.md +53 -0
  128. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/provenance.md +63 -0
  129. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/reasoning-notes.md +31 -0
  130. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/safety.md +31 -0
  131. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/stop-or-assume.md +46 -0
  132. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/verdicts-and-modes.md +204 -0
  133. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/vocabulary-map.md +55 -0
  134. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/worked-example.md +86 -0
  135. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/verification.json +16 -0
  136. package/package/corpus/skills/cratis-screenplay-projections/SKILL.md +14 -3
  137. package/package/corpus/skills/cratis-screenplay-read-surface/SKILL.md +15 -1
  138. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/LICENSE +2 -0
  139. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/SKILL.md +179 -0
  140. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/delivery-protocol.md +99 -0
  141. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/drift-and-ledger.md +67 -0
  142. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/gap-fill-handoff.md +72 -0
  143. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/provenance.md +27 -0
  144. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/renderability-gate.md +56 -0
  145. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/worked-example.md +124 -0
  146. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/verification.json +14 -0
  147. package/package/corpus/skills/cratis-screenplay-scenario-coverage/LICENSE +31 -0
  148. package/package/corpus/skills/cratis-screenplay-scenario-coverage/SKILL.md +200 -0
  149. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/berth-reservations.md +579 -0
  150. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/chronicle-verification.md +24 -0
  151. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/coverage-matrix.md +102 -0
  152. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/provenance.md +41 -0
  153. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-catalogue.md +196 -0
  154. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-workshop.md +102 -0
  155. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/spec-forms-by-mode.md +71 -0
  156. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/view-and-story-specs.md +91 -0
  157. package/package/corpus/skills/cratis-screenplay-scenario-coverage/verification.json +13 -0
  158. package/package/corpus/skills/cratis-screenplay-slice-design/LICENSE +30 -0
  159. package/package/corpus/skills/cratis-screenplay-slice-design/SKILL.md +236 -0
  160. package/package/corpus/skills/cratis-screenplay-slice-design/references/command-inventory.md +107 -0
  161. package/package/corpus/skills/cratis-screenplay-slice-design/references/field-lineage.md +130 -0
  162. package/package/corpus/skills/cratis-screenplay-slice-design/references/provenance.md +20 -0
  163. package/package/corpus/skills/cratis-screenplay-slice-design/references/read-model-design.md +201 -0
  164. package/package/corpus/skills/cratis-screenplay-slice-design/references/review-questions.md +23 -0
  165. package/package/corpus/skills/cratis-screenplay-slice-design/references/rule-layers.md +41 -0
  166. package/package/corpus/skills/cratis-screenplay-slice-design/references/slicing.md +122 -0
  167. package/package/corpus/skills/cratis-screenplay-slice-design/references/worked-example.md +305 -0
  168. package/package/corpus/skills/cratis-screenplay-slice-design/verification.json +43 -0
  169. package/package/corpus/skills/cratis-screenplay-specifications/SKILL.md +217 -36
  170. package/package/corpus/skills/cratis-screenplay-specifications/verification.json +28 -4
  171. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/LICENSE +33 -0
  172. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/SKILL.md +191 -0
  173. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/boundaries.md +154 -0
  174. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/chronicle-boundaries.md +54 -0
  175. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/consistency-and-concurrency.md +191 -0
  176. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/evolution-example.md +70 -0
  177. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/evolution.md +65 -0
  178. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/provenance.md +13 -0
  179. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/stream-patterns.md +128 -0
  180. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/streams-example.md +378 -0
  181. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/verification.json +14 -0
  182. package/package/corpus/skills/cratis-screenplay-toolchain/LICENSE +2 -0
  183. package/package/corpus/skills/cratis-screenplay-toolchain/SKILL.md +177 -0
  184. package/package/corpus/skills/cratis-screenplay-toolchain/references/automation-translate-example.md +121 -0
  185. package/package/corpus/skills/cratis-screenplay-toolchain/references/cheat-sheet-example.md +319 -0
  186. package/package/corpus/skills/cratis-screenplay-toolchain/references/cheat-sheet.md +96 -0
  187. package/package/corpus/skills/cratis-screenplay-toolchain/references/diagnostics.md +107 -0
  188. package/package/corpus/skills/cratis-screenplay-toolchain/references/doc-contradictions.md +48 -0
  189. package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-example.md +113 -0
  190. package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-subset.md +148 -0
  191. package/package/corpus/skills/cratis-screenplay-toolchain/references/pdl-example.md +267 -0
  192. package/package/corpus/skills/cratis-screenplay-toolchain/references/provenance.md +51 -0
  193. package/package/corpus/skills/cratis-screenplay-toolchain/references/renderable-subset.md +88 -0
  194. package/package/corpus/skills/cratis-screenplay-toolchain/references/traps.md +51 -0
  195. package/package/corpus/skills/cratis-screenplay-toolchain/references/verdicts.md +134 -0
  196. package/package/corpus/skills/cratis-screenplay-toolchain/references/versions.md +134 -0
  197. package/package/corpus/skills/cratis-screenplay-toolchain/verification.json +15 -0
  198. package/package/corpus/skills/cratis-screenplay-ui-composition/SKILL.md +53 -5
  199. package/package/corpus/skills/cratis-screenplay-ui-composition/references/flow-review.md +56 -0
  200. package/package/corpus/skills/cratis-screenplay-ui-composition/references/provenance.md +13 -0
  201. package/package/corpus/skills/cratis-screenplay-ui-composition/references/worked-flow.md +65 -0
  202. package/package/corpus/skills/cratis-screenplay-ui-composition/verification.json +4 -1
  203. package/package/corpus/skills/cratis-specification-by-example/SKILL.md +44 -1
  204. package/package/corpus/skills/cratis-specifications-csharp/SKILL.md +10 -0
  205. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/SKILL.md +186 -219
  206. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/admission.md +177 -0
  207. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/render-example.md +150 -0
  208. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/rendered-application.md +87 -0
  209. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/sandbox-and-specrunner.md +98 -0
  210. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/verification.json +19 -0
  211. package/package/profile-catalog.json +11 -0
  212. package/package.json +1 -1
@@ -0,0 +1,102 @@
1
+ # Coverage matrix
2
+
3
+ Write it **before** drafting specs, keep it in `.ai-work/screenplay/<model-slug>/coverage.md` (or the
4
+ `STATE.md` beside it), and update it with the specs. Reviewers check it against the model. The Screenplay MCP does not yet report which specifications a command, read model, policy or constraint still lacks (Screenplay#390, open, not available): the matrix is that report, built by hand from the declarations.
5
+
6
+ ## Cell values
7
+ - `spec <Name>` - written; the name exists in the model.
8
+ - `n/a: <domain reason>` - the situation cannot occur in this business. "Keeps it short" is not
9
+ a reason.
10
+ - `recorded: <why>` - real, but the language cannot express it today (state-dependent rule,
11
+ idempotent success, exactly-once effect, parallel race without a constraint). A state-dependent
12
+ rule is always written as `reads <View>` + `require ... message` (binding then reports
13
+ PLAY0268/0271; report the model as design-complete, not binding-ready) and marked
14
+ NOT enforced in the slice `description`, with its target named (Arc `[ProtectedDecision]`,
15
+ Chronicle DCB, or a constraint). It is also in the phase report.
16
+ - `open: <required case>` - planned but not yet drafted. Never counts as coverage.
17
+ - `question: <id>` - needs a domain answer; listed in open questions.
18
+ - `gap: <code>` - expressible in design mode but blocked in the chosen mode (e.g. removal in
19
+ renderable mode); the gap is recorded per `cratis-screenplay-modeling-lifecycle`.
20
+
21
+ ## Derive obligations from the model
22
+
23
+ Before reading existing specs as evidence, list the obligations each declaration creates, then
24
+ map each to a spec whose body really exercises it. One spec may serve several compatible
25
+ obligations; a declaration alone never satisfies one.
26
+
27
+ | Model evidence | Required coverage decision |
28
+ |---|---|
29
+ | Command | success, and every distinct business outcome |
30
+ | Command rule (`validate`/`require`) | allowed boundary plus an isolated rejection with the intended message |
31
+ | Concept `validate` | one acceptance, rejection and boundary spec per concept, through one command; link it from other uses |
32
+ | Effective gate on a command or query (own, feature, module) | allowed caller plus a `then denied` at that exact command or query; fixtures derived from the Boolean gate: for AND isolate each missing conjunct, for OR a caller meeting any permitted alternative must succeed, `then denied` only where the whole gate is false (one per persona that may not act); for an ownership policy, a success with the matching claim and a denial with another value |
33
+ | `unique event` | the earlier constrained fact on the same source, then the repeat or the exclusive action |
34
+ | Value `unique ... on` | the value held by source A, a valid command on source B, the constraint message |
35
+ | `released by` | claim, release on its owning source, then a new claimant succeeds |
36
+ | `produces when` | feasible true and false witnesses, threshold equality, meaningful overlaps |
37
+ | Projection mapping | a view assertion for each changed value and for important preserved values |
38
+ | Repeated accumulating event | two occurrences when accumulation is business behaviour |
39
+ | `remove with` | existing row, removing event, explicit absence; a second surviving row |
40
+ | Query | caller-visible result for its contract; denial when gated |
41
+ | Reaction, capture, reversal, evolution, timing | the catalogue cases, or a specific reason, gap or question |
42
+
43
+ These are prompts, not claims that a declaration enforces the intended rule. A competing-claim
44
+ spec pins the loser's outcome after a prior claim; it does not run commands concurrently.
45
+ For a compound gate, a caller missing only one alternative of an OR gate must still succeed;
46
+ never change the policy to simplify fixtures. For conditional productions derive the full event set
47
+ per chosen input: unconditional productions plus every condition that is true. Do not invent
48
+ impossible combinations to fill a truth table.
49
+
50
+ **Vary one thing.** In each rejection spec change only the value the rule under test checks;
51
+ keep everything else (caller, other fields, history) identical to the success case, so the spec
52
+ cannot pass because a different rule fired.
53
+
54
+ **Completion.** A matrix with `open`, `question` or `gap` cells is an explicitly incomplete
55
+ scope; say so. Check commands and read models in two separate passes. A same-source retry is
56
+ not a competing claim, a denial elsewhere is not this command's denial, and removal from an
57
+ already-empty world is not removal coverage.
58
+
59
+ ## Template: commands, reactions, captures
60
+ ```text
61
+ Mode: <design|executable|renderable> Model root: <path> Source revision: <rev>
62
+
63
+ | Element | Happy | Rules | Denial | State | Duplicate/retry | Competing | Alt path | Ordering | External | Compensation | Evolution |
64
+ |---|---|---|---|---|---|---|---|---|---|---|---|
65
+ | <Cmd> | | | | | | | | | | | |
66
+ ```
67
+ One Denial cell per persona that may not act (not for permitted personas), plus one ownership cell when the gate
68
+ has a claim policy. Add one row per gated query, not only per command.
69
+
70
+ ## Template: read models
71
+ ```text
72
+ | Read model | Family? (reason) | Population | Updates | Removal/absence | Ordering | Denial |
73
+ |---|---|---|---|---|---|---|
74
+ | <RM> | | | | | | |
75
+ ```
76
+
77
+ ## Worked example (`berth-reservations.md`, design mode)
78
+ | Element | Happy | Rules | Denial | State | Duplicate/retry | Competing | Alt path | Ordering | External | Compensation | Evolution |
79
+ |---|---|---|---|---|---|---|---|---|---|---|---|
80
+ | ReserveBerth | spec ReservingAGuestBerth | spec RejectingAZeroLength; spec RejectingAnOversizedBoat; spec RejectingANightInThePast; spec RejectingAnEmptyBerthCode (concept rule); spec ReservingABoatAtTheMaximumLength | spec RefusingASkipper | spec RejectingANightInThePast (declarative `night >= today`; binding blocked: PLAY0268) | spec RejectingARetriedReservation; recorded: retry should answer "already reserved" | spec RejectingASecondBoatForTheSameBerthNight | n/a: one outcome | n/a: single source | n/a: no external system | spec ReservingABerthNightFreedByACancellation | n/a: new contract |
81
+ | CancelReservation | spec CancellingAReservation | spec RejectingACancellationWithoutAReason | spec RefusingASkipperCancellation | spec RejectingACancellationAfterDeparture (live-reservation message); spec AppendingACancellationAfterDeparture (constraint, append time); recorded: live reservation required (`reads BerthBooking` + `require`; NOT enforced; target DCB or `[ProtectedDecision]`) | spec RejectingASecondCancellation (live-reservation message); spec AppendingASecondCancellation (constraint, append time) | n/a: one reservation, one office action | n/a: one outcome | n/a: single source | n/a: no external system | question Q1: can a cancelled reservation be reinstated? | n/a: new contract |
82
+ | RecordDeparture | spec RecordingACleanDeparture | n/a: input is only an id and a flag, no value rule | spec RefusingASkipperDeparture | spec RejectingADepartureAfterCancellation (live-reservation message); spec AppendingADepartureAfterCancellation (constraint, append time); recorded: live reservation required (`reads BerthBooking` + `require`; NOT enforced; target DCB or `[ProtectedDecision]`) | spec RejectingARepeatedDeparture (live-reservation message); spec AppendingARepeatedDeparture (constraint, append time) | n/a: one departure per reservation | spec RecordingACleanDeparture (condition false); spec RecordingADepartureWithDamage (condition true) | n/a: single source | n/a: no external system | question Q2: who clears a damage report? | n/a: new contract |
83
+
84
+ | Read model | Family? (reason) | Population | Updates | Removal/absence | Ordering | Denial |
85
+ |---|---|---|---|---|---|---|
86
+ | BerthBooking | yes: shared reserved prefix, then separate departure and cancellation branches | spec BerthBoardLifecycle1Reserved | spec BerthBoardLifecycle2Departed | spec BerthBoardLifecycle3Cancelled; spec RemovingOnlyTheCancelledBooking | n/a: single source | spec RefusingASkipperTheBoard |
87
+
88
+ Notes on the example:
89
+ - A constraint explains enforcement but does not replace an example of its outcome:
90
+ `RecordDeparture` needs `AppendingARepeatedDeparture`; until it exists the cell is
91
+ `open: repeated departure`.
92
+ - When a command's own validation rejects the same history first (here `require booking.status ==
93
+ "reserved"`), a command specification can only pin that validation message. Test the constraint
94
+ in isolation with `when append <Event>` (append-time constraints are checked there, Screenplay
95
+ `specifications.md`); `when append` is not renderable, so keep it as a design or executable-mode
96
+ spec.
97
+ - The numbered view specs share fixtures, not execution state. Departure and cancellation are
98
+ sibling branches from the reserved state; cancellation does not follow departure.
99
+ - Stored-state rules stay in the model as `reads` + `require`; the example is design-complete
100
+ and binding reports them. The past-date rule is declared in `validate` with its rejection
101
+ spec; binding reports it too (PLAY0268, no runtime date value), so it is recorded as blocked,
102
+ never moved into prose or deleted to reach V3 (binding-ready).
@@ -0,0 +1,41 @@
1
+ # Provenance
2
+
3
+ Lineage of `cratis-screenplay-scenario-coverage`. The method was first drafted for the Cratis
4
+ corpus from Screenplay specification semantics (verified at tag v4.64.0) and refined against two
5
+ external event-modeling skill sets.
6
+
7
+ ## Adapted closely (MIT)
8
+ Source: TrogonStack/agentskills at `7b249d3ee42d8b7e11fa564141ebd5fbc37aadf1`, MIT, Copyright (c)
9
+ 2025 Straw Hat, LLC. Full notice in this skill's `LICENSE`.
10
+
11
+ | Source path | Adapted into | How |
12
+ |---|---|---|
13
+ | `plugins/trogonstack-eventmodeling/skills/eventmodeling-elaborating-scenarios/SKILL.md`, Interview Phase and Critical Questions | `SKILL.md` "Interview phase" | Skip condition and four critical questions kept in structure (coverage depth, known edge cases and rules, how scenarios will be used, who reviews); rewritten for Screenplay specifications, the coverage matrix and unattended assumptions |
14
+ | same file, Workshop Facilitation Guide (Before the Workshop, During per command and view, Multi-Role Review, Common Workshop Mistakes, Tips for Rapid Creation) | `references/scenario-workshop.md` | Structure and the six-step per-command cycle adapted; steps extended to the full scenario catalogue; time-boxes and per-command quotas deliberately dropped because they conflict with obligation-driven coverage |
15
+ | same file, Quality Checklist and Gherkin Best Practices (explicit givens, explicit outcomes, named reasons) | `SKILL.md` "Quality checklist" | Mapped onto `.play` specification style (exact events, pinned messages, `for`, one behaviour per spec) |
16
+ | same file, Scenario Organization (happy path, validation, state violation, duplicates, alternatives, error handling, compensation) | `references/scenario-catalogue.md` ordering | Extended with denial, competing claim, ordering, evolution and view types |
17
+
18
+ ## Ideas written independently
19
+ - Idea from Nebulit-GmbH/agentic-engineer@07b0f30:`.claude/skills/examples`, written
20
+ independently: neighbourhood-first, non-destructive example data, and varying only the field
21
+ the rule under test checks. In `references/scenario-catalogue.md` "Example data".
22
+ - Idea from Nebulit-GmbH/agentic-engineer@07b0f30:`.claude/skills/eventmodeling-elaborating-scenarios`,
23
+ written independently: contrast of given/when/then specifications with storyline-style
24
+ scenarios. In `references/view-and-story-specs.md` (lifecycle families).
25
+
26
+ ## Cratis-original
27
+ Coverage matrix and obligation derivation from declarations, cell vocabulary (`spec`, `n/a`,
28
+ `recorded`, `open`, `question`, `gap`), scenario types per Screenplay semantics, denial fixtures
29
+ from the Boolean gate, "once, idempotent, exactly once" separation, view lifecycle families,
30
+ Chronicle verification obligations, version skew for reaction cascades, spec forms per mode, and
31
+ the berth reservations example.
32
+
33
+ ## Product facts checked
34
+ - Screenplay v4.64.0 (`7e16162`): `Documentation/screenplay/specifications.md` (actions, outcomes,
35
+ `then denied`, `then no readmodel`, `then query`, `then events in any order`, PLAY0352,
36
+ PLAY0389) and the probes recorded in the version table of `cratis-screenplay-toolchain`
37
+ `references/versions.md`.
38
+ - Screenplay#390 (specification obligations in MCP) and #394 (multi-step specifications) were
39
+ open when written: cited as not available.
40
+ - Stage v4.24.0: `STAGE-ESM-015` and `STAGE-ESM-011` admission diagnostics for policies and
41
+ fixtures (`Documentation/guides/build-renderer-target.md`).
@@ -0,0 +1,196 @@
1
+ # Scenario catalogue
2
+
3
+ For each type: the question to put to the domain, when it applies, when "n/a" is a legitimate
4
+ answer, the Screenplay shape, and traps. Excerpts point to the complete compiled example
5
+ `berth-reservations.md` (marina guest berths). An `n/a` must name a domain reason; a
6
+ `recorded` cell names what the language cannot express and where the rule is written down.
7
+
8
+ ## Eliciting cases
9
+ Skip what the brief or model already answers. Otherwise ask:
10
+ - Which mistakes would be costly to get wrong?
11
+ - For this rule: one allowed request, the nearest refused one, and why they differ.
12
+ - What changes once the action has succeeded? What if the acknowledgement was lost?
13
+ - What if another identity already holds the same value?
14
+ - Which input flips the outcome, and what happens exactly at the boundary?
15
+ - Who may do or see this, and which otherwise-valid caller must be refused?
16
+ - What reverses the decision, and what must disappear, remain or become available afterwards?
17
+
18
+ Write each useful counterexample down at once as a candidate obligation. Business owners answer
19
+ intent, developers enforcement and failure boundaries, testers the distinguishing fixtures; record
20
+ who actually answered - an agent asking itself four kinds of question is not four approvals.
21
+ Unknown answers become questions, never invented rules. A quick pass may defer cases but must
22
+ name them as unfinished.
23
+
24
+ ## 1. Happy path
25
+ - Ask: "When everything is in order, what is now true that was not before?"
26
+ - Applies: always, once per distinct success outcome.
27
+ - Shape: `when <Cmd>` with every input stated; `then` lists every production that fires, in
28
+ order, with full payloads and `for`. See `ReservingAGuestBerth`.
29
+ - Traps: asserting a subset of events (lists are exact); leaving out `given caller` on a gated
30
+ command; omitting `for` so the event lands on an allocated source.
31
+
32
+ ## 2. Rule rejection (one per rule)
33
+ - Ask: "Which values would you refuse, and what would you tell the person?"
34
+ - Applies: every command `validate`/`require` rule that is a business rule, and every
35
+ `concept` rule.
36
+ - Concept rules travel with every use: cover each once with representative acceptance,
37
+ rejection and boundary specs through one command that carries the concept, not on every
38
+ use. Never an automatic `n/a`.
39
+ - Shape: `then error "<the rule's message, verbatim>"` (prefer a `$strings.<key>` message where
40
+ the model uses strings). The language accepts a bare `then error` (it matches any rejection),
41
+ but this pack requires the pinned message: a bare error cannot show which rule fired. See
42
+ `RejectingAZeroLength`, `RejectingAnOversizedBoat`.
43
+ - Vary only the value the rule checks; keep every other value as in the success case.
44
+ - Concept rule: one rejection spec per concept through one command (`RejectingAnEmptyBerthCode`).
45
+ This matches `cratis-screenplay-specifications`, which also asks for one rejection spec per
46
+ concept rule; the spec proves the rule travels with the concept.
47
+ - Traps: one spec covering two rules; `then error ""`; expecting `severity warning` to pass.
48
+
49
+ ## 3. Authorization denial
50
+ - Ask: "Who can see this screen but must not do this?"
51
+ - Applies: every command or query with an effective gate, including module and feature gates:
52
+ one `then denied` per command or query, not one per feature. Persona "Cannot" lines count only
53
+ once they resolve to a gate plus this spec; otherwise record a gap.
54
+ - Shape: `given caller` that is authenticated but lacks the role or claim -> `then denied`
55
+ (commands: no other outcome; read-only queries: `then query <Query>` with `arguments`, no
56
+ `result`, then `then denied`; or `when query` + `then denied`). See `RefusingASkipper`.
57
+ An empty `given caller` block is the anonymous caller.
58
+ - Specs cannot name a persona: write the caller as the roles and claims that persona's
59
+ policies grant and name the spec after the persona. One denial per persona that can reach the
60
+ screen but may not act. Derive fixtures from the effective Boolean gate: AND - isolate each
61
+ missing conjunct; OR - a caller meeting any permitted alternative must succeed (a success
62
+ spec, not `then denied`); denial only when the whole gate is false.
63
+ - Ownership policies (`claim ... matches subject|<property>`): the denial gives the right role
64
+ and a claim with another value (`claim "ownerId" = "<other id>"`); the success spec gives the
65
+ matching value. Both are needed. Ownership checks on Uuid-backed identifiers do not render
66
+ today (STAGE-ESM-015): note it.
67
+ - Traps: `then error` for a denial; a denial spec whose inputs also break a rule (it still
68
+ denies, but reads ambiguously); trusting a `cratis run` sandbox answer (it enforces neither
69
+ authorization nor validation); counting another command's denial.
70
+
71
+ ## 4. State violation
72
+ - Ask: "After which earlier facts must this request be refused?"
73
+ - Applies: lifecycle rules (cannot cancel after departure, cannot pay twice).
74
+ - Expressible today: exclusivity of facts per event source (`unique event` lines sharing one
75
+ constraint name), uniqueness of values across sources. See `CancelOrDepart` and
76
+ `RejectingACancellationAfterDeparture` (command validation) and
77
+ `AppendingACancellationAfterDeparture` (the constraint).
78
+ - Not enforced in the model today: rules over stored state such as "the reservation must exist"
79
+ or "amount within the remaining balance". Write the rule as `reads <View>` + `require <expr>
80
+ message "..."` (PLAY0268/0271 at binding are expected; report the model as
81
+ design-complete but not binding-ready, never delete the rule to bind), mark it NOT enforced in the slice `description`, name its target (Arc
82
+ `[ProtectedDecision]` + `DecisionRead<T>`, Chronicle DCB, or a constraint), mark the cell
83
+ `recorded` and list it in the phase report. Forbidden: a caller-supplied copy of state in `require`,
84
+ a boolean attestation input (`confirmsX == true`) standing in for the rule, and rules hidden in
85
+ `handler` or implementation-hint prose. An unguarded materialized read is unsafe for a
86
+ protected decision.
87
+
88
+ ## 5. Duplicate action and retry
89
+ - Ask: "What if the same request arrives twice - a double click, a timeout and retry, a
90
+ replayed message?"
91
+ - Decide which promise the business needs:
92
+ - **once-only fact**: the second attempt must not create a second fact (`unique event`);
93
+ - **idempotent handling**: the second attempt must *succeed* without a new fact - not
94
+ expressible as a constraint outcome; record it as a target requirement;
95
+ - **exactly-once external effect**: an email, payment or shipment - never proven by the model.
96
+ - Shape (once-only): `when <Command>` with the earlier fact as `given` (same `for`) -> the
97
+ constraint's fixed message. Use `when append <Event>` for projection or automation
98
+ triggers, and to isolate a constraint the command's own validation would reject first
99
+ (`AppendingARepeatedDeparture`); not otherwise for duplicates. See `RejectingARetriedReservation` (constraint message through `when <Command>`),
100
+ `RejectingARepeatedDeparture` (validation first) and `AppendingARepeatedDeparture` (isolated constraint).
101
+ - n/a only when repeating is harmless and wanted (a note added twice is two notes).
102
+ - Trap: claiming retry safety from a todo-list read model plus reaction; it shows intent, not
103
+ delivery guarantees.
104
+
105
+ ## 6. Competing claim (concurrency)
106
+ - Ask: "What if two people try at the same moment? Who wins, and what does the other see?"
107
+ - Applies: any scarce or unique thing (a berth-night, a username, a seat).
108
+ - Shape: a spec cannot run two commands in parallel. Pin the loser's outcome instead: `when
109
+ <Command>` with the *other* event source's fact as `given` (different `for`, same constrained
110
+ value) -> `then error "Constraint '<Name>' is violated: another event source already holds
111
+ the constrained value."` See `RejectingASecondBoatForTheSameBerthNight`. This does not prove
112
+ the runtime's behaviour under real concurrency (`chronicle-verification.md`).
113
+ - If no constraint can hold the rule (it spans stored state), the race is unprotected: mark
114
+ `recorded`, name the target enforcement (DCB or `[ProtectedDecision]`;
115
+ `cratis-screenplay-streams-and-consistency`).
116
+
117
+ ## 7. Alternative path
118
+ - Ask: "Which inputs change the result, and what happens either side of the boundary?"
119
+ - Applies: every `produces when` and every domain-described alternative outcome.
120
+ - Shape: for each condition a feasible true and a false witness (threshold equality where it
121
+ distinguishes the rule). Conditions are independent: include meaningful overlaps and assert
122
+ the full event set, every unconditional production plus each conditional one that fires. When
123
+ all conditions are false the unconditional productions still occur. See
124
+ `RecordingACleanDeparture` (only `BoatDeparted`) and `RecordingADepartureWithDamage` (both).
125
+ - Zero new facts: a command whose productions are all conditional may be accepted with no
126
+ facts. There is no `then no events` syntax. A command spec with no `then` events but with a
127
+ view or query assertion is still executable as a zero-fact check: the runner compares the
128
+ command's facts with the (empty) expected list by exact count, so any fact produced fails it
129
+ (Screenplay v4.64.0). Write it that way, name it for the zero-fact outcome, and keep the view
130
+ assertion for the visible state. Record the obligation as unasserted only where the runner is
131
+ not available.
132
+
133
+ ## 8. Ordering and timing
134
+ - Ask: "Can these facts arrive late, early or out of order? What happens at the boundary of a
135
+ deadline?"
136
+ - Within one event source order is the append order. Across sources (another context, a
137
+ capture, a reaction) the view or translation must cope with any order.
138
+ - Shape: view family whose givens are in a different order; translation specs where the
139
+ external record arrives before our own fact; `given clock`/`when clock` for deadlines
140
+ (binds on the current compiler, not the cratis-bundled one: `cratis-screenplay-toolchain` `references/versions.md`; see
141
+ `cratis-screenplay-automations-and-translations`).
142
+ - n/a: a single event source, with no external or cross-source input.
143
+
144
+ ## 9. External failure
145
+ - Ask: "What if the other party refuses, never answers, or answers twice?"
146
+ - Applies: captures, translations, reactions whose realization calls out.
147
+ - Shape: the reported outcome is a **fact** (a refusal received is an event), specified in the
148
+ Translate or Automation slice; a missing answer is a time-based scenario. A rejection
149
+ (`then error`) is only for requests we refuse ourselves.
150
+ - n/a: no external system in the path.
151
+
152
+ ## 10. Compensation
153
+ - Ask: "Can this be undone or corrected? What must undoing release or restore?"
154
+ - Shape: the reversal command's own specs, plus a spec proving the effect of the reversal:
155
+ a released claim (`ReservingABerthNightFreedByACancellation`) or a removed row
156
+ (`BerthBoardLifecycle3Cancelled`). Corrections are new facts, never edits of old ones.
157
+ - Often reveals a missing event: if nothing can undo a fact the business can reverse, ask.
158
+
159
+ ## 11. Evolution compatibility
160
+ - Ask (when an event's contract changes): "Do facts already stored still mean the same?"
161
+ - Compatible change (added property with a defined default): declare the new generation;
162
+ specify behaviour on the new generation; write the default for old facts in `description`
163
+ (Screenplay does not express upcasters). Change of meaning: a new event, with its own specs.
164
+ - Renaming a stored event keeps an `id "<OldName>"` pin. A rename the brief requests is done in
165
+ this pass by the identity owner (`cratis-screenplay-modeling-lifecycle`); never leave it silently unapplied.
166
+ - Event evolution and generations: `cratis-screenplay-streams-and-consistency`.
167
+ - n/a: new contracts never stored anywhere yet.
168
+
169
+ ## 12. Views
170
+ See `view-and-story-specs.md`.
171
+
172
+ ## Example data
173
+ Read the local context first: the target declaration, its concepts, rules, gates and the
174
+ producer/projection/query mappings, and the specs already there. Follow the value path (command
175
+ input -> event payload -> projected field -> query result); matching field names alone do not
176
+ mean values should agree. Do not load the whole model to fill one fixture.
177
+
178
+ Preserve existing intentional examples. Add missing cases instead of rewriting a happy-path
179
+ fixture; correct a value only to fix a demonstrated contradiction, and say so. Never change
180
+ rules, gates, mappings or contracts to make an example pass.
181
+
182
+ - One small synthetic cast per feature with deterministic ids, so one reservation reads as a
183
+ story across reserve, depart and cancel; each spec still states its full world.
184
+ - Values follow declared types and concept rules: UUID literals for UUID concepts, typed numbers
185
+ and booleans, quoted declared enum members. Dates are concrete ISO dates in the story's
186
+ future, instants offset-qualified; fix `given clock` when asserting occurrence-time values.
187
+ No `{uuid}`/`{now}` placeholders. No real personal data.
188
+ - Structured values: single-line JSON with quoted keys and required members; empty, single and
189
+ several items where that changes behaviour.
190
+ - Competing claim: different source ids, same constrained value. Retry: same source id and inputs.
191
+ Removal: an existing target, plus a second row that must survive. Branch: inputs that flip the
192
+ condition. Denial: valid business input, vary only the caller. Validation: satisfy every other
193
+ rule.
194
+ - Unknown domain values stay questions, not plausible inventions.
195
+ - After editing, report new or changed spec names and any corrected fixture; a clean compile does
196
+ not show the expected outcomes are right.
@@ -0,0 +1,102 @@
1
+ # Scenario workshop (human facilitation guide)
2
+
3
+ Use this when scenarios are written together with business people, developers and testers
4
+ instead of by one author. The facilitation structure is adapted from the Workshop Facilitation
5
+ Guide in TrogonStack `eventmodeling-elaborating-scenarios` (MIT; see `provenance.md`) and
6
+ mapped onto Screenplay specifications and the coverage matrix. An agent can run the same
7
+ protocol as an interview: each step below is a question to put to a person, with the answer
8
+ captured as a matrix cell or a named open question.
9
+
10
+ The workshop produces **candidate obligations**, not finished specifications. A facilitator
11
+ writes them into the coverage matrix (`coverage-matrix.md`) as `open: <case>` cells; a modeler
12
+ then drafts the specifications. A scenario sketched on a card is not coverage until a
13
+ specification with that name exists in the model.
14
+
15
+ ## Before the workshop
16
+ **Participants** (name the person for each role; one person cannot stand in for all four):
17
+ - Domain expert or product owner: business rules, priorities, edge cases, what is refused.
18
+ - Developer: feasibility, where a rule can be enforced, failure and concurrency boundaries.
19
+ - Tester: distinguishing fixtures, boundary values, how a wrong outcome would be noticed.
20
+ - Facilitator: keeps pace, keeps the vocabulary to the domain, records every counterexample.
21
+
22
+ **Setup:**
23
+ - The slices in scope, printed or shared: commands with their rules, effective gates,
24
+ constraints, productions, read models and queries. Derive the obligations first
25
+ (`coverage-matrix.md` "Derive obligations from the model") so the workshop starts from a
26
+ draft matrix, not a blank board.
27
+ - Outcome lists from discovery and slice design (Cannot lines, "only if" rules, refusals,
28
+ competition candidates, endings) as seeds.
29
+ - One card per command or view, with the twelve matrix columns as prompts. A timer per card is
30
+ optional; a card is finished when every column holds a value (see Rules of thumb), not when
31
+ the time is up.
32
+
33
+ ## During: one command at a time
34
+ Take each command in turn, in this order. The person who answers best is in brackets.
35
+
36
+ 1. **Happy path** (domain expert): "When everything is in order, what is now true that was not
37
+ before?" Read the production list aloud: every event, with its payload.
38
+ 2. **Rule rejections** (developer, tester): "Which values would you refuse, and what would you
39
+ tell the person?" One allowed and one refused example per rule; write the exact message.
40
+ 3. **Denial** (domain expert): "Who can see this screen but must not do this?" Each answer is a
41
+ persona with a gate; no gate means a recorded gap, not a spec.
42
+ 4. **State violations** (domain expert): "After which earlier facts must this be refused?"
43
+ (cannot cancel after departure, cannot pay twice). These are the rules most often missed.
44
+ 5. **Duplicates and competing claims** (developer): "What if it arrives twice? What if two
45
+ people try at once, and what does the loser see?" Decide which promise is needed: once-only
46
+ fact, idempotent handling, exactly-once external effect (scenario catalogue 5).
47
+ 6. **Alternative paths** (domain expert): "Which inputs change the result, and what happens
48
+ either side of the boundary?"
49
+ 7. **Ordering and external failure** (developer): "Can facts arrive late or out of order? What
50
+ if the other party refuses or never answers?" The answer is an outcome recorded as a fact.
51
+ 8. **Compensation** (domain expert): "Can this be undone? What must undoing release?" A reversal
52
+ the business has but the model lacks is a missing event: stop and tell the modeler.
53
+ 9. **Evolution** (developer): only when a stored event's contract is changing.
54
+
55
+ ## During: one view at a time
56
+ For each read model, ask "what does the screen show after each fact?" and decide family or no
57
+ family (`view-and-story-specs.md`). Walk one row through its states aloud, forks included
58
+ (reserved, then departed or cancelled, never both). Ask what must disappear and which row must
59
+ survive; ask what a caller who may not look sees.
60
+
61
+ ## Reading back
62
+ - The facilitator reads each captured scenario aloud in domain language: the given facts, the
63
+ action, the outcome. "Is this right?" Everyone confirms or speaks up.
64
+ - Do not perfect a scenario in the room. Capture it with its open question and move on.
65
+ - Every "what if...?" from anyone becomes a named candidate at once.
66
+ - Record why a rule behaves as it does when the room explains it; the modeler puts it in the
67
+ slice `description`.
68
+
69
+ ## Multi-role check (before leaving the room)
70
+ - Domain expert: is this the right business behaviour and message?
71
+ - Developer: can each rule be enforced where we put it, or is it `recorded` with a target?
72
+ - Tester: is each fixture distinguishing (vary one thing), and can a wrong outcome be seen?
73
+ - Facilitator: does every matrix cell hold `spec`, `n/a: <domain reason>`, `recorded`, `open`
74
+ or `question`, and is each `n/a` a domain reason?
75
+
76
+ An agent that facilitates alone must say so: one voice asking four kinds of question is not
77
+ four approvals. Record who actually answered each question.
78
+
79
+ ## Common mistakes
80
+ - Perfectionism on one scenario while other commands have no card.
81
+ - A missing role (no tester, no domain expert) and the answers invented to fill it.
82
+ - Technical language in the room (stored procedures, status codes); use domain words and the
83
+ model's names for events and fields.
84
+ - Vague givens ("an order"): state which facts exist and which source they are on.
85
+ - A scenario with no stated outcome: every card says which events follow, which message is
86
+ shown, or that the caller is denied.
87
+ - Writing fewer scenarios to finish sooner: the matrix shows what is still open.
88
+
89
+ ## Tips for rapid capture
90
+ - Start from the derived draft matrix and pre-printed cards with the column prompts.
91
+ - Parallel work: different people take different commands, then read back together.
92
+ - Reuse the existing cast of example data (`scenario-catalogue.md` "Example data") so scenarios
93
+ read as one story.
94
+ - Point to the discovery timeline and the slice boundaries when a debate repeats.
95
+ - End with the open questions listed, owner and date, and the matrix saved as the workshop
96
+ record.
97
+
98
+ ## Rules of thumb, deliberately different from the source guide
99
+ The source guide time-boxes 15-20 minutes per command and aims at three to five scenarios per
100
+ command. Neither is a rule here: a command with three rules, a gate, two constraints and a
101
+ conditional production needs the scenarios its declarations create, and a quota would drop
102
+ cases. Time-box the discussion, never the matrix; unfinished cells stay `open`.
@@ -0,0 +1,71 @@
1
+ # Specification forms by mode
2
+
3
+ The subsets themselves (what binds, what renders) are owned by `cratis-screenplay-toolchain`
4
+ (its executable and renderable subset references); version facts by its `references/versions.md`. This file
5
+ says what that means for writing specs. A form outside the chosen mode is never deleted from a
6
+ design model: keep it and record the gap.
7
+
8
+ | Form | design | executable | renderable |
9
+ |---|---|---|---|
10
+ | `when <Cmd>` -> `then <Event>` / `then error` / `then denied` | yes | yes | yes |
11
+ | `given <Event>` with `for` | yes | yes (needed for keyed views) | yes |
12
+ | `given readmodel` | yes | yes (complete instance with key) | only as the query-only lookup below |
13
+ | `when append <Event>` | yes | yes | no |
14
+ | `then readmodel` / `then query` (keyed `ById`, `arguments`, `result`) | yes | yes | yes |
15
+ | `then query` on list, filtered or observable queries | yes | no (query does not bind) | no |
16
+ | `then no readmodel <RM> for "<key>"` | yes | yes | no |
17
+ | `when query` -> `then result` / `then no result` | yes | yes | same as `then query`: only the query-only cases below |
18
+ | `given clock` / `when clock`, `when trigger`, `given`/`when capture` | yes | current compiler yes; cratis-bundled compiler no (see versions.md) | no |
19
+ | Command spec listing reaction cascade events | yes (v6 semantics) | false PLAY0285 on the cratis-bundled compiler; see SKILL.md "Version skew" | no (no reactions) |
20
+ | `then events in any order` | yes | yes | yes |
21
+ | Composite (JSON) values in specs | yes | yes | no |
22
+ | Rules over dates or `today`, nested paths | spec them in design | rule does not bind: `recorded` | `recorded` |
23
+ | Bodied rules, code policies | spec them | spec reported **unsupported**, never passed | no |
24
+ | Command handlers, `file` constraints, query `performer`s | spec them in design | blocked: PLAY0268 at binding, no spec runs (V3 blocked) | no |
25
+
26
+ ## Design mode
27
+ Write the full intended behaviour, including scenarios the executable subset cannot run
28
+ (list views; clock, trigger and capture scenarios when only the cratis-bundled compiler is
29
+ available). Mark each such spec in the coverage matrix as
30
+ `gap: <reason>` for the narrower modes so the verification and render phases know what will not execute.
31
+
32
+ ## Executable mode
33
+ - Every gated spec has `given caller`; every production and every given/expected event has `for`.
34
+ - Each read model has one key shared by its keyed `=> RM optional` queries; the identifier equals
35
+ the projection's effective key (`cratis-screenplay-slice-design` `references/read-model-design.md`
36
+ decision table). View specs assert through a keyed query.
37
+ - Run V3 (binding-ready, per `cratis-screenplay-toolchain`); binding-only codes (PLAY0273/0350/0352/0388/0389) appear only there.
38
+ - V4 (reference specs run) needs a runner route; otherwise report "V4 not run: no route". Unsupported is not passed.
39
+
40
+ ## Renderable mode
41
+ - Specs use given events, a command `when`, and then events / readmodel / query / error /
42
+ denied. No `when append` or `then no readmodel`. `given readmodel` appears only in the
43
+ query-only lookup below.
44
+ - Query-only specs (no command `when`) are admitted by Stage v4.24.0 in exactly two cases, and
45
+ `when query` and `then query` are the same case: Screenplay normalises `when query` to the
46
+ `then query` model, so the spelling never decides admission.
47
+ - Denial: `given caller` (no role claims), no given events or read models, one query under a
48
+ policy, one scalar key, no `result`, `then denied`.
49
+ - Seeded lookup: no caller, no given events, exactly one `given readmodel` (a complete
50
+ instance, every property, with its identifier equal to the key) and one unprotected query
51
+ over that read model with the same key and exactly one `result`.
52
+ Any other when-less query (for example over given events, or a list) is not admitted:
53
+ prove the view with a command `when` instead and record the rest as a gap.
54
+ - One command per `StateChange` and unconditional `produces`: alternative-path specs over
55
+ `produces when` belong to scope that is not renderable (the example's `RecordDeparture` is
56
+ executable, not renderable).
57
+ - Prove projections with `given` events + `when <Command>` + `then query` (or `then readmodel`).
58
+ Removal has no admitted form: record it as a gap for renderable scope.
59
+ - A `then error` must name a constraint or rule that is actually rendered. Stage v4.24.0 admits
60
+ a value constraint only when each target is a single, required, text-typed property (not
61
+ composite, optional, collection or nontext), and rejects a command that produces more than one
62
+ event affected by the same value constraint (claims or releases) in one batch. The number of
63
+ constraints a command carries is not a limit. The example's `OneBoatPerBerthNight` is
64
+ composite (berth and night, one a date), so it does not render: keep the constraint and its
65
+ protection, and record the gap. Check the renderable subset in `cratis-screenplay-toolchain`
66
+ before promising V5.
67
+ - One spec maps to one or more generated test classes, snake-cased from the spec name: the
68
+ command class `when_<spec_name>`, plus `when_<spec_name>_is_projected` per `then readmodel`
69
+ and `when_<spec_name>_is_queried` per `then query`; with several read models or queries the
70
+ suffix gains `_into_<read_model>` or `_through_<query>`. A query-only spec renders only its
71
+ `_is_queried` class. V5 reports evidence for every class of each spec, not just the command class.
@@ -0,0 +1,91 @@
1
+ # View specifications and lifecycle families
2
+
3
+ Views cannot reject a stored fact, so view specs have no error cases. They answer: after these
4
+ facts, what does the screen (or automation input) show?
5
+
6
+ ## Per read model, decide before drafting
7
+ Write one line per read model in the coverage matrix:
8
+ `<ReadModel>: family yes|no - <reason>`.
9
+ - **Family yes** when several facts, or the same fact repeated with different values, walk one
10
+ row through states worth narrating (reserved -> departed; a queue item opened then closed;
11
+ a running total).
12
+ - **Family no** when the view is filled by one fact and nothing changes it later.
13
+ Deciding all read models the same way in one batch usually means the decision was skipped.
14
+
15
+ ## Required specs per projected read model
16
+ | Situation | Spec |
17
+ |---|---|
18
+ | Population | `given <Event>` (with `for`) -> `then query <ById>` with `arguments` and `result` |
19
+ | Each update | earlier facts as `given`, the updating fact as `when append` -> `then query` |
20
+ | Removal | `when append <RemovingEvent>` -> `then no readmodel <RM> for "<key>"` (not renderable) |
21
+ | Absence | a fact that must NOT create a row -> `then query` with `arguments` and no `result` |
22
+ | Join / child | the joined or child fact arriving -> the affected row only |
23
+ Use `then readmodel` when the point is the stored state; use `then query` when the point is
24
+ what a caller can ask for. A read-model assertion is not a query assertion.
25
+
26
+ ## Lifecycle families (storyline emulation)
27
+ Screenplay has no multi-step storyline today (multi-step specifications with checkpoints are only an idea: Screenplay#394, open, not available) and a spec has at most one action. Emulate one with
28
+ independent specs that share a cast and carry cumulative givens:
29
+ - Sketch the business paths first, forks included: reserved -> departed, reserved -> cancelled.
30
+ Do not flatten mutually exclusive paths into one apparent sequence.
31
+ - Names `<View>Lifecycle1<State>`, `<View>Lifecycle2<State>`, ... Each member repeats the facts
32
+ of its own path as `given`, adds one step (`when append` or the step's events) and asserts the
33
+ state. No member depends on another having run.
34
+ - `BerthBoardLifecycle2Departed` and `...3Cancelled` in `berth-reservations.md` are sibling
35
+ branches after `...1Reserved`; the numbers are labels, not an execution order.
36
+ - A family may return to an earlier state (available -> reserved -> available again): assert the
37
+ earlier value again, do not assume it.
38
+ - Members must agree with each other and with the view's single-transition specs. If a single
39
+ spec asserts `status = "reserved"` after a departure, one of them is wrong - fix the model or
40
+ the spec, never both silently. A single-transition spec can satisfy a family obligation; link
41
+ it rather than copying it.
42
+ - A command never gets a family. Commands get one spec per transition.
43
+
44
+ ## Removal is a positive obligation
45
+ `remove with` existing is not coverage. Establish the row with its real source events, append
46
+ the removing event, assert `then no readmodel <RM> for "<key>"`. Where a wrong key could remove
47
+ unrelated data, add a second instance and assert it survives (`RemovingOnlyTheCancelledBooking`).
48
+ For child removal or clearing a nested object, assert the parent's resulting collection or
49
+ object, not root absence.
50
+
51
+ Keep three claims apart:
52
+ - one stored instance is absent: `then no readmodel`;
53
+ - a query returns no rows: `then query` without `result`, or `when query` + `then no result`;
54
+ - a list-valued property is empty: assert that property as `[]`.
55
+ List-query results use repeated `result` blocks; count and order are exact. A keyed lookup does
56
+ not prove an entire list is empty. Keep the list contract in design mode and record the
57
+ execution/rendering limit.
58
+
59
+ ## Ordering, lag and rebuild
60
+ - **Out of order across sources**: if a joined or cross-context fact can arrive first, add a
61
+ family member with that order and say what the view shows meanwhile (joins never create rows).
62
+ - **Projection lag**: a spec asserts the settled state. If a screen decision depends on the view
63
+ being current (a booking screen that must not offer a taken berth), that is not protection:
64
+ the command needs its own constraint, or the rule is `recorded` as target-enforced.
65
+ - **Rebuild**: a view rebuilt from all facts must give the same rows. Mappings from
66
+ `$eventContext.occurred` or other occurrence data cannot be executed at Screenplay v4.64.0:
67
+ the plan blocks every event-context path except the event source id
68
+ (`UnsupportedEventContext`). `given clock` does not change that; it supplies `$context.occurred`
69
+ to command productions only. Record such projection cases as capability gaps (keep the
70
+ mapping and the intended spec in design mode).
71
+ - **Corrections and backdated facts**: a correction is a new fact; specify the view after it.
72
+ If a fact carries a business date earlier than its occurrence, specify which date the view
73
+ shows.
74
+
75
+ ## Performer-backed views (no events build them)
76
+ `given readmodel` (complete instance with its key) -> `when query` -> `then result` /
77
+ `then no result` / `then denied`. These are design-mode on most targets; check the mode.
78
+
79
+ ## Cross-context views
80
+ Specs are not limited to one board chapter. Resolve the real event declarations across the
81
+ assembled application (qualify names where needed) and use them, with their real identities, as
82
+ givens. A quoted file import brings the declarations; an unquoted external-contract import does
83
+ not supply an unknown shape or portable execution. If a needed external shape, source identity
84
+ or capability is missing, record the dependency and the blocked scenario: do not invent a local
85
+ replacement event, drop a prerequisite, or count an empty-history spec as external coverage.
86
+ Empty history is valid only when it is itself the intended case (`...WithoutPartnerData`).
87
+
88
+ ## Gated views
89
+ A query under a policy (including module and feature gates) needs `given caller` in every view
90
+ spec, and a denial spec: `then query <Q>` with `arguments` and no `result`, plus `then denied`
91
+ (or `when query <Q>` + `then denied`).
@@ -0,0 +1,13 @@
1
+ {
2
+ "skill": "cratis-screenplay-scenario-coverage",
3
+ "input": "Write the specifications for a ReserveBerth command and its read model, and tell me what coverage is missing.",
4
+ "fixtures": [],
5
+ "assertions": [
6
+ { "kind": "skill-contains", "value": "Coverage matrix before any spec" },
7
+ { "kind": "skill-contains", "value": "Once, idempotent, exactly once are different claims" },
8
+ { "kind": "skill-contains", "value": "Unauthorized is never `then error`" },
9
+ { "kind": "skill-contains", "value": "Screenplay#390" },
10
+ { "kind": "skill-contains", "value": "false PLAY0285" },
11
+ { "kind": "skill-contains", "value": "One behaviour per spec" }
12
+ ]
13
+ }