sqlc
$ sqlc Official Low Risksqlc parses SQL DDL schemas and annotated .sql queries to generate idiomatic, type-safe database access code (sqlc generate). Agents can verify SQL correctness offline with sqlc compile, check lint rules with sqlc vet, and assert zero generated-file drift via sqlc diff.
brew install sqlc sqlc compile, sqlc vet, and sqlc generate are local build-pipeline compiler commands with no meaningful MCP equivalent.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Deterministic headless compile, vet, diff, and generate subcommands with crisp compiler error diagnostics, though lacks a --json output flag.
- Offline
sqlc compile --no-databaseandsqlc diffexit codes - Human-readable compiler errors without
--json
Pure static compiler by default (--no-database); sqlc generate only writes configured local source files.
- Zero database writes;
--no-databaseguarantees offline execution
Single Go binary installable via Homebrew, go install, Docker, and official downloads across macOS, Linux, and Windows.
- Static Go binary via
brew install sqlc
Eliminates ORM boilerplate and catches SQL typos/type mismatches at compile time before running tests.
- Generates type-safe bindings for Go, Python, TypeScript, and Kotlin
Actively maintained by sqlc-dev/sqlc under MIT license with broad production usage.
- Official
sqlc-dev/sqlcrepository under MIT
Clear CLI reference, sqlc.yaml config docs, and sqlc vet CEL rule examples at docs.sqlc.dev.
- Structured reference documentation at docs.sqlc.dev
Security, Auth & Guardrails
Offline compiler needs no credentials; optional SQLC_AUTH_TOKEN and DB URIs in sqlc.yaml apply only to managed verification or sqlc vet EXPLAIN rules.
MIT open-source compiler; optional sqlc Cloud managed database features are commercial.
# sqlc Agent Rules - Run `sqlc generate && sqlc vet --no-database` after editing `.sql` query or schema files. - Use `--no-database` during static checks unless live `EXPLAIN` plan linting is explicitly configured.
Agent-Ready Command Recipes
Safe Read-Only Queries
sqlc compile --no-database
Statically validates SQL syntax, column names, and parameter types against schemas offline.
sqlc diff && sqlc vet --no-database
Verifies generated code matches disk and evaluates CEL query lint rules without touching a database.
Controlled Writes & Previews
sqlc generate
Writes generated Go/Python/TypeScript/Kotlin source files configured in sqlc.yaml.
Strengths for Agents
- +
sqlc compileandsqlc vetcatch SQL schema/query errors statically in milliseconds. - +
sqlc diffprevents stale generated code in PRs and agent edits. - + Zero runtime dependencies and deterministic local code generation.
Caveats & Pitfalls
- ! No
--jsonoutput flag for structured error diagnostics. - ! Dynamic SQL builders require workarounds since
sqlctargets static annotated.sqlqueries.