eng-data-backward-compat
Skill23 starsChanged 7 days agoMITView on GitHub
Evolve schemas, persisted rows, idempotency receipts, canonical keys, and SQL migrations without breaking existing production data. Use when tightening validation, changing hash or fingerprint inputs, altering SQL constraints or foreign keys, backfilling data, or querying variable-length IN lists on SQLite, D1, or Postgres.
In this repository46 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agents-autonomous-loopsSkill
- agents-correctSkill
- agents-create-verification-skillSkill
- agents-reflectSkill
- agents-swarmSkill
- alchemy-infraSkill
- cloudflare-edge-hardeningSkill
- cloudflare-gradual-releaseSkill
- comms-howSkill
- comms-impactSkill
- comms-interrogateSkill
- comms-promo-videoSkill
- comms-slidesSkill
- comms-technical-writingSkill
- comms-unslopSkill
- comms-whySkill
- drizzle-postgresSkill
- effect-boundary-validationSkill
- effect-seam-migrationSkill
- effectSkill
- eng-agent-dx-cli-scaleSkill
- eng-ai-featuresSkill
- eng-benchmark-checklistSkill
- eng-blast-radiusSkill
- eng-change-checklistSkill
- eng-cutover-verificationSkill
- eng-migrationSkill
- eng-monorepoSkill
- eng-qa-cujsSkill
- eng-state-machineSkill
- eng-tddSkill
- eng-testingSkill
- gh-ci-triageSkill
- gh-issue-burndownSkill
- gh-pr-commit-reviewSkill
- gh-pr-feedback-loopSkill
- nix-darwinSkill
- reg-suitSkill
- sentry-bugfixSkill
- sentry-perfSkill
- seo-coachSkill
- svelte-shadcnSkill
- svelte-ui-deliverySkill
- ui-audit-loopSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 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.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
Keep DB constraints and app schemas synchronized: When relaxing or tightening a TypeScript schema, update SQL CHECK, NOT NULL, and enum …
- Very specific: line 26
SQLite ID reuse: use ON DELETE SET NULL or explicit tombstones rather than letting deleted integer primary keys be reused and silently …
- Very specific: line 28
Expand and contract: add nullable columns or new enum values first, deploy readers, backfill existing rows, and enforce NOT NULL or drop …
- Distinctive: line 32
Run the migration against a populated N-1 fixture containing legacy rows, blank or pre-format fields, active webhook filters, and unexpired …
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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
Data backward compatibility
Tests on an empty database miss every bug that only exists against yesterday's production rows. Assume old rows, cached receipts, and N-1 writers are live during every deploy. Use drizzle-postgres for Drizzle and PostgreSQL command mechanics, and eng-state-machine for guarded lifecycle writes.
Repo facts (from AGENTS.md): schema and migration paths, populated N-1 migration fixture test command, database engine limits (SQLite or D1 bind cap, Postgres lock timeout), and where Write, Stored, and Wire schemas live.
Separate Write, Stored, and Wire schemas
- Never tighten a shared schema used to decode historical rows. Split strict ingress validation (
Write*) from tolerant persisted-row decoding (Stored*) and external output (Wire*). Tightening a field (non-blank strings, new ISO timestamps, narrower enums) breaks reads of rows already on disk unless you backfill first or decode both forms. - Keep DB constraints and app schemas synchronized. When relaxing or tightening a TypeScript schema, update SQL
CHECK,NOT NULL, and enum constraints in the same PR and run a round-trip test against the real database engine.
Version fingerprints, receipts, and canonical keys
- Never silently change a hash or idempotency fingerprint input. Tag new formats with an explicit version prefix (for example
fp2:) and verify legacy receipts against the old format until the retention window expires. - Key renormalizations need a migration plan. Changing how a URL, ref, or ID is normalized orphans existing rows, webhook filters, and receipts unless you ship an idempotent backfill or boot renormalizer.
- Check cascade order before merging duplicate keys. Updating child rows after deleting a parent with
ON DELETE CASCADEdestroys the children. Repoint children first inside one transaction, then delete the obsolete parent.
Respect database engine hazards
- SQLite, D1, and Durable Object bind limits: chunk any dynamic
IN (...)or bulkINSERTsafely below the 100-parameter cap (for example batch size 50 to 80). - SQLite ID reuse: use
ON DELETE SET NULLor explicit tombstones rather than letting deleted integer primary keys be reused and silently reattached to old event rows. - Lock and DDL ordering: acquire multi-row locks (
FOR UPDATE,FOR SHARE) in one deterministic order (table hierarchy, then sorted key). Guard startup DDL with advisory locks or run migrations out of band so concurrent instances do not deadlock. - Expand and contract: add nullable columns or new enum values first, deploy readers, backfill existing rows, and enforce
NOT NULLor drop legacy filters in a later release.
Verify
- Run the migration against a populated N-1 fixture containing legacy rows, blank or pre-format fields, active webhook filters, and unexpired idempotency receipts, not only a fresh empty database.
- Prove chunked queries handle more than 100 items without hitting bind limits.
- Confirm every tightened rule either splits
WritefromStoredor ships a verified backfill.
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.

