← ClaudeAtlas

sqlclisted

Enforce sqlc codegen conventions for Go + PostgreSQL. Use when editing sqlc.yaml, **/queries/*.sql, or generated *.sql.go, or when the user mentions sqlc, codegen, Querier interface, db.Queries, sqlc generate, or sqlc vet. Forbids hand-written database/sql calls when sqlc is configured, v1 config, and manual edits to generated files.
zhaojiannet/canon · ★ 1 · API & Backend · score 77
Install: claude install-skill zhaojiannet/canon
This skill enforces sqlc 1.31+ conventions for Go projects with PostgreSQL. The rule: SQL is the source of truth, Go calls go through the generated `Querier` interface only. Apply only when sqlc is configured (`sqlc.yaml` exists). If the project uses `sqlx` / raw `database/sql` everywhere, **STOP** and ask the user before introducing sqlc. ## sqlc.yaml requirements ```yaml version: "2" sql: - engine: postgresql queries: db/queries schema: db/migrations gen: go: package: db out: db/sqlc emit_interface: true emit_json_tags: true emit_db_tags: false emit_pointers_for_null_types: true emit_empty_slices: true sql_package: pgx/v5 ``` - **`version: "2"`** required. v1 is deprecated. - **`emit_interface: true`** generates the `Querier` interface so handlers can mock easily. - **`sql_package: pgx/v5`** preferred over `database/sql` for PostgreSQL. - **`schema:` points to migrations**, not to a hand-written schema file. sqlc parses migrations to derive the schema. ## Query naming convention | Prefix | Returns | Example | |---|---|---| | `Get` | exactly one row, error if missing | `GetUserByID` | | `Find` | one row or `nil`, no error if missing | `FindUserByEmail` | | `List` | many rows | `ListUsersByOrg` | | `Count` | scalar count | `CountActiveUsers` | | `Create` | inserts and returns the created row | `CreateUser` | | `Update` | updates and returns the updated row | `UpdateUserEmail` | | `Delete