Download for macOS
Skill

golang-database

@samber 38k installs Trending #424 on Skills.Sh Updated 2026-08-01

Comprehensive guide for Go database access — parameterized queries, struct scanning, NULLable columns, transactions, isolation levels, SELECT FOR UPDATE, connection pool, batch processing, context propagation, and migration tooling. Use when writing, reviewing, or debugging Golang code that interacts with PostgreSQL, MariaDB, MySQL, or SQLite; for database testing; or for questions about database/sql, sqlx, or pgx. Does NOT generate database schemas or migration SQL.

agentagent-skillsaiantigravityclaudeclaude-codecodecodex

Install

git clone https://github.com/samber/cc-skills-golang /tmp/cc-skills-golang && ln -s /tmp/cc-skills-golang/skills/golang-database ~/.claude/skills/golang-database

From README

Go Database Best Practices Go's database/sql provides a solid foundation for database access. Use sqlx or pgx on top of it for ergonomics — never an ORM. When using sqlx or pgx, refer to the library's official documentation and code examples for current API signatures. Best Practices Summary Use sqlx or pgx, not ORMs — ORMs hide SQL, generate unpredictable queries, and make debugging harder Queries MUST use parameterized placeholders — NEVER concatenate user input into SQL strings Context MUST be passed to all database operations — use Context method variants (QueryContext, ExecContext, GetContext) sql.ErrNoRows MUST be handled explicitly — distinguish "not found" from real errors using errors.Is Rows MUST be closed after iteration — defer rows.Close() immediately after QueryContext calls NEVER use db.Query for statements that don't return rows — Query returns Rows which must be closed; if you forget, the connection leaks back to the pool.