acture-greenfield-state-model
acture greenfield — designing the state model
This skill expands Step 1 of the acture-greenfield foundation: before any command exists, decide what state exists. The state model is the noun layer (what is there); commands are the verb layer (what can be done to it). Authoring commands before the state model is settled produces commands that fight the state shape — design the nouns first.
Load
acture-greenfieldfirst. That skill owns the four-step greenfield sequence and the dev-tool-first positioning; this skill is the detail of its Step 1.
The four hard constraints on the state shape
A greenfield acture state model is a typed schema the project owns. These four constraints are not style — each one keeps a later consumer surface (macros, e2e, undo, MCP) from breaking. Honour all four:
1. JSON-serializable — JSON.stringify(state) must round-trip
No Set, Map, Date, class instances, functions, or DOM handles in state. Why: macros and e2e tests persist state snapshots as JSON; undo diffs serialize patches; MCP/AI surfaces describe state to a model. A non-serializable value silently breaks all of them.
- Use
Record<id, T>instead ofMap. - Use
string[]of ids instead ofSet. - Store an ISO string, not a
Date. - The test:
structuredClone(JSON.parse(JSON.stringify(state)))must equalstate.