How to keep template code PostgreSQL-specific and hosting-agnostic. Use when defining schemas, writing raw SQL, or creating server routes.
61
73%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./.agents/skills/portability/SKILL.mdTemplates use one PostgreSQL schema and query contract. Local PGlite and hosted PostgreSQL share the same SQL semantics.
Use Drizzle's PostgreSQL exports directly for schemas and its query builder for reads/writes:
import { sql } from "drizzle-orm";
import {
boolean,
doublePrecision,
integer,
pgTable,
text,
} from "drizzle-orm/pg-core";
export const meals = pgTable("meals", {
id: text("id").primaryKey(),
name: text("name").notNull(),
calories: integer("calories").notNull(),
weight: doublePrecision("weight"),
archived: boolean("archived").notNull().default(false),
createdAt: text("created_at").notNull().default(sql`now()`),
});| Export | Purpose |
|---|---|
pgTable | Defines a PostgreSQL table |
text | Defines a text column, with optional enum values |
integer | Defines an integer column |
boolean | Defines a boolean column |
doublePrecision | Defines a double-precision column |
sql | Builds SQL expressions such as now() |
Use @agent-native/core/db/schema only for framework-owned sharing helpers such
as ownableColumns() and createSharesTable().
Use Drizzle's PostgreSQL query builder for app code:
import { and, desc, eq } from "drizzle-orm";
const rows = await db
.select()
.from(meals)
.where(and(eq(meals.ownerEmail, userEmail), eq(meals.archived, false)))
.orderBy(desc(meals.createdAt));Avoid db.execute(...), getDbExec(), and handwritten SQL in actions, handlers, and stores when Drizzle can express the query. Raw SQL should be limited to additive migrations, health checks, carefully reviewed advanced queries, or one-off maintenance scripts. For timestamps in Drizzle schemas, use .default(now()); for migration SQL, use runMigrations().
getDbExec() — executes parameterized PostgreSQL SQLBIGINT directly in raw SQL.When writing docs, say "PostgreSQL" or "PGlite" precisely.
Use Postgres syntax deliberately in advanced queries and migrations, and prefer Drizzle APIs or framework helpers for ordinary application code.
When giving deployment guidance, be precise about durability: local PGlite is for development, while shared and production environments need a persistent hosted PostgreSQL DATABASE_URL.
The server runs on Nitro with H3 as the HTTP framework. Templates must be deployable to any Nitro-supported target.
All server code uses H3/Nitro: defineEventHandler, readBody, getMethod, setResponseHeader, etc. Express is not a dependency. If you see Express types or patterns anywhere, replace them with H3 equivalents.
Files like netlify.toml, wrangler.toml, vercel.json, and netlify/functions/ must NOT appear in the CLI scaffold source (packages/core/src/templates/) — apps generated for users stay hosting-agnostic, with platform configuration living in CI/hosting dashboards.
This monorepo's own first-party deployed apps keep platform configuration in app-specific hosting manifests such as templates/*/netlify.toml; this rule only applies to the CLI scaffold source.
Never use fs, child_process, or path in server routes and plugins. Use Nitro abstractions. (Actions in actions/ run in Node.js and can use Node APIs freely.)
Never assume a persistent server process. Use the SQL database for all state.
storing-data — Schema patterns and the core SQL storesserver-plugins — Framework routes and H3 handler patternssecurity — SQL injection prevention via parameterized queriescc2a915
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.