Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Routes database work to migration, transaction, query contract, and external effect guidance for Drizzle and related schema changes.
14% 41%+27 ptsof test cases passed
Passed 9 of 22 test cases with the skill, and 3 of 22 without it.
Its SkillScore uses its best run instead: +32 pts on gemini-3.6-flash, Sep 9, 2026.
3 of 3 safety checks passed
97 agent runs
Drizzle's sql<T>, SQL<T>, generic .as<T>(), execute<Row>, and TypeScript
assertions only change compile-time types. They do not validate or decode
PostgreSQL driver values. Never use them to declare a database result contract.
For every raw expression selected by select, selectDistinct,
selectDistinctOn, returning, or relational-query extras, choose the first
applicable runtime boundary:
count() that already
owns the correct decoder..mapWith(column) when the expression has exactly the same PostgreSQL
runtime representation as that column..mapWith(decoder) for a dedicated runtime contract. Shared decoders
live in turbo/apps/api/src/lib/db-structured-result.ts.NULL, wrap the column or decoder with
nullableDriverValueDecoder(...). Drizzle preserves null and applies the
wrapped decoder only to non-null values.// Correct: LOWER(text) has the same driver representation as the text column.
const normalizedEmail = sql`LOWER(${users.email})`
.mapWith(users.email)
.as("normalized_email");
// Correct: the explicit decoder owns the runtime number contract.
const total = sql`COUNT(*)::int`.mapWith(pgIntegerDecoder).as("total");
// Correct: nullable SQL result with the column's non-null decoder.
const latestName = sql`MAX(${users.name})`
.mapWith(nullableDriverValueDecoder(users.name))
.as("latest_name");
Next to this one in the catalogue, plus more from the same author.