What problem does it solve?
It prevents common, production-grade database mistakes in Go by guiding developers to write safe, parameterized, context-aware SQL code with correct error handling and resource management.
Core Features & Use Cases
- Parameterized queries over string-built SQL: protects against SQL injection when implementing filters, sorting, and dynamic conditions.
- Correct scanning and NULL handling: models NULLable columns with pointer fields or explicit strategies, ensuring structs and JSON behave predictably.
- Robust lifecycle management: enforces proper context propagation, explicit
sql.ErrNoRows handling, correct rows.Close(), rows.Err() checks, and safe transaction patterns with SELECT ... FOR UPDATE.
- Operational performance guardrails: recommends batching, cursor pagination, and connection-pool configuration while explicitly avoiding hidden SQL features and ORM pitfalls.
- Migrations with tooling, not AI-generated SQL: directs teams to use migration tools (e.g., golang-migrate) and to review schema changes with production awareness.
Quick Start
Use the golang-database skill to review or generate Go repository code that uses sqlx/pgx for PostgreSQL with fully parameterized queries, context propagation, correct NULL handling, and safe transaction boundaries.