[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M78C538HBFP7AXQ5GJF5HQ1P":3,"skill-same:01M78C538HBFP7AXQ5GJF5HQ1P":93},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":15,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":13,"repositoryHtmlUrl":27,"repositoryHomepageUrl":28,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M78C538HBFP7AXQ5GJF5HQ1P","cratis-screenplay-captures-and-reactions",null,"Model the reactive edges of a Cratis Screenplay `.play` model — `capture` in the Change Data Capture Language for turning external data into events, and `reaction` plus `trigger` for work that runs when something happens, on a schedule, or on an integration signal. Use when integrating an external system, translating outside data into events, or declaring automatic follow-up work in a `.play` model. Do not use for commands, projections or screens.","Cratis\u002FPrologue","Cratis","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F16456213?v=4","01M6BXRH290K4C8RS4PTKK3HXQ","01M78C1YXTSPZGP4G1K2ZM6J1N",0,"MIT","https:\u002F\u002Fgithub.com\u002FCratis\u002FPrologue\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fcratis-screenplay-captures-and-reactions\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FCratis\u002FPrologue\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fcratis-screenplay-captures-and-reactions\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: cratis-screenplay-captures-and-reactions\ndescription: Model the reactive edges of a Cratis Screenplay `.play` model — `capture` in the Change Data Capture Language for turning external data into events, and `reaction` plus `trigger` for work that runs when something happens, on a schedule, or on an integration signal. Use when integrating an external system, translating outside data into events, or declaring automatic follow-up work in a `.play` model. Do not use for commands, projections or screens.\nlicense: MIT\n---\n\u003C!-- cratis-ai-managed: skills\u002Fcratis-screenplay-captures-and-reactions\u002FSKILL.md -->\n\n# Captures and reactions\n\nRead [preferred syntax](..\u002Fcratis-screenplay-toolchain\u002Freferences\u002Fpreferred-syntax.md) when writing or reviewing `.play`.\n\n`capture` accepts outside data; `reaction` responds to an occurrence.\nTranslate slices cross public boundaries; Automation slices cause private follow-up.\n\n## Locate the model\n\nLook first for the project's existing `.play` files: their folder is the model.\nFor a new model, check `Source\u002F` or `src\u002F`, else use `Screenplay\u002F` at the repository\nroot. Never put a model under `.cratis\u002F` or hand-copy it between repositories.\n`cratis ai install` manages `.cratis\u002Fai\u002F`, never model files. Keep explanatory\nMarkdown in project documentation; `.play` is the single flow model.\n\n## Product sources\n\nLanguage claims follow Screenplay `reactions.md`, `triggers.md`, `captures.md` and\n`specifications.md` under `Documentation\u002Fscreenplay\u002F`; renderer claims follow Stage\n`Documentation\u002Freference\u002Freaction-rendering.md`. Tool versions are covered in toolchain\n`SKILL.md`; run the examples at the pinned standalone tool before relying on them.\n\nThe compiler's ESM admission decides, not the slice type. Reactions, triggers and\ncaptures bind\u002Freference-execute from v6; older compilers refuse them. Read toolchain\n`references\u002Fdiagnostics.md` when diagnosing skew or false PLAY0285 cascades.\n- **Stage realization:** read `cratis-stage-rendering-and-sandbox` `references\u002Fadmission.md`\n  before claiming rendering. Supported event-triggered Automation renders; captures,\n  Translate, clocks and opaque bodies remain gap-fill (`-024`).\n  Read [sandbox boundaries](..\u002Fcratis-stage-rendering-and-sandbox\u002Freferences\u002Fsandbox-and-specrunner.md)\n  when checking authored occurrence versus generated-spec limits; a clock fixture is not scheduling.\n\nName the binding tool. For the automation test, loops and translation boundaries,\nread `cratis-screenplay-automations-and-translations`.\n\n## Public boundaries and observer selection\n\nRead [ESM v9 translation](..\u002Fcratis-screenplay-automations-and-translations\u002Freferences\u002Fpublic-events-and-direction.md)\nfor `direction`, `source events`\u002F`from`, typed event fixtures and per-key state folds.\nOne `source events` capture consumes events from exactly one origin (event store).\nSplit inputs from several external systems into one capture per origin; otherwise\nPLAY0687 reports an error, matching Chronicle's one-inbox-observer boundary.\n\nRequires Screenplay 4.155.0 or later (`screenplay --version`) for PLAY0687; older compilers do not catch the runtime-invalid multi-origin capture.\nRead [v10 filters](..\u002Fcratis-screenplay-toolchain\u002Freferences\u002Fproduction-routes-and-filters.md)\nfor reaction\u002Freducer `from Source[.Stream]`; unrouted facts never match.\n\n## Specify what sets them off\n\nA specification names its input: `when clock` or `when trigger` for an automation,\n`when capture` for a record source, and `when append \u003CForeignEvent>` for a capture\nwith `source events`. Seed the latter with `given \u003CForeignEvent>`, never `given capture`\nor `when capture` (PLAY0701). Its key must be a required property of every `from`\nevent, never `$eventSourceId` or another context key (PLAY0700).\n\nRequires Screenplay 4.171.0 or later (`screenplay --version`) for reference execution of captures over events and PLAY0700\u002F0701; older tools leave event delivery unexecuted.\n\nFirst sight is `added` only, not a field change. Read\n[record capture specifications](references\u002Frecord-capture-specifications.md) when\nspecifying first sight, updates, child\u002Fnested additions or unchanged records.\nExecute admitted scenarios through `screenplay test` or MCP `run-specifications`;\nsource compilation alone is only authored evidence.\n\nRead [references\u002Fspecifying-triggers-and-clock.md](references\u002Fspecifying-triggers-and-clock.md) when writing a specification for a reaction, trigger or capture, or when the clock, occurrence or limit rules matter.\n\n## Atomic batches and event-source mappings\n\nStart new models with application-root `reaction batches atomic`. One trigger's direct\nproductions, or one selected refusal branch, append all-or-none; invoked commands stay\nseparate. Legacy models without opt-in retain per-fact appends even at newer versions.\nRead [atomic batches and source mappings](references\u002Fatomic-batches-and-source-mappings.md)\nfor batch failure assertions, PLAY0693, Stage atomic-mode refusals and\n`invokes` mappings from `$eventSourceId` \u002F `$eventContext.eventSourceId`.\n\n## Caller-less invokes and unprotected reads\n\n**Who is the caller of an `invokes`?** Without a declared actor, nobody.\nReactions support reaction-level `runs as system role \"\u003CRole>\"`\n(optional roles, joined with `and role`). It selects ESM v10 and supplies the\nreference invocation's authenticated system principal with exactly those roles;\n`given caller` does not supply it. Keep gates and declare the least-privilege actor.\nRead [invocation identity](references\u002Finvocation-identity.md) for the checked\nscenario, claim\u002Funknown semantics and PLAY0647–0652\u002F0557 diagnostics.\n\nRequires Screenplay 4.125.0 or later (`screenplay --version`) for reaction `runs as system role` (ESM v10).\n\nA compiler that stops before v10 rejects this source with PLAY0137, and a renderer that stops\nbefore v10 refuses it (CLI-RENDER-004); the CLI\u002FStage pair (toolchain\n`references\u002Frenderable-subset.md`) renders supported identity, refusing claim-reading\u002Fopaque gates (STAGE-ESM-034).\nStage emits Arc `[ExecuteCommandsAsSystem]`; refused scope uses authorized gap-fill. The attribute is for returned commands. Without that attribute\nArc supplies no principal and `[Authorize]`\u002F`[Roles]` deny. Each invoked command\nis atomic, not the whole cascade; earlier accepted facts remain after a later refusal.\n\n⚠️ **Declared, not enforced.** A trigger `reads` gives no runtime protection. From\nESM v6 the binder refuses to treat it as one: a trigger with `reads` that **produces\ndirectly**, or whose effect is an opaque body (`file` or an inline block), fails\nbinding, because its decision dependency cannot be protected. A reaction that only\n`invokes` a command binds, and the decision, and any protection, belong to that\ncommand's own reads. Eligible command reads protect under application-root\n`command reads protected` (ESM v25); legacy reads retain PLAY0271. Read command-surface\n[protected reads](..\u002Fcratis-screenplay-command-surface\u002Freferences\u002Fprotected-reads.md)\nfor admission and absence\u002Fconflict behavior. Requires Stage 4.138.0 to render\nprotected reads; older bundles refuse -044. Semantic Host\u002Fexecutor non-Error\nprotected requirements refuse -045.\n`where` over read paths out of scope, and `where` needs\nevery operand to resolve from the trigger's declared scalar occurrence shape (listed in\nthe input selection or not; nested paths and read aliases fail binding): keep the logic that uses the state in\nthe invoked command or the implementation. A compiler that stops before ESM v6 binds none of this\n(`PLAY0268`).\n\n## Refusals and recovery redelivery\n\nInvocation refusal selectors, `$refusal` branch values and `acknowledge`\nbind\u002Freference-execute as ESM v19; `when redelivered ... to ...` and `then no events`\nas ESM v17. Read [refusals and redelivery](references\u002Frefusals-and-redelivery.md)\nwhen choosing ordered first-match branches or specifying recovery, for typed values,\noccurrence matching, diagnostics and a complete example. Never acknowledge\ninfrastructure or concurrency failures; acknowledgement is not completed work.\n\n## Complete example (ESM v6)\n\nThe reference document covers v6 triggers, event\u002Fclock reactions, view reads and\ncapture specifications. Refusal\u002Fredelivery forms use their separate checked reference.\n\nRead [references\u002Fcomplete-examples.md](references\u002Fcomplete-examples.md) when you need a complete, compiling parent document for an excerpt or want to check the authoring and binding prerequisites.\n\n## `capture` — the Change Data Capture Language\n\nCaptures live in `Translate` slices and are the anti-corruption layer: external\nshapes in, domain events out. Excerpt; complete document: `references\u002Fcomplete-examples.md`,\n\"Capture with `source`, `map`, `append` and `children`\".\n\nThe full capture excerpt (`source`, `key`, `map` with `translate`, two `append` blocks and `children`) is in the reference file.\n\nRead [references\u002Fcapture-map-and-example.md](references\u002Fcapture-map-and-example.md) when writing a capture's `map` block, or when you need the excerpt of a capture with `append` and `children`.\n\n**`source \u003Ckind>`** takes free-form settings, so a typo is not caught; **`key \u003Cproperty>`** is required to bind (`PLAY0268`); **`append \u003CEvent>`** takes at most one `when` clause, and `or` and `and` cannot be mixed in one clause (split into two `append` blocks). Read [references\u002Fcapture-map-and-example.md](references\u002Fcapture-map-and-example.md) for source kinds, `key` and specification behavior, the `when` forms table, `children` and `nested`.\n\n## `reaction`\n\nRead [reaction forms](references\u002Freaction-forms.md) when choosing a trigger,\nselecting occurrence values or mapping `produces` and `invokes`; complete documents\nremain in `references\u002Fcomplete-examples.md`.\n\nA reaction declares **at least one trigger**; everything under a trigger is\noptional.\n\n⚠️ **Indentation decides what is a trigger and what is an effect.** `produces`,\n`invokes`, `file` and inline code belong **inside** the trigger block, indented\nunder `when`\u002F`every`\u002F`at`. `description`, `where` and `runs as` sit at reaction level.\nOutdenting an effect gives *Expected a trigger in reaction body, got 'invokes …'*\n(`PLAY0137`) — the compiler is looking for another trigger where the effect is.\n\n### `where` — narrowing\n\n`where` uses the same condition grammar as `produces … when` and `require`:\n`==`, `!=`, the ordering operators, `contains` for a substring anywhere,\n`starts with` for one at the beginning, combined with `and`, `or` and parentheses.\nThese text-condition operators parse but refuse executable binding (PLAY0268);\nliteral property text rules are a separate v24 contract.\n\n⚠️ **`where` belongs to the reaction, not to one trigger** — it says which\noccurrences are worth running for, whatever set them off. A second `where` on one\nreaction is an error; combine with `and`\u002F`or` instead.\n\n### Effects — `produces` vs `invokes`\n\nInline `produces event \u003CName>` is command-only (`PLAY0474` in a reaction).\nDeclare reaction-produced events separately and use plain `produces \u003CName>`.\nDo not extend the inline command destination default or its repairs to reactions.\n\nA `produces` without `for` appends to the event source of the event that set the\nreaction off. A clock, application or built-in trigger has no such event, so what it\nproduces needs `for` - a value the trigger carries, or literal text.\n\n`produces` requests an append; `invokes` also runs command gates and may reject.\n\n**Who is the caller of an `invokes`?** Nobody unless `runs as` declares the actor; see *Caller-less invokes and unprotected reads* above before writing one.\n\nTrigger `file`\u002Ftagged-code attachments are inventoried, never reference-executed;\nsee the reaction forms reference for their boundary.\n\n### What it decides from — trigger `reads`\n\nAn automation decides from state. A trigger names the views it consults with\n`reads \u003CView> [as \u003Calias>] [by \u003Ctrigger value>]` — the same word and meaning as\na command's `reads`: the state the behavior decides from. Excerpt; complete\ndocument: `references\u002Fcomplete-examples.md`, \"Trigger `reads` on an event and on the\nclock\" (authoring-valid; the `file` bodies stop it binding at ESM v6).\n\nThe excerpt of a reaction with `reads` on an event and on the clock is in the reference file.\n\nRead [references\u002Ftrigger-reads-example.md](references\u002Ftrigger-reads-example.md) when writing a trigger `reads` with `by` or an alias, or a clock trigger that reads a whole view.\n\n- `reads` goes under a trigger; `by` names a value that trigger takes (else `PLAY0442`); **Clock triggers read whole views.** `by` under them is `PLAY0443`. Read [references\u002Ftrigger-reads-example.md](references\u002Ftrigger-reads-example.md) for alias rules (`PLAY0410`–`PLAY0412`, `PLAY0177`), the `@reads` escape (`PLAY0175`, `PLAY0444`) and the reserved `for each`.\n\n⚠️ **Declared, not enforced.** See *Caller-less invokes and unprotected reads* above.\n\n## `trigger`\n\nA `trigger` declares that a name exists and what an occurrence hands the reaction, never what makes it occur. Built-ins are `Startup` and `Shutdown`. An unknown name warns `PLAY0248`; **An application trigger is not a UI event** (`PLAY0326`); under a reaction trigger, values named `description`, `file`, `produces`, `invokes` or `reads` are written with `@`. Read [references\u002Ftrigger-declaration.md](references\u002Ftrigger-declaration.md) when declaring or registering a trigger or resolving a trigger name.\n\n## Slice boundaries\n\nRequires Screenplay 4.176.0 or later (`screenplay --version`) for PLAY0694; older compilers leave directionless capture-follow-up co-location unchecked.\n\n> - A capture belongs in `Translate`; a reaction to the local event it appends\n>   belongs in a separate `Automation` slice. A directionless Translate containing\n>   both warns PLAY0694 (fails `--warnaserror`); explicit inbound refuses it with\n>   PLAY0616. A reaction translating a foreign public event can belong in inbound\n>   Translate.\n> - Keep reaction logic small; anything substantial belongs in a `file` reference\n>   where it can be tested on its own.\n> - Describe the reaction before you implement it — a document full of `file` lines\n>   and nothing else tells a reader nothing.\n> - A name that only an integration knows belongs in a `trigger` declaration, so the\n>   document says what the reaction is handed rather than leaving the reader to guess.\n\n## Verify\n\n- [ ] `screenplay \u003Cmodel> --warnaserror` reports zero errors and zero warnings\n      (standalone, or a `cratis` whose compiler admits ESM v6). Under an older compiler expect\n      `PLAY0268` at binding and a false `PLAY0285` on cascade specifications, and report them\n      as tool skew.\n- [ ] The tool that bound the model is named (standalone, or a `cratis` whose compiler admits ESM v6, for ESM v6 constructs); reference scenarios use\n      `screenplay test`\u002FMCP. Unadmitted refusal\u002Fredelivery is not executed evidence.\n- [ ] Each automation has all four components — occurrence, state consulted,\n      conditional logic, resulting command or event. If it always fires\n      unconditionally it is co-production, not an automation.\n- [ ] Every reaction has a termination condition and cannot loop forever.\n- [ ] `produces` is used for facts and `invokes` for intents, never interchangeably.\n- [ ] No `when` clause mixes `or` and `and`.\n- [ ] Cross-cutting infrastructure is **not** modeled as a `Translate` slice.\n- [ ] Every name a reaction takes is carried by the event or trigger.\n- [ ] Each trigger `reads` the views its automation decides from; `by` names a\n      value the trigger takes, and clock triggers read without `by`.\n- [ ] Trigger reads are not protection; protected command reads require opt-in,\n      admission and separate target realization. UI clicks are interactions.\n- [ ] Every gated invocation declares its trusted actor with reaction `runs as`\n      (ESM v10) or records the target gap explicitly; `given caller` is not that actor.\n\n## Route near misses\n\n- Deciding whether a behavior is an automation at all: `cratis-screenplay-event-modeling`.\n- Automation, translation and loop-safety method, and the trusted-actor decision: `cratis-screenplay-automations-and-translations`.\n- Specifying clocks, triggers, captures and cascades: `cratis-screenplay-specifications`.\n- Which tool binds ESM v6 and what each reports: `cratis-screenplay-toolchain`.\n- Hand-built code for an automation Stage does not render: `cratis-screenplay-render-and-gap-fill`.\n- The commands a reaction invokes: `cratis-screenplay-command-surface`.\n- Hand-written C# Chronicle reactors: `cratis-chronicle-reactor`.\n","\u003C!-- cratis-ai-managed: skills\u002Fcratis-screenplay-captures-and-reactions\u002FSKILL.md -->\n\n# Captures and reactions\n\nRead [preferred syntax](..\u002Fcratis-screenplay-toolchain\u002Freferences\u002Fpreferred-syntax.md) when writing or reviewing `.play`.\n\n`capture` accepts outside data; `reaction` responds to an occurrence.\nTranslate slices cross public boundaries; Automation slices cause private follow-up.\n\n## Locate the model\n\nLook first for the project's existing `.play` files: their folder is the model.\nFor a new model, check `Source\u002F` or `src\u002F`, else use `Screenplay\u002F` at the repository\nroot. Never put a model under `.cratis\u002F` or hand-copy it between repositories.\n`cratis ai install` manages `.cratis\u002Fai\u002F`, never model files. Keep explanatory\nMarkdown in project documentation; `.play` is the single flow model.\n\n## Product sources\n\nLanguage claims follow Screenplay `reactions.md`, `triggers.md`, `captures.md` and\n`specifications.md` under `Documentation\u002Fscreenplay\u002F`; renderer claims follow Stage\n`Documentation\u002Freference\u002Freaction-rendering.md`. Tool versions are covered in toolchain\n`SKILL.md`; run the examples at the pinned standalone tool before relying on them.\n\nThe compiler's ESM admission decides, not the slice type. Reactions, triggers and\ncaptures bind\u002Freference-execute from v6; older compilers refuse them. Read toolchain\n`references\u002Fdiagnostics.md` when diagnosing skew or false PLAY0285 cascades.\n- **Stage realization:** read `cratis-stage-rendering-and-sandbox` `references\u002Fadmission.md`\n  before claiming rendering. Supported event-triggered Automation renders; captures,\n  Translate, clocks and opaque bodies remain gap-fill (`-024`).\n  Read [sandbox boundaries](..\u002Fcratis-stage-rendering-and-sandbox\u002Freferences\u002Fsandbox-and-specrunner.md)\n  when checking authored occurrence versus generated-spec limits; a clock fixture is not scheduling.\n\nName the binding tool. For the automation test, loops and translation boundaries,\nread `cratis-screenplay-automations-and-translations`.\n\n## Public boundaries and observer selection\n\nRead [ESM v9 translation](..\u002Fcratis-screenplay-automations-and-translations\u002Freferences\u002Fpublic-events-and-direction.md)\nfor `direction`, `source events`\u002F`from`, typed event fixtures and per-key state folds.\nOne `source events` capture consumes events from exactly one origin (event store).\nSplit inputs from several external systems into one capture per origin; otherwise\nPLAY0687 reports an error, matching Chronicle's one-inbox-observer boundary.\n\nRequires Screenplay 4.155.0 or later (`screenplay --version`) for PLAY0687; older compilers do not catch the runtime-invalid multi-origin capture.\nRead [v10 filters](..\u002Fcratis-screenplay-toolchain\u002Freferences\u002Fproduction-routes-and-filters.md)\nfor reaction\u002Freducer `from Source[.Stream]`; unrouted facts never match.\n\n## Specify what sets them off\n\nA specification names its input: `when clock` or `when trigger` for an automation,\n`when capture` for a record source, and `when append \u003CForeignEvent>` for a capture\nwith `source events`. Seed the latter with `given \u003CForeignEvent>`, never `given capture`\nor `when capture` (PLAY0701). Its key must be a required property of every `from`\nevent, never `$eventSourceId` or another context key (PLAY0700).\n\nRequires Screenplay 4.171.0 or later (`screenplay --version`) for reference execution of captures over events and PLAY0700\u002F0701; older tools leave event delivery unexecuted.\n\nFirst sight is `added` only, not a field change. Read\n[record capture specifications](references\u002Frecord-capture-specifications.md) when\nspecifying first sight, updates, child\u002Fnested additions or unchanged records.\nExecute admitted scenarios through `screenplay test` or MCP `run-specifications`;\nsource compilation alone is only authored evidence.\n\nRead [references\u002Fspecifying-triggers-and-clock.md](references\u002Fspecifying-triggers-and-clock.md) when writing a specification for a reaction, trigger or capture, or when the clock, occurrence or limit rules matter.\n\n## Atomic batches and event-source mappings\n\nStart new models with application-root `reaction batches atomic`. One trigger's direct\nproductions, or one selected refusal branch, append all-or-none; invoked commands stay\nseparate. Legacy models without opt-in retain per-fact appends even at newer versions.\nRead [atomic batches and source mappings](references\u002Fatomic-batches-and-source-mappings.md)\nfor batch failure assertions, PLAY0693, Stage atomic-mode refusals and\n`invokes` mappings from `$eventSourceId` \u002F `$eventContext.eventSourceId`.\n\n## Caller-less invokes and unprotected reads\n\n**Who is the caller of an `invokes`?** Without a declared actor, nobody.\nReactions support reaction-level `runs as system role \"\u003CRole>\"`\n(optional roles, joined with `and role`). It selects ESM v10 and supplies the\nreference invocation's authenticated system principal with exactly those roles;\n`given caller` does not supply it. Keep gates and declare the least-privilege actor.\nRead [invocation identity](references\u002Finvocation-identity.md) for the checked\nscenario, claim\u002Funknown semantics and PLAY0647–0652\u002F0557 diagnostics.\n\nRequires Screenplay 4.125.0 or later (`screenplay --version`) for reaction `runs as system role` (ESM v10).\n\nA compiler that stops before v10 rejects this source with PLAY0137, and a renderer that stops\nbefore v10 refuses it (CLI-RENDER-004); the CLI\u002FStage pair (toolchain\n`references\u002Frenderable-subset.md`) renders supported identity, refusing claim-reading\u002Fopaque gates (STAGE-ESM-034).\nStage emits Arc `[ExecuteCommandsAsSystem]`; refused scope uses authorized gap-fill. The attribute is for returned commands. Without that attribute\nArc supplies no principal and `[Authorize]`\u002F`[Roles]` deny. Each invoked command\nis atomic, not the whole cascade; earlier accepted facts remain after a later refusal.\n\n⚠️ **Declared, not enforced.** A trigger `reads` gives no runtime protection. From\nESM v6 the binder refuses to treat it as one: a trigger with `reads` that **produces\ndirectly**, or whose effect is an opaque body (`file` or an inline block), fails\nbinding, because its decision dependency cannot be protected. A reaction that only\n`invokes` a command binds, and the decision, and any protection, belong to that\ncommand's own reads. Eligible command reads protect under application-root\n`command reads protected` (ESM v25); legacy reads retain PLAY0271. Read command-surface\n[protected reads](..\u002Fcratis-screenplay-command-surface\u002Freferences\u002Fprotected-reads.md)\nfor admission and absence\u002Fconflict behavior. Requires Stage 4.138.0 to render\nprotected reads; older bundles refuse -044. Semantic Host\u002Fexecutor non-Error\nprotected requirements refuse -045.\n`where` over read paths out of scope, and `where` needs\nevery operand to resolve from the trigger's declared scalar occurrence shape (listed in\nthe input selection or not; nested paths and read aliases fail binding): keep the logic that uses the state in\nthe invoked command or the implementation. A compiler that stops before ESM v6 binds none of this\n(`PLAY0268`).\n\n## Refusals and recovery redelivery\n\nInvocation refusal selectors, `$refusal` branch values and `acknowledge`\nbind\u002Freference-execute as ESM v19; `when redelivered ... to ...` and `then no events`\nas ESM v17. Read [refusals and redelivery](references\u002Frefusals-and-redelivery.md)\nwhen choosing ordered first-match branches or specifying recovery, for typed values,\noccurrence matching, diagnostics and a complete example. Never acknowledge\ninfrastructure or concurrency failures; acknowledgement is not completed work.\n\n## Complete example (ESM v6)\n\nThe reference document covers v6 triggers, event\u002Fclock reactions, view reads and\ncapture specifications. Refusal\u002Fredelivery forms use their separate checked reference.\n\nRead [references\u002Fcomplete-examples.md](references\u002Fcomplete-examples.md) when you need a complete, compiling parent document for an excerpt or want to check the authoring and binding prerequisites.\n\n## `capture` — the Change Data Capture Language\n\nCaptures live in `Translate` slices and are the anti-corruption layer: external\nshapes in, domain events out. Excerpt; complete document: `references\u002Fcomplete-examples.md`,\n\"Capture with `source`, `map`, `append` and `children`\".\n\nThe full capture excerpt (`source`, `key`, `map` with `translate`, two `append` blocks and `children`) is in the reference file.\n\nRead [references\u002Fcapture-map-and-example.md](references\u002Fcapture-map-and-example.md) when writing a capture's `map` block, or when you need the excerpt of a capture with `append` and `children`.\n\n**`source \u003Ckind>`** takes free-form settings, so a typo is not caught; **`key \u003Cproperty>`** is required to bind (`PLAY0268`); **`append \u003CEvent>`** takes at most one `when` clause, and `or` and `and` cannot be mixed in one clause (split into two `append` blocks). Read [references\u002Fcapture-map-and-example.md](references\u002Fcapture-map-and-example.md) for source kinds, `key` and specification behavior, the `when` forms table, `children` and `nested`.\n\n## `reaction`\n\nRead [reaction forms](references\u002Freaction-forms.md) when choosing a trigger,\nselecting occurrence values or mapping `produces` and `invokes`; complete documents\nremain in `references\u002Fcomplete-examples.md`.\n\nA reaction declares **at least one trigger**; everything under a trigger is\noptional.\n\n⚠️ **Indentation decides what is a trigger and what is an effect.** `produces`,\n`invokes`, `file` and inline code belong **inside** the trigger block, indented\nunder `when`\u002F`every`\u002F`at`. `description`, `where` and `runs as` sit at reaction level.\nOutdenting an effect gives *Expected a trigger in reaction body, got 'invokes …'*\n(`PLAY0137`) — the compiler is looking for another trigger where the effect is.\n\n### `where` — narrowing\n\n`where` uses the same condition grammar as `produces … when` and `require`:\n`==`, `!=`, the ordering operators, `contains` for a substring anywhere,\n`starts with` for one at the beginning, combined with `and`, `or` and parentheses.\nThese text-condition operators parse but refuse executable binding (PLAY0268);\nliteral property text rules are a separate v24 contract.\n\n⚠️ **`where` belongs to the reaction, not to one trigger** — it says which\noccurrences are worth running for, whatever set them off. A second `where` on one\nreaction is an error; combine with `and`\u002F`or` instead.\n\n### Effects — `produces` vs `invokes`\n\nInline `produces event \u003CName>` is command-only (`PLAY0474` in a reaction).\nDeclare reaction-produced events separately and use plain `produces \u003CName>`.\nDo not extend the inline command destination default or its repairs to reactions.\n\nA `produces` without `for` appends to the event source of the event that set the\nreaction off. A clock, application or built-in trigger has no such event, so what it\nproduces needs `for` - a value the trigger carries, or literal text.\n\n`produces` requests an append; `invokes` also runs command gates and may reject.\n\n**Who is the caller of an `invokes`?** Nobody unless `runs as` declares the actor; see *Caller-less invokes and unprotected reads* above before writing one.\n\nTrigger `file`\u002Ftagged-code attachments are inventoried, never reference-executed;\nsee the reaction forms reference for their boundary.\n\n### What it decides from — trigger `reads`\n\nAn automation decides from state. A trigger names the views it consults with\n`reads \u003CView> [as \u003Calias>] [by \u003Ctrigger value>]` — the same word and meaning as\na command's `reads`: the state the behavior decides from. Excerpt; complete\ndocument: `references\u002Fcomplete-examples.md`, \"Trigger `reads` on an event and on the\nclock\" (authoring-valid; the `file` bodies stop it binding at ESM v6).\n\nThe excerpt of a reaction with `reads` on an event and on the clock is in the reference file.\n\nRead [references\u002Ftrigger-reads-example.md](references\u002Ftrigger-reads-example.md) when writing a trigger `reads` with `by` or an alias, or a clock trigger that reads a whole view.\n\n- `reads` goes under a trigger; `by` names a value that trigger takes (else `PLAY0442`); **Clock triggers read whole views.** `by` under them is `PLAY0443`. Read [references\u002Ftrigger-reads-example.md](references\u002Ftrigger-reads-example.md) for alias rules (`PLAY0410`–`PLAY0412`, `PLAY0177`), the `@reads` escape (`PLAY0175`, `PLAY0444`) and the reserved `for each`.\n\n⚠️ **Declared, not enforced.** See *Caller-less invokes and unprotected reads* above.\n\n## `trigger`\n\nA `trigger` declares that a name exists and what an occurrence hands the reaction, never what makes it occur. Built-ins are `Startup` and `Shutdown`. An unknown name warns `PLAY0248`; **An application trigger is not a UI event** (`PLAY0326`); under a reaction trigger, values named `description`, `file`, `produces`, `invokes` or `reads` are written with `@`. Read [references\u002Ftrigger-declaration.md](references\u002Ftrigger-declaration.md) when declaring or registering a trigger or resolving a trigger name.\n\n## Slice boundaries\n\nRequires Screenplay 4.176.0 or later (`screenplay --version`) for PLAY0694; older compilers leave directionless capture-follow-up co-location unchecked.\n\n> - A capture belongs in `Translate`; a reaction to the local event it appends\n>   belongs in a separate `Automation` slice. A directionless Translate containing\n>   both warns PLAY0694 (fails `--warnaserror`); explicit inbound refuses it with\n>   PLAY0616. A reaction translating a foreign public event can belong in inbound\n>   Translate.\n> - Keep reaction logic small; anything substantial belongs in a `file` reference\n>   where it can be tested on its own.\n> - Describe the reaction before you implement it — a document full of `file` lines\n>   and nothing else tells a reader nothing.\n> - A name that only an integration knows belongs in a `trigger` declaration, so the\n>   document says what the reaction is handed rather than leaving the reader to guess.\n\n## Verify\n\n- [ ] `screenplay \u003Cmodel> --warnaserror` reports zero errors and zero warnings\n      (standalone, or a `cratis` whose compiler admits ESM v6). Under an older compiler expect\n      `PLAY0268` at binding and a false `PLAY0285` on cascade specifications, and report them\n      as tool skew.\n- [ ] The tool that bound the model is named (standalone, or a `cratis` whose compiler admits ESM v6, for ESM v6 constructs); reference scenarios use\n      `screenplay test`\u002FMCP. Unadmitted refusal\u002Fredelivery is not executed evidence.\n- [ ] Each automation has all four components — occurrence, state consulted,\n      conditional logic, resulting command or event. If it always fires\n      unconditionally it is co-production, not an automation.\n- [ ] Every reaction has a termination condition and cannot loop forever.\n- [ ] `produces` is used for facts and `invokes` for intents, never interchangeably.\n- [ ] No `when` clause mixes `or` and `and`.\n- [ ] Cross-cutting infrastructure is **not** modeled as a `Translate` slice.\n- [ ] Every name a reaction takes is carried by the event or trigger.\n- [ ] Each trigger `reads` the views its automation decides from; `by` names a\n      value the trigger takes, and clock triggers read without `by`.\n- [ ] Trigger reads are not protection; protected command reads require opt-in,\n      admission and separate target realization. UI clicks are interactions.\n- [ ] Every gated invocation declares its trusted actor with reaction `runs as`\n      (ESM v10) or records the target gap explicitly; `given caller` is not that actor.\n\n## Route near misses\n\n- Deciding whether a behavior is an automation at all: `cratis-screenplay-event-modeling`.\n- Automation, translation and loop-safety method, and the trusted-actor decision: `cratis-screenplay-automations-and-translations`.\n- Specifying clocks, triggers, captures and cascades: `cratis-screenplay-specifications`.\n- Which tool binds ESM v6 and what each reports: `cratis-screenplay-toolchain`.\n- Hand-built code for an automation Stage does not render: `cratis-screenplay-render-and-gap-fill`.\n- The commands a reaction invokes: `cratis-screenplay-command-surface`.\n- Hand-written C# Chronicle reactors: `cratis-chronicle-reactor`.\n",{"name":5,"license":14,"description":7},"main","feed400071bf3f9f4410a956d73413daa6e1b334",".cratis\u002Fai\u002Fskills\u002Fcratis-screenplay-captures-and-reactions","https:\u002F\u002Fgithub.com\u002FCratis\u002FPrologue","https:\u002F\u002Fwww.cratis.io\u002Fprologue\u002F","https:\u002F\u002Fgithub.com\u002FCratis","https:\u002F\u002Fwww.cratis.io","Open-source (MIT) event sourcing and CQRS for .NET and beyond: Chronicle, Arc, Components and Screenplay.","2026-11-14 06:37:10",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add Cratis\u002FPrologue --skill cratis-screenplay-captures-and-reactions",{"tool":39,"command":40},"bunx","bunx skills add Cratis\u002FPrologue --skill cratis-screenplay-captures-and-reactions",{"tool":42,"command":43},"pnpm","pnpm dlx skills add Cratis\u002FPrologue --skill cratis-screenplay-captures-and-reactions","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FCratis\u002FPrologue\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fcratis-screenplay-captures-and-reactions\u002FSKILL.md",true,[47,51,57,61,65,69,73,77,81,85,89],{"path":48,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":15},"LICENSE","许可证",219,{"path":52,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":55,"sourceHtmlUrl":56},"references\u002Fatomic-batches-and-source-mappings.md","REFERENCE","参考文档",4550,"https:\u002F\u002Fgithub.com\u002FCratis\u002FPrologue\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fcratis-screenplay-captures-and-reactions\u002Freferences\u002Fatomic-batches-and-source-mappings.md",{"path":58,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":59,"sourceHtmlUrl":60},"references\u002Fcapture-map-and-example.md",4332,"https:\u002F\u002Fgithub.com\u002FCratis\u002FPrologue\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fcratis-screenplay-captures-and-reactions\u002Freferences\u002Fcapture-map-and-example.md",{"path":62,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":63,"sourceHtmlUrl":64},"references\u002Fcomplete-examples.md",11265,"https:\u002F\u002Fgithub.com\u002FCratis\u002FPrologue\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fcratis-screenplay-captures-and-reactions\u002Freferences\u002Fcomplete-examples.md",{"path":66,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":67,"sourceHtmlUrl":68},"references\u002Finvocation-identity.md",4189,"https:\u002F\u002Fgithub.com\u002FCratis\u002FPrologue\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fcratis-screenplay-captures-and-reactions\u002Freferences\u002Finvocation-identity.md",{"path":70,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":71,"sourceHtmlUrl":72},"references\u002Freaction-forms.md",2537,"https:\u002F\u002Fgithub.com\u002FCratis\u002FPrologue\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fcratis-screenplay-captures-and-reactions\u002Freferences\u002Freaction-forms.md",{"path":74,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":75,"sourceHtmlUrl":76},"references\u002Frecord-capture-specifications.md",3658,"https:\u002F\u002Fgithub.com\u002FCratis\u002FPrologue\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fcratis-screenplay-captures-and-reactions\u002Freferences\u002Frecord-capture-specifications.md",{"path":78,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":79,"sourceHtmlUrl":80},"references\u002Frefusals-and-redelivery.md",6970,"https:\u002F\u002Fgithub.com\u002FCratis\u002FPrologue\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fcratis-screenplay-captures-and-reactions\u002Freferences\u002Frefusals-and-redelivery.md",{"path":82,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":83,"sourceHtmlUrl":84},"references\u002Fspecifying-triggers-and-clock.md",1966,"https:\u002F\u002Fgithub.com\u002FCratis\u002FPrologue\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fcratis-screenplay-captures-and-reactions\u002Freferences\u002Fspecifying-triggers-and-clock.md",{"path":86,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":87,"sourceHtmlUrl":88},"references\u002Ftrigger-declaration.md",2577,"https:\u002F\u002Fgithub.com\u002FCratis\u002FPrologue\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fcratis-screenplay-captures-and-reactions\u002Freferences\u002Ftrigger-declaration.md",{"path":90,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":91,"sourceHtmlUrl":92},"references\u002Ftrigger-reads-example.md",1747,"https:\u002F\u002Fgithub.com\u002FCratis\u002FPrologue\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fcratis-screenplay-captures-and-reactions\u002Freferences\u002Ftrigger-reads-example.md",[94,102,110,118,126,134],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":98,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":19},"01M78CCRM9594FCYFMCY5W137G","vectorization","Designs, implements, optimizes, and reviews SIMD code in .NET: vectorizing scalar loops with TensorPrimitives, Vector64, Vector128, Vector256, Vector512, or hardware intrinsics, and reviewing existing SIMD code, including the generic Vector type, for contract equivalence, tail handling, memory safety, portability, fallbacks, and measured performance. Use when a .NET loop or SIMD routine is being written or reviewed. Not for performance work unrelated to SIMD.","https:\u002F\u002Fgithub.com\u002FCratis\u002FPrologue\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fvectorization\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FCratis\u002FPrologue\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fvectorization\u002FSKILL.md",[],[],{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":106,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":19},"01M78CCJKGDNSDNCMA92PV8GCR","target-authoring","Canonical patterns for writing custom MSBuild targets: DependsOnTargets versus BeforeTargets and AfterTargets, the Build-to-CoreBuild three-level pattern, and the XxxDependsOn chain-extension pattern. Use when diagnosing or fixing custom-target anti-patterns: Directory.Build.targets redefining SDK targets, targets that replace CompileDependsOn instead of extending it, Outputs versus Returns misuse that returns stale results, missing Inputs\u002FOutputs causing needless rebuilds, or missing FileWrites registration. Not for incremental build tuning or general anti-pattern review (use the msbuild skill), or non-MSBuild build systems.","https:\u002F\u002Fgithub.com\u002FCratis\u002FPrologue\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Ftarget-authoring\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FCratis\u002FPrologue\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Ftarget-authoring\u002FSKILL.md",[],[],{"skillNo":111,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":114,"sourceHtmlUrl":115,"categories":116,"keywords":117,"publishedAt":19},"01M78CCCWS16JZA36AGB5YVMAN","run-tests","Chooses and runs the repository-compatible .NET test command: classic, VSTest, bridged MTP, or native MTP syntax for MSTest, xUnit, NUnit, and TUnit. Use before running .NET tests or answering with a test command or flags: run the tests, one test, class, category, trait or target framework, combined filters, --filter-query, --no-build, --diag, TRX, coverage collection, crash or hang dumps, filter errors, or unrecognized options. Not for platform identification alone (use platform-detection), writing or debugging test code, interpreting a coverage report (use coverage-analysis), CI investigation, migration, or a persistent hot-reload loop.","https:\u002F\u002Fgithub.com\u002FCratis\u002FPrologue\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Frun-tests\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FCratis\u002FPrologue\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Frun-tests\u002FSKILL.md",[],[],{"skillNo":119,"name":120,"nameZh":6,"description":121,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":122,"sourceHtmlUrl":123,"categories":124,"keywords":125,"publishedAt":19},"01M78CC6VC08Y3WTN4T784DYDY","profiling","Uses the free official .NET diagnostics CLI tools for profiling and runtime investigation in a repository: CPU, GC pressure, allocation growth, exception storms, lock contention, and slow code. Use when a .NET application needs performance or runtime profiling. Not for replacing realistic performance or load tests with ad-hoc tracing, production heap collection without a pause-risk plan, crash dumps (use dump-collect), or benchmark design (use microbenchmarking).","https:\u002F\u002Fgithub.com\u002FCratis\u002FPrologue\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fprofiling\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FCratis\u002FPrologue\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fprofiling\u002FSKILL.md",[],[],{"skillNo":127,"name":128,"nameZh":6,"description":129,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":130,"sourceHtmlUrl":131,"categories":132,"keywords":133,"publishedAt":19},"01M78CC14WNAP1Y77ZMM4VD29A","platform-detection","Identifies a .NET project's test platform, framework, command mode, and SDK-style versus classic project system, resolving global.json, project, packages.config, Directory.Build.props, and Directory.Packages.props precedence for MSTest, xUnit, NUnit, and TUnit. Use when asking \"which test platform or framework?\", \"VSTest or MTP?\", or \"what runner does this project use?\", including bridge settings, UseVSTest opt-outs, and conflicting VSTest\u002FMTP configuration. Not for running or filtering tests, commands, flags, TRX, dumps, or test-command errors (use run-tests), or for hot-reload or migration requests.","https:\u002F\u002Fgithub.com\u002FCratis\u002FPrologue\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fplatform-detection\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FCratis\u002FPrologue\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fplatform-detection\u002FSKILL.md",[],[],{"skillNo":135,"name":136,"nameZh":6,"description":137,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":138,"sourceHtmlUrl":139,"categories":140,"keywords":141,"publishedAt":19},"01M78CBVQKQZ6C9VZAD48GB8AC","orleans","Designs Microsoft Orleans systems from each primitive's purpose and failure model: grains, digital twins, state versus databases, transactions, messaging, streams, timers, reminders, Durable Jobs, stateless workers, grain services, startup, and hosting. Use when a task needs an Orleans design decision: inspect version and topology, choose the primitive, implement, and validate. Not for other actor stacks, batch processing, relational-only CRUD, or advice without an Orleans decision.","https:\u002F\u002Fgithub.com\u002FCratis\u002FPrologue\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Forleans\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FCratis\u002FPrologue\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Forleans\u002FSKILL.md",[],[]]