Prompt·Writes and ingestion·PG09

Find where write logic should live

Business rules are split across SQL, triggers, edge functions, server routes and workers.

Markdown
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

More in Writes and ingestion.