golang-database

Review Go database code for parameterized queries, struct scanning, transactions, and connection pooling.

Updated May 19, 2026
One-click install
npx skills add https://github.com/monforje/.opencode --skill golang-database-monforje
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-database
Source: https://github.com/monforje/.opencode/tree/main/skills/cc-skills-golang/skills/golang-database
Command: npx skills add https://github.com/monforje/.opencode --skill golang-database-monforje

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires go, sqlx, pgx, golang-migrate, Flyway, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance for Go database access, helping developers write safe, explicit, and observable database code without ORMs, for PostgreSQL, MariaDB, MySQL, or SQLite.

Core Features & Use Cases

  • Parameterized Queries: Prevent SQL injection and ensure secure code.
  • Struct Scanning: Efficiently map database rows to Go structs.
  • Context Propagation: Maintain deadlines and cancellation signals.
  • Transactions: Handle multi-statement operations safely.
  • Connection Pooling: Optimize database connection management.
  • Migrations: Manage schema changes with external tools.
  • Use Case: A Go backend engineer needs to implement database access for a new project. This Skill offers best practices and code examples to help implement efficient and secure database interactions.

Quick Start

Run the golang-database skill to review and optimize your Go database code.

Frequently Asked Questions about golang-database

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent SQL injection in Go database access?

Prevent SQL injection in Go database access by using parameterized queries. This Skill provides best practices to ensure your code remains safe and secure against injection attacks.

What is the best way to map database rows to Go structs?

Map database rows to Go structs efficiently using struct scanning techniques. This Skill demonstrates how to explicitly scan rows without relying on heavy ORMs for PostgreSQL, MariaDB, MySQL, or SQLite.

How do I handle transactions and connection pooling in Golang?

Handle transactions and connection pooling in Golang by applying explicit transaction management and optimized connection configurations. This Skill guides you through safe multi-statement operations and database connection management.

Do I need an ORM for Go database access with PostgreSQL or MySQL?

You do not need an ORM for Go database access with PostgreSQL or MySQL. This Skill helps you write safe, explicit, and observable database code using libraries like sqlx or pgx instead of ORMs.

How do I manage database schema migrations in a Go project?

Manage database schema migrations in a Go project using external tools like golang-migrate or Flyway. This Skill provides best practices for integrating migration tools alongside your database access code.

Why does my Go database query lose context cancellation signals?

Your Go database query loses context cancellation signals if context propagation is not maintained. This Skill shows how to pass context correctly to maintain deadlines and cancellation signals during database operations.