When the trigger for a function is a change in some piece of state (not a request or a schedule), bind the function to a state-change trigger advertised by a state worker. The engine fires the function whenever the watched key or scope changes. The function code is the same as any other; only the trigger registration differs.
Scanned 9/3/2026
Install to Claude Code
npx -y skills add iii-hq/iii --skill patterns --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Patterns?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/iii-hq-patterns-iii)More formats (shields.io, HTML) on the badges page.
<!-- generated by iii-skill-render. DO NOT EDIT (changes here are overwritten on the next render). Edit docs/0-12-0/patterns/reactive-state-pattern.mdx. -->
# Reactive State Pattern
When the trigger for a function is a change in some piece of state (not a request or a schedule),
bind the function to a state-change trigger advertised by a state worker. The engine fires the
function whenever the watched key or scope changes. The function code is the same as any other;
only the trigger registration differs.
## When to use this pattern
When the action is conceptually "whenever this data changes, do this", instead of "on schedule" or
"on demand". Examples: rebuild a derived index when its source state changes, fan out a notification
when a user record updates, propagate a calculated value into another scope when its inputs move.
## Structure
1. A state worker holds the source-of-truth state.
2. A function in some worker handles the change (compute a derived value, send a notification,
etc.).
3. A trigger advertised by the state worker binds that function to the relevant key or scope so the
engine fires it on every change.
The trigger type, its config shape, and the state worker's read/write surface are documented in
that worker's Worker Docs.
{/* TODO: full worked example with a state set/write and a derived function. Cover the trigger config shape, scope vs key matching, ordering guarantees, and how to handle bursts of changes. */}
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!