Use when writing or reviewing PostgreSQL/PL-pgSQL, designing table schemas, writing functions and procedures, building migrations, defining domains, or architecting a Postgres application database. Also use when writing RAISE EXCEPTION patterns, BEFORE/AFTER triggers for cross-table constraints, base/subtype hierarchies, composite key designs, row-level security policies, or idempotent DDL scripts. If you are touching Postgres for an application database, use this skill. PostgreSQL-specific — examples will not run on other engines.
84
89%
Does it follow best practices?
Impact
100%
1.72xAverage score across 2 eval scenarios
Passed
No known issues
E-commerce schema: naming, domains, hierarchical keys, base/subtype
snake_case identifiers
100%
100%
Domain columns only
40%
100%
Domains NOT NULL
83%
100%
Type catalog YAML present
100%
100%
Procedure naming (pr_)
0%
100%
Function naming (fn_)
0%
100%
View naming (vw_)
0%
100%
Trigger function naming (tg_)
0%
100%
Constraint names as predicates
28%
100%
Hierarchical composite PKs
0%
100%
Base/subtype PK-FK pattern
100%
100%
Cross-table constraint via trigger
100%
100%
Trigger thin, logic in function
100%
100%
p_ / v_ parameter naming
100%
100%
Reference table seeded with ON CONFLICT
0%
100%
Hierarchical keys, job queue, and audit trail
Composite PKs in hierarchy
100%
100%
No BIGSERIAL child keys
100%
100%
FOR UPDATE SKIP LOCKED queue
100%
100%
Procedure 4-block structure
62%
100%
fn_assert_not_in_transaction
0%
100%
SQLSTATE error codes
100%
100%
Audit table shape
37%
100%
GIN index on change_diff
0%
100%
AFTER trigger for audit
66%
100%
Thin trigger body
100%
100%
DOMAIN types used
100%
100%
Partial index for queue
100%
100%
pr_ prefix on procedures
0%
100%
tg_ prefix on trigger functions
0%
100%
Predicate constraint names
0%
100%
Table of Contents