PostgreSQL patterns for Node.js with pg — connection pooling, parameterized
99
99%
Does it follow best practices?
Impact
100%
1.75xAverage score across 5 eval scenarios
Passed
No known issues
{
"context": "Tests whether the agent proactively applies a broad range of PostgreSQL best practices -- pool configuration, parameterized queries, ANY for array filtering, unnest for bulk inserts, error code handling, proper migration patterns -- when building a content platform. The task describes only business requirements.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Pool with production settings",
"description": "db.ts creates a pg Pool with max connections, at least one timeout setting, and keepAlive: true",
"max_score": 7
},
{
"name": "Parameterized queries throughout",
"description": "ALL query functions use $1, $2 placeholders -- no string interpolation or concatenation of variables into SQL",
"max_score": 10
},
{
"name": "Bulk import uses unnest or multi-row VALUES",
"description": "The bulk article import inserts all articles in a single query (or minimal queries) using unnest or multi-row VALUES -- NOT a loop of individual INSERTs",
"max_score": 14
},
{
"name": "ANY or overlap for tag search",
"description": "Searching by tags uses && (overlap) with $1::text[] or ANY -- NOT a dynamically constructed IN clause",
"max_score": 10
},
{
"name": "ANY for multi-status filter",
"description": "Filtering by multiple statuses uses ANY($1::text[]) with a single array parameter -- NOT dynamically building IN placeholders",
"max_score": 10
},
{
"name": "Foreign key violation handling",
"description": "Creating an article catches PostgreSQL error code 23503 (foreign_key_violation) when author_id doesn't exist and returns a meaningful error",
"max_score": 10
},
{
"name": "RETURNING clause on INSERT/UPDATE",
"description": "INSERT and UPDATE queries include RETURNING * or RETURNING with columns",
"max_score": 5
},
{
"name": "pool.query for single queries",
"description": "Non-transactional query functions use pool.query() directly",
"max_score": 5
},
{
"name": "Pool error handler and shutdown",
"description": "pool.on('error', ...) is registered AND pool.end() is called on SIGTERM/SIGINT",
"max_score": 5
},
{
"name": "TIMESTAMPTZ in migration",
"description": "Migration uses TIMESTAMPTZ (not TIMESTAMP) for all time columns",
"max_score": 5
},
{
"name": "CHECK constraint on status",
"description": "Migration includes a CHECK constraint on the articles.status column",
"max_score": 5
},
{
"name": "Index on foreign key",
"description": "Migration creates an index on articles.author_id",
"max_score": 5
},
{
"name": "Unique constraint on author email",
"description": "Migration includes a UNIQUE constraint on authors.email",
"max_score": 5
},
{
"name": "No individual Client instances",
"description": "Code never uses new Client() -- only the Pool is used for all database access",
"max_score": 4
}
]
}evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
skills
postgresql-node-best-practices
verifiers