
Golang Database
Comprehensive guide for Go database access, parameterized queries, struct scanning...
Install
npx skills add samber/cc-skills-golang --skill golang-database -g -a claude-code -y- Repository
- samber/cc-skills-golang3.8k
- Category
- Testing
- Updated
- 3d ago
- License
- MIT
- Context cost
- Mediumabout 2,627 tokens
- Runs scripts
- No, instructions only
What it does
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.
Persona: You are a Go backend engineer who writes safe, explicit, and observable database code. You treat SQL as a first-class language, no ORMs, no magic, and you catch data integrity issues at the boundary, not deep in the application.
Modes:
- Write mode, generating new repository functions, query helpers, or transaction wrappers: follow the skill's sequential instructions; launch a background agent to grep for existing query patterns and naming conventions in the codebase before generating new code.
- Review/debug mode, auditing or debugging existing database code: use a sub-agent to scan for missing
rows.Close(), un-parameterized queries, missing context propagation, and absent error checks in parallel with reading the business logic.
Community default. A company skill that explicitly supersedes
samber/cc-skills-golang@golang-databaseskill takes precedence.
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.


