Prompt
0 copies · 0 said it worked
Apply a backend engineer's PostgreSQL schema and indexing conventions
A rule-list prompt that sets PostgreSQL design defaults for keys, types, constraints, indexing, and pagination, producing guidance for schema work.
People use this for
- postgresql schema design tips
- postgres best practices for backend
- how to design postgres tables
- postgresql indexing and query tuning advice
- write postgres schema for an application
Imported on Nov 29, 2026 from PostgreSQL taste . License observed at the source on Nov 29, 2026: CC0.
Are you the author?Claim this profileRequest removal
Prompt
# PostgreSQL taste of a backend engineer
- Use bigint identity columns (GENERATED ALWAYS AS IDENTITY) for primary keys; reach for UUIDv7 only when ids must be generated outside the database. Confidence: 0.80
- Store timestamps as timestamptz in UTC, never timestamp without time zone. Confidence: 0.95
- Use text with a CHECK constraint instead of varchar(n) for length limits. Confidence: 0.80
- Store money as numeric or as integer minor units, never as float. Confidence: 0.95
- Name tables in plural snake_case and foreign keys as <singular>_id. Confidence: 0.70
- Declare NOT NULL by default and allow NULL only when "unknown" is a real state. Confidence: 0.85
- Enforce invariants in the database with foreign keys, UNIQUE, and CHECK constraints, not only in application code. Confidence: 0.90
- Index every foreign key column that is used in joins or cascading deletes. Confidence: 0.85
- Read EXPLAIN (ANALYZE, BUFFERS) before adding an index, and again after to prove it helped. Confidence: 0.90
- Prefer partial and expression indexes over wide composite indexes for skewed filters. Confidence: 0.70
- Create indexes on large tables with CREATE INDEX CONCURRENTLY. Confidence: 0.90
- Use jsonb for genuinely schemaless attributes, but promote fields you filter on into real columns. Confidence: 0.80
- Paginate with keyset (WHERE id > $last ORDER BY id LIMIT n) instead of large OFFSET values. Confidence: 0.85
- Keep transactions short and never hold one open across a network call. Confidence: 0.90
- Set statement_timeout and idle_in_transaction_session_timeout per application role. Confidence: 0.85
- Put a connection pooler such as PgBouncer in transaction mode in front of the database. Confidence: 0.80
- Use SELECT ... FOR UPDATE SKIP LOCKED for simple job queues before adding a separate broker. Confidence: 0.70
- Use INSERT ... ON CONFLICT for idempotent upserts. Confidence: 0.85
- Give each service its own role with least privilege; the application never connects as a superuser. Confidence: 0.90
- Turn on pg_stat_statements and review the slowest queries every week. Confidence: 0.85
- Write CTEs for readability, knowing Postgres 12+ inlines them unless you add MATERIALIZED. Confidence: 0.65
- Test point-in-time recovery from backups regularly; an untested backup does not count. Confidence: 0.95No result recorded for this import yet. Tried it? File a report so the next person knows how it went.
Tried it
Structured reports from people who ran this prompt. They roll up into the per-model badges above.
No one has filed a report yet. Try the prompt and be the first.
Related prompts
- SQL Index Recommendation Reviewer for slow queries and schemas
Reviews a schema and slow SQL queries, proposes composite indexes in the right column order, flags non-sargable filters, and warns about duplicate, redundant, and low-selectivity indexes, with a stdlib Python helper.
Data & Finance · @f
- Agent role that turns TypeScript typing work into a tracked TODO plan
A senior TypeScript type-expert role prompt covering type design, generics, narrowing, and migration, with a required output of TODO_ts-type-expert.md containing checkable task items.
Coding · @wkaandemir
- Claude api: reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming,…
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER — read BEFORE opening the target file; don't skip because it "looks like a one-liner" — whenever: the prompt names Claude/Anthropic in any fo
Coding · @anthropic
- Review SQL queries and EXPLAIN plans for performance and correctness problems
Skill-style prompt that makes the model act as a database engineer reviewing SQL and optional EXPLAIN output, flagging anti-patterns like SELECT *, function-wrapped columns, leading-wildcard LIKE, N+1 loops and AND/OR precedence, then returning rewritten queries with reasons and a measurement plan.
Coding · @f
- Write work reports from git and coding-agent sessions
Agent skill that gathers a user's work for a period and folder scope from git, coding-agent sessions and other sources, then drafts, previews and saves a standup, weekly, monthly or changelog report.
Coding · @subashdhamee
License: CC0v1 · published Nov 29, 2026
Comments
No comments yet. If you tried this prompt, say how it went.