Whether the data can be trusted — the constraints and checks that prevent the corrupt, orphaned, and contradictory rows that quietly accumulate.
Free & open · no signup · read-only — it ends by asking · nothing leaves your machine
You are working inside this repo. Mission: judge whether the schema and the code that writes to it prevent bad data — or merely hope for good data — and find the invariants that are assumed but never enforced.
Read-only pass. Read the schema, models, and write paths; run read-only queries to find existing bad rows; change nothing else. Your only write is the report file.
Phase 2 sweeps the codebase through every one of these, citing file and line for each finding.
missing NOT NULL, unique, foreign-key, and check constraints the domain needs
orphaned rows, dangling references, cascades that delete too much or too little
the same entity stored twice; no natural key to dedupe on
an invariant enforced in one write path but not the others
free text where an enum belongs; impossible state combinations allowed
timezone-naive timestamps, float money, nullable-vs-zero confusion
half-migrated columns, defaults masking missing data
One structured report at the repo root — or in reports/, if you keep one — the same shape every time, ready for a teammate — or the optional Studio — to act on.
Every Goal Prompt follows the same four steps, so results are consistent and repeatable — no matter which one you run.
Map the core entities, their relationships, and the invariants the domain requires.
Cite the table, column, or write path for every finding.
Rank by blast radius.
Create INTEGRITY.md at repo root.
Copy it and paste it into your agent inside the repo you want checked.
Install the goal plugin once — two commands — then just type /goal:data-integrity.
/plugin marketplace add GhostlyGawd/goal-prompts/plugin install goal@goal-promptsOr install only this Goal Prompt as /goal-data-integrity:
curl -fsSL https://goal-prompts.vercel.app/install | BRIEF=89 shLet an agent fetch it mid-conversation, or pull the raw Goal Prompt by URL.
https://goal-prompts.vercel.app/raw/89.mdNothing hidden — this is the whole Goal Prompt, verbatim. Read it in a minute, edit it, or copy it as-is.
# Goal: Data Integrity Audit You are working inside this repo. Mission: judge whether the schema and the code that writes to it prevent bad data — or merely hope for good data — and find the invariants that are assumed but never enforced. Read-only pass. Read the schema, models, and write paths; run read-only queries to find existing bad rows; change nothing else. Your only write is the report file. ## Phase 1 — Learn the data model - Map the core entities, their relationships, and the invariants the domain requires. - Find every path that writes each entity: endpoints, jobs, migrations, seed scripts, admin tools. - Note where the same data is written from more than one place. ## Phase 2 — Audit through 7 lenses Cite the table, column, or write path for every finding. 1. **Constraints** — missing `NOT NULL`, unique, foreign-key, and check constraints the domain needs 2. **Referential integrity** — orphaned rows, dangling references, cascades that delete too much or too little 3. **Duplication** — the same entity stored twice; no natural key to dedupe on 4. **Validation placement** — an invariant enforced in one write path but not the others 5. **Enumerations & state** — free text where an enum belongs; impossible state combinations allowed 6. **Temporal & numeric soundness** — timezone-naive timestamps, float money, nullable-vs-zero confusion 7. **Migration residue** — half-migrated columns, defaults masking missing data ## Phase 3 — Curate - Rank by blast radius: an invariant that guards money or identity outranks a cosmetic one. - For each, give the constraint or check to add and a query to find rows already violating it. - Separate "prevent new bad data" from "clean up existing"; both are needed. ## Phase 4 — Report Create `INTEGRITY.md` at repo root: 1. **Integrity risks** — ranked by blast radius, with the invariant at stake 2. **Findings** — each: table/column · the missing guard · a query to find bad rows · the fix 3. **Constraint plan** — the constraints and checks to add, ordered by safety 4. **Cleanup** — the existing bad data to reconcile before enforcing Start the report with today's date. If `INTEGRITY.md` already exists from a previous run, read it first and lead with what changed since. ## Rules - An invariant enforced in code but not the schema will be violated eventually - Every finding names a query that surfaces the rows already breaking it - No stored data to keep consistent in this repo? Say so in a one-paragraph null report and stop — a null result is a valid finding. - If a `reports/` directory exists at the repo root, write the report there instead of the root. - Before asking, present the top findings as a ranked list in plain words - Report only — end by asking which constraints to enforce first
reports/ directory exists at the repo root, write the report there instead of the root.Missing indexes, absent constraints, JSON blobs hiding structure — with a migration plan sequenced safest-first.
Which user behaviors are invisible today — and the tracking plan that makes the five questions that matter answerable.
Trace where personal data enters, spreads, and lingers — then run the delete-request test: could you honor one today?
Mine the git history for churn, bug magnets, coupled files, and bus-factor silos — predict where the next bug lands.
Runs inside these playbooks — curated sequences you can launch with one paste: