Prompt·Writes and ingestion·PG09
Find where write logic should live
Business rules are split across SQL, triggers, edge functions, server routes and workers.
Prompt
Trace how records are validated, transformed and written across application code, database functions, triggers and background jobs. Find rules duplicated in different layers or placed where they are difficult to test and maintain. Recommend the simplest ownership boundary for each rule, without assuming that moving more logic into Postgres is automatically better.
- What it returns
- Each rule with the layers that enforce it, the current owner, duplicated checks, how testable each place is, transaction limits and what a change would touch.
- Skip it when
- Each rule already lives in exactly one place.
- Avoid
- Automatically favouring stored procedures, or automatically moving everything out of the database.
- Changes
- Changes nothing
- Sessions
- Look first, then fix in a new session
- Tools
- Repository and read-only database access.
- Works on
- Any PostgreSQL host: Supabase, Neon, RDS, Cloud SQL or self-hosted.
Related prompts
- Meaning drift across the stackPromptShows where one word (a task, a fund, a run) means slightly different things in different parts of the app.
- Map every place that writes to the databasePromptSeveral jobs, functions, APIs or agents change the same data, or nobody is sure who owns it.
- Is our ingestion process more complicated than necessary?PromptThe import pipeline is long, slow to correct, or does the same work at several stages.
- Which database objects no longer earn their keep?PromptThe list of views, functions and triggers has grown hard to reason about.
More in Writes and ingestion.