Creates scoped key-value stores, reads and writes state entries, lists keys, and performs partial updates across functions. Use when persisting data between invocations, managing user sessions, caching computed values, storing feature flags, sharing state between workers, or building a KV data layer as an alternative to Redis or DynamoDB.
78
72%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Passed
No known issues
Optimize this skill with Tessl
npx tessl skill review --optimize ./skills/iii-state-management/SKILL.mdComparable to: Redis, DynamoDB, Memcached
Use the concepts below when they fit the task. Not every state operation needs all of them.
null for missing keys)ops array for fine-grained changesscope, key, and value to address state entriesFunction
→ trigger('state::set', { scope, key, value })
→ trigger('state::get', { scope, key })
→ trigger('state::update', { scope, key, ops })
→ trigger('state::delete', { scope, key })
→ trigger('state::list', { scope })
→ StateModule → KvStore / Redis adapter| Primitive | Purpose |
|---|---|
trigger({ function_id: 'state::set', payload }) | Write a value to state |
trigger({ function_id: 'state::get', payload }) | Read a value from state |
trigger({ function_id: 'state::list', payload }) | List all keys in a scope |
trigger({ function_id: 'state::delete', payload }) | Remove a key from state |
trigger({ function_id: 'state::update', payload: { ops } }) | Partial merge with operations array |
See ../references/state-management.js for the full working example — functions that read, write, update, and delete state entries across a shared scope.
Also available in Python: ../references/state-management.py
Also available in Rust: ../references/state-management.rs
Code using this pattern commonly includes, when relevant:
registerWorker(url, { workerName }) — worker initializationtrigger({ function_id: 'state::set', payload: { scope, key, value } }) — write statetrigger({ function_id: 'state::get', payload: { scope, key } }) — read state (returns null if missing)trigger({ function_id: 'state::update', payload: { scope, key, ops } }) — partial mergetrigger({ function_id: 'state::list', payload: { scope } }) — enumerate keystrigger({ function_id: 'state::delete', payload: { scope, key } }) — remove entryconst logger = new Logger() — structured loggingUse the adaptations below when they apply to the task.
user-sessions, order-data, config)state::get with a null check to handle missing keys gracefullystate::update with ops for partial updates instead of read-modify-write cyclesiii-queue-processing to persist results after async job completionStateModule must be enabled in iii-config.yaml with a KvStore adapter (file-based or Redis). See ../references/iii-config.yaml for the full annotated config reference.
iii-state-reactions.iii-realtime-streams.iii-state-management when the primary need is reading and writing persistent key-value data.iii-state-management in the iii engine.8921efa
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.