shadow-data
Skill1 starsChanged yesterdayMITView on GitHub
Application Data Lifecycle & Migrations. Use when writing zero-downtime Expand-Contract database migrations, deterministic seeds, safe backfills, bulk import/export streaming, or ACID transaction locking. Do NOT use for live DB introspection or Pentaho/DW ETL (/shadow-db).
In this repository51 other files it gives its agents.
- antislop-codeSkill
- antislop-copywritingSkill
- antislop-humanSkill
- antislop-layoutmobileSkill
- antislopSkill
- antislop-uiSkill
- context7Skill
- handoffSkill
- shadow-accessibilitySkill
- shadow-apiSkill
- shadow-architectSkill
- shadow-authSkill
- shadow-bootstrapSkill
- shadow-browserSkill
- shadow-cacheSkill
- shadow-compatSkill
- shadow-concurrencySkill
- shadow-dbSkill
- shadow-debugSkill
- shadow-designSkill
- shadow-discoverySkill
- shadow-docSkill
- shadow-domainSkill
- shadow-eaSkill
- shadow-evalSkill
- shadow-finopsSkill
- shadow-gitSkill
- shadow-grcSkill
- shadow-handoverSkill
- shadow-integrateSkill
- shadow-maintainSkill
- shadow-mobileSkill
- shadow-modernizeSkill
- shadow-monarchSkill
- shadow-observeSkill
- shadow-opsSkill
- shadow-perfSkill
- shadow-planSkill
- shadow-pmoSkill
- shadow-presalesSkill
- shadow-privacySkill
- shadow-qualitySkill
- shadow-realtimeSkill
- shadow-refactorSkill
- shadow-releaseSkill
- shadow-resilienceSkill
- shadow-searchSkill
- shadow-secSkill
- shadow-supplychainSkill
- shadow-testSkill
- shadow-uatSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
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 14
Never run destructive or table-locking DDL (DROP COLUMN, RENAME COLUMN, adding NOT NULL without default on huge tables) in a single …
- Very specific: line 35
Never store currency or exact quantities as FLOAT / DOUBLE / JS number floats.
- Very specific: line 56
When using soft deletes (deleted_at TIMESTAMPTZ), remember that unique constraints must use partial indexes (CREATE UNIQUE INDEX ...
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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
Shadow Data (/shadow-data) — Data Lifecycle, Safe Migrations & Transaction Integrity
While /shadow-db handles live database introspection, ERDs, and Data Warehouse/Pentaho generation, use /shadow-data whenever managing how data changes, moves, and stays consistent throughout the application's lifecycle.
1. Zero-Downtime Schema Migration Pattern (Expand -> Migrate -> Contract)
Never run destructive or table-locking DDL (DROP COLUMN, RENAME COLUMN, adding NOT NULL without default on huge tables) in a single deployment while old application instances are still serving traffic.
| Phase | Action | Compatibility Guarantee |
| 1. Expand | Add new nullable column/table; add indexes concurrently (CREATE INDEX CONCURRENTLY in Postgres); deploy code that dual-writes to both old and new columns. | Old and new code versions both run safely; instant code rollback is 100% safe. |
| 2. Backfill | Run a batched, throttled backfill script (LIMIT 1000 per transaction with short sleep) to populate historical rows without locking the table or blowing up WAL replication lag. | Zero table lock; zero impact on live OLTP latency. |
| 3. Switch & Validate | Enforce NOT NULL (using CHECK (...) NOT VALID then VALIDATE CONSTRAINT), switch reads to the new column. | Verified 100% data completeness before switching. |
| 4. Contract | Remove dual-write code and drop the obsolete column in a subsequent release. | Clean schema with zero downtime. |
- Ephemeral Migration Verification Container Cleanup: Whenever verifying migrations against an ephemeral Docker database (
*-migration-verification/*-test-*), always launch withdocker run --rm --label shadow.ephemeral=trueand wrap the run intry / finally(trap EXIT) executingdocker rm -f -v <container>(ordocker compose -p <project>-migtest down -v --rmi local --remove-orphans) so zero stopped containers, volumes, or temporary images remain after verification passes.
2. Transaction Integrity & Concurrency Control
- Atomic Multi-Step Writes:
- Wrap related writes (e.g., creating an order, decrementing inventory, and inserting an outbox event) inside a single database transaction (
BEGIN ... COMMIT). - Never perform external network/HTTP/SMTP calls inside an open DB transaction, as slow external responses hold row locks and exhaust the DB connection pool.
- Wrap related writes (e.g., creating an order, decrementing inventory, and inserting an outbox event) inside a single database transaction (
- Preventing Lost Updates & Race Conditions:
- For financial balances, stock counts, and quota deductions, use atomic SQL updates (
UPDATE wallets SET balance = balance - $1 WHERE id = $2 AND balance >= $1), pessimistic row locks (SELECT ... FOR UPDATE), or optimistic concurrency (version = version + 1 WHERE id = $1 AND version = $2).
- For financial balances, stock counts, and quota deductions, use atomic SQL updates (
- Monetary & Numeric Precision:
- Never store currency or exact quantities as
FLOAT/DOUBLE/ JSnumberfloats. Use integer minor units (BIGINTcents/rupiah) orNUMERIC(18, 2).
- Never store currency or exact quantities as
- Isolation Anomalies, Lock Budgets & Outbox/CDC Boundary:
- Explicitly match transaction isolation level (
READ COMMITTED+ atomicUPDATE ... WHEREorSERIALIZABLEwith retry on40001/40P01) against read-skew, write-skew, and phantom-read hazards. - Set explicit
lock_timeoutandstatement_timeouton online DDL/backfill sessions so migrations never queue behind slow queries and block production traffic. - Coordinate durable outbox/CDC event inserts inside the same transaction with
/shadow-concurrency.
- Explicitly match transaction isolation level (
3. Deterministic Seeding & Bulk Import/Export Rules
- Idempotent Seeding (
db:seed):- Seed scripts must use
UPSERT(ON CONFLICT DO UPDATE/ON DUPLICATE KEY UPDATE) so runningdb:seedmultiple times never fails with duplicate key errors or creates duplicate master rows. - Separate System Reference Seeds (roles, permissions, regions, status codes — safe for production) from Demo/Dummy Seeds (fake users/orders — strictly blocked when
NODE_ENV=production).
- Seed scripts must use
- Safe Bulk Import & Export:
- Imports (CSV/Excel): Validate all rows against schema rules first, report exact row/column line errors to the user, and insert in bounded batches (
500–1,000rows per batch). - Exports: Stream large datasets via cursor/chunked queries rather than loading $100,000+$ ORM objects into RAM at once.
- Imports (CSV/Excel): Validate all rows against schema rules first, report exact row/column line errors to the user, and insert in bounded batches (
4. Data Retention, Archival & Soft-Delete Hygiene
- When using soft deletes (
deleted_at TIMESTAMPTZ), remember that unique constraints must use partial indexes (CREATE UNIQUE INDEX ... WHERE deleted_at IS NULL) so a deleted email/code can be reused later. - Define archival/retention policies for high-growth log/telemetry tables (e.g., monthly declarative partitioning
PARTITION BY RANGE (created_at)).
5. Execution Approval & Migration Boundary (L1 vs L4)
- Authoring additive Expand-only migrations locally is
L1_SAFE_VERIFICATION. Running destructive DDL (DROP,TRUNCATE,RENAME,migrate reset) or executing migrations against staging/production/unknown databases isL4: HIGH_IMPACTand NEVER authorized by a bug fix without explicit Monarch approval and verified backup/rollback (shadow-monarch/scripts/execution_approval_gate.py).
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.

