Use this skill to add or maintain a generated TypeScript DAL using sqlc,
PostgreSQL, postgres.js, and the tylergannon/sqlc-gen-typescript WASM
plugin.
Reference Index
Load the relevant reference before editing that surface:
references/configuration.md: sqlc project layout,sqlc.yamlplugin setup, release WASM URL, local WASM builds, generation commands, and proof steps.references/postgresql-dialect.md: PostgreSQL query and schema rules that affect generated TypeScript, including named params, nullability, JSON, enums, bigint, and unsupported types.references/type-overrides.md:options.overrides,ts_type,raw_type,convert, nullabledb_typebehavior, column matching, and converter imports.
Workflow
- Inspect the target repo for an existing
sqlc.yaml, schema files, query files, generated DB folder, package manager, and postgres.js client setup. - Read
references/configuration.mdbefore creating or changing sqlc config. - Read
references/postgresql-dialect.mdbefore changing SQL queries or schema to satisfy generation. - Read
references/type-overrides.mdbefore adding or changing anyoptions.overridesentry. - Configure sqlc with the release WASM plugin unless the user explicitly asks for a local development build.
- Generate the DAL with
sqlc generate; if the repo has a wrapper such asjust generate,npm run generate, orpnpm sqlc, prefer the local command. - Wire application code to pass a configured
postgresSqlclient into generated functions. Do not make generated functions own connection setup. - Prove the generated DAL by running sqlc generation plus the target repo's TypeScript checks/tests that compile the generated output.
Invariants
- Target PostgreSQL only. Do not configure MySQL, SQLite, or Bun SQL for this generator.
- Use the
postgresnpm package runtime. Generated functions accept apostgresSqlinstance as their first argument. - Keep generated files generated. Fix source schema/query/config/override inputs instead of hand-editing generated TypeScript.
- Preserve
transform: postgres.camelwhen SQL column names are snake_case and generated TypeScript fields are camelCase. - Current bigint policy is
number; configure postgres.js OID20parsing when selectingint8,bigint,bigserial, orserial8, and avoid this policy for values that may exceedNumber.MAX_SAFE_INTEGER.