reliable-mutations
Skill0 starsChanged 4 days agoMITView on GitHub
How an action changes data safely, by validating everything first, batching related writes in one transaction, re-reading to verify, reporting "M of N saved" honestly, and never stating a change that the receipt does not show. Use when writing or reviewing an action that writes, or a flow that changes several records.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- BuilderIO/agent-nativetheir own version, first seen Oct 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- BuilderIO/agent-native★ 7.6ksame name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository29 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- accessibilitySkill
- actionsSkill
- adding-a-featureSkill
- agent-workflowSkill
- app-contextSkill
- approval-and-safetySkill
- backend-proxySkill
- background-workSkill
- build-an-appSkill
- capture-learningsSkill
- clean-architectureSkill
- customizing-the-assistantSkill
- delegate-to-agentSkill
- edit-boundariesSkill
- i18n-and-rtlSkill
- model-providersSkill
- performanceSkill
- permissions-and-platformSkill
- read-the-docsSkill
- routingSkill
- secretsSkill
- state-managementSkill
- storing-dataSkill
- testingSkill
- ui-designSkill
- upgrade-the-frameworkSkill
- verifySkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Don't load this for the action's shape, naming and registration.
- Very specific: line 14
After writing, re-read the stored record and set verified on the receipt from what you read.
- Distinctive: line 15
When a batch can partly succeed, say so: "2 of 3 saved", with the ids that failed.
- Very specific: line 33
Long actions check
context.cancelbefore each write: After the action's timeout the caller gets a timeout failure but the action keeps … - Very specific: line 48
Use test/support/actions_harness.dart to run the action through a registry.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Reliable mutations
Don't load this for the action's shape, naming and registration; see actions.
Rule
- Validate every input before the first write. A failure then leaves nothing behind.
- Related writes (several records, or a record plus its children) go in one database transaction so they all land or none do.
- After writing, re-read the stored record and set
verifiedon the receipt from what you read. - When a batch can partly succeed, say so: "2 of 3 saved", with the ids that failed. Never "done".
- Whatever the assistant tells the person must match the receipts. Do not state a change that no receipt shows.
Enforced by receipts checked in the action tests (test/actions/); no lint rule or doctor check exists for it.
Why
The assistant repeats what the action returns. A half-applied change reported as complete, or a write that never landed, becomes a false statement to the person. A receipt with verified: false or a clear count lets the assistant and the UI say what really happened.
How
Copy lib/domain/actions/items_actions.dart:
- Validate first.
_titleand_descriptionthrowinvalid_input(with the field path) before any repository call. They run insiderun, not only in the schema, because screens callregistry.runwith typed input that skips the JSON schema.UpdateItemalso rejects a call that changes nothing. - Write, re-read, record.
CreateItemcallsitems.createItem, thenitems.getItem(created.id), thencontext.receipt(resource: 'items', ids: [...], summary: ..., verified: stored != null).DeleteItemsetsverifiedtoawait items.getItem(input) == null. - Missing target. Throw
ActionFailure('not_found', ...)and listnot_foundinfailureCodes. - Several records. Check all of them first (every id exists, every value is valid). Do the writes in one transaction in the repository, for example
db.transaction(() async { ... })in thelib/data/implementation, so the action calls one repository method. Re-read all ids afterwards.DeleteItemsis the model: it checks every id (not_found, ids indetails), calls one repository method, re-reads and reports "M of N". - If a partial result is unavoidable (an external call per record), record one receipt with the ids that did save and put "M of N saved" plus the failed ids in the summary and output.
- Long actions check
context.cancelbefore each write. After the action'stimeoutthe caller gets atimeoutfailure but the action keeps running; the registry cancelscontext.cancelso it can stop. Receipts recorded before a thrownActionFailurecome back onfailure.receipts. - Return the stored record, so the model has the real ids and values.
Anti-patterns
- Looping
createItemover input and throwing on the third, after two are saved. verified: truehard-coded without a read.- A summary written from the input ("Renamed to X") instead of the stored value.
- Swallowing an error and returning success.
- Doing the validation in the dialog only.
- Building the "all done" sentence in the assistant from the request instead of the receipts.
Verification
- Each action test asserts the stored data and the receipt: see
test/actions/create_item_test.dartandtest/actions/update_item_test.dart. Add a case where validation fails and assert nothing was written. - Use
test/support/actions_harness.dartto run the action through a registry. dart run tool/action.dart <name> '<json>'prints the output and receipts.tool/check.shends withAll checks passed.
Related skills
actions— the shape of an action and its failure codes.storing-data— constraints and transactions in the data layer.approval-and-safety— deletes and bulk changes that need the person's approval.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

