one-man-startup / rules
Cursor rule16 starsChanged 2 days agoMITView on GitHub
How any write to real user or business data proves itself and stays reversible - before-image journal, read-back proof that the target changed and nothing else did, undo by change id. Use for every write, migration, backfill or bulk edit on real data.
We split this skill-safe-data-write.mdc into the rules it gives an agent
7 rules. About 0 are common, 6 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
Before: read the target rows and the row count of the table.
- Very specific: line 19
Prove: read back. The target rows hold exactly the intended values, and every other row is unchanged (compare a hash or the rows …
- Distinctive: line 30
Run on a copy first, with the proof.
- Distinctive: line 37
Add the new column or table beside the old, nullable, nothing reading it yet.
- Distinctive: line 38
Write both the old and the new.
- Distinctive: line 42
Stop writing the old; drop it in a later deploy of its own.
- Distinctive: line 57
Every suite that touches stored data asserts the data it did not mean to change is byte-identical before and after.
≈ “Common” is an estimate: at least 1 in 5 of the 6,350 Cursor rule 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
---
description: "How any write to real user or business data proves itself and stays reversible - before-image journal, read-back proof that the target changed and nothing else did, undo by change id. Use for every write, migration, backfill or bulk edit on real data."
alwaysApply: false
---
<!-- Generated by tools/sync_adapters.py from skills/safe-data-write/SKILL.md. Edit the source, not this file. -->
# Safe data write
**Nothing may corrupt the data.** A 200 response proves the server answered, not that the data
is right.
## Every write
1. **Before:** read the target rows and the row count of the table.
2. **Journal:** append `{change_id, at, op, table, row_id, before, after}` to the change journal
before applying. The journal stores before-images, not table snapshots.
3. **Apply** the write.
4. **Prove:** read back. The target rows hold exactly the intended values, and every other row
is unchanged (compare a hash or the rows themselves). Return
`{ok, rows_before, rows_after, other_rows_checked, differences}`.
5. **Accept** the write only if `ok` is true and `other_rows_checked` equals the table's row
count minus the rows changed. Anything else: undo it and report.
An undo applies the inverse of a journal entry and is itself journalled, so undoing an undo is a
redo.
## Migrations and bulk changes
Run on a copy first, with the proof. Then on production only with the founder's go for that
exact operation, with a tested backup taken in the same session.
## Schema changes
Expand, then contract, never in one deploy:
1. Add the new column or table beside the old, nullable, nothing reading it yet.
2. Write both the old and the new.
3. Backfill in throttled batches, each with the proof above; build large indexes without
blocking writes.
4. Switch reads to the new shape; keep writing both until it has run a while.
5. Stop writing the old; drop it in a later deploy of its own.
Old and new code are both valid against the schema at every step. A drop or a rename never
ships in the same deploy as the code that depends on it, and every step has a down path tried
on the copy.
## Deprecation and removal
Nothing is deprecated without a replacement that already works in production, and nothing is
removed until its use measures zero (metrics, logs or a dependency search); then code, tests,
docs, config and notices go together. Traffic moves in steps (a tenth, half, all) with the old
path kept until the last step holds.
## Tests
Every suite that touches stored data asserts the data it did not mean to change is
byte-identical before and after.
## When you catch yourself saying
| The excuse | The answer |
|---|---|
| "It's one row, I'll just update it." | One wrong row on a customer's invoice is the whole incident. Same protocol. |
| "The API returned 200." | 200 means the server answered. Read the row back. |
| "A full read-back is too slow on this table." | Prove the largest set you can, say what was not checked, and never write "verified". |
| "The backup exists." | A backup never restored is a hope. Restore it once, this session. |
| "The migration is reversible in principle." | Run the undo on the copy and show the proof. |
| "This is just a cleanup." | Cleanups delete. A delete is an update to `deleted_at` with the same proof until the founder sets a retention rule. |
Red flags: a write with no before-image; "it returned 200" as proof; an undo nobody ran; a
bulk change run straight on real data without a copy first.
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 3,978 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository120 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/agent-agentic-workflow.mdcCursor rule
- .cursor/rules/agent-android-dev.mdcCursor rule
- .cursor/rules/agent-architect.mdcCursor rule
- .cursor/rules/agent-backend-dev.mdcCursor rule
- .cursor/rules/agent-dashboard.mdcCursor rule
- .cursor/rules/agent-debugger.mdcCursor rule
- .cursor/rules/agent-desktop-dev.mdcCursor rule
- .cursor/rules/agent-devops.mdcCursor rule
- .cursor/rules/agent-explainer-writer.mdcCursor rule
- .cursor/rules/agent-feasibility.mdcCursor rule
- .cursor/rules/agent-growth.mdcCursor rule
- .cursor/rules/agent-ios-dev.mdcCursor rule
- .cursor/rules/agent-legal.mdcCursor rule
- .cursor/rules/agent-optimizer.mdcCursor rule
- .cursor/rules/agent-orchestrator.mdcCursor rule
- .cursor/rules/agent-platform-architect.mdcCursor rule
- .cursor/rules/agent-platform-designer.mdcCursor rule
- .cursor/rules/agent-product-designer.mdcCursor rule
- .cursor/rules/agent-qa.mdcCursor rule
- .cursor/rules/agent-researcher.mdcCursor rule
- .cursor/rules/agent-reviewer.mdcCursor rule
- .cursor/rules/agent-rollback.mdcCursor rule
- .cursor/rules/agent-security.mdcCursor rule
- .cursor/rules/agent-setup.mdcCursor rule
- .cursor/rules/agent-social-media.mdcCursor rule
- .cursor/rules/agent-web-dev.mdcCursor rule
- .cursor/rules/skill-bug-fix.mdcCursor rule
- .cursor/rules/skill-commit.mdcCursor rule
- .cursor/rules/skill-context-budget.mdcCursor rule
- .cursor/rules/skill-cost-audit.mdcCursor rule
- .cursor/rules/skill-decision-log.mdcCursor rule
- .cursor/rules/skill-experiment.mdcCursor rule
- .cursor/rules/skill-founder-voice.mdcCursor rule
- .cursor/rules/skill-frontend-design.mdcCursor rule
- .cursor/rules/skill-gates.mdcCursor rule
- .cursor/rules/skill-grilling.mdcCursor rule
- .cursor/rules/skill-handoff.mdcCursor rule
- .cursor/rules/skill-human-design.mdcCursor rule
- .cursor/rules/skill-human-steps.mdcCursor rule
- .cursor/rules/skill-karpathy-guidelines.mdcCursor rule
- .cursor/rules/skill-known-reds.mdcCursor rule
- .cursor/rules/skill-legal-review.mdcCursor rule
- .cursor/rules/skill-new-feature.mdcCursor rule
- .cursor/rules/skill-observability.mdcCursor rule
- .cursor/rules/skill-ordered-steps.mdcCursor rule
- .cursor/rules/skill-performance.mdcCursor rule
- .cursor/rules/skill-readiness-gate.mdcCursor rule
- .cursor/rules/skill-release.mdcCursor rule
- .cursor/rules/skill-requirement-first.mdcCursor rule
- .cursor/rules/skill-setup.mdcCursor rule
- .cursor/rules/skill-single-source.mdcCursor rule
- .cursor/rules/skill-spec-audit.mdcCursor rule
- .cursor/rules/skill-tailoring.mdcCursor rule
- .cursor/rules/skill-twin-check.mdcCursor rule
- .cursor/rules/skill-verified-claims.mdcCursor rule
- .cursor/rules/skill-verify-green.mdcCursor rule
- bug-fixSkill
- commitSkill
- The first 60 shown.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

