# Go database

> Go database is an open-source agent skill for databases. Guides Go services through database/sql pools, transactions, migrations and ORM choices. It is available on Claude Code.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code
- **Website:** https://github.com/eduardo-sl/go-agent-skills/tree/main/skills/(data)/go-database
- **Repository:** https://github.com/eduardo-sl/go-agent-skills
- **GitHub stars:** 90
- **License:** MIT
- **Skill name:** go-database
- **Collection:** https://github.com/eduardo-sl/go-agent-skills
- **Categories:** [databases](https://ai-powered.com/categories/databases), [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-02

## About

This skill gives an agent a set of Go-specific database conventions to apply when writing or reviewing data access code. It covers connection pool sizing and lifetimes, parameterized context-aware queries, a transaction helper that rolls back on error or panic, and locking and retry rules for serialization failures and deadlocks. It also points to repository pattern structure, sqlc for raw-SQL projects, and separately run versioned migrations.

The skill is organized as a short core guide with on-demand reference files for query and scan patterns, locking and retries, bulk writes and keyset pagination, and testing against a real database in a container. The agent is told to load a reference only when the summary is not enough. It also carries a checklist of twelve items to verify against finished code.

It expects a Go project with the Go toolchain available, and it is allowed to run go and gofmt commands. sqlc, golang-migrate and Docker are optional and only referenced where relevant.

## When your agent uses it

> Database patterns for Go services: database/sql, connection management, transactions, migrations, query builders, and ORM usage (sqlc, GORM, ent). Use when: "database access", "SQL query", "connection pool", "transactions", "database migration", "sqlc", "GORM", "ent", "prepared statement", "repository pattern". Not for: in-memory structures (go-data-structures), SQL security (go-security-audit), query profiling (go-performance-review).

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/eduardo-sl/go-agent-skills/tree/HEAD/skills/(data)/go-database)
- [Asks for: Read, Edit, Write, Glob, Grep, Bash(go:*), Bash(gofmt:*)](https://github.com/eduardo-sl/go-agent-skills/blob/HEAD/skills/(data)/go-database/SKILL.md)
- [License: MIT](https://github.com/eduardo-sl/go-agent-skills/tree/HEAD/skills/(data)/go-database)

## Features

- **Connection pool setup:** Explicit limits and lifetimes for database/sql pools, with guidance on sizing them.
- **Safe transaction helper:** A wrapper pattern that rolls back on errors and panics and handles isolation levels.
- **Query hygiene rules:** Parameterized, context-aware queries with proper row closing and no-rows handling.
- **Locking and retry guidance:** Row locking, optimistic versioning and retry rules for serialization and deadlock errors.
- **Migration and repository structure:** Advice on versioned, separately run migrations and consumer-side repository interfaces.
- **Performance and testing patterns:** Batched bulk writes, keyset pagination, pool statistics and real-database test isolation.

## Good for

- Set up a connection pool for a new Go service
- Write a transaction helper that rolls back safely
- Add a database migration for a schema change
- Review Go data access code for N+1 queries and leaked connections
- Implement a repository layer backed by sqlc or GORM
- Add keyset pagination to a large table query

## Install

### Any agent

Download the skill folder from https://github.com/eduardo-sl/go-agent-skills and copy it into your agent's skills folder.

## FAQ

### What tools does the skill need?

It requires the Go toolchain. sqlc, golang-migrate and Docker are optional.

### Which ORMs and tools does Go database cover?

It mentions sqlc, GORM, ent, goose, golang-migrate and atlas, and recommends sqlc for raw-SQL projects.

### Does Go database run any scripts?

No, the skill contains no scripts. It instructs the agent using Go and gofmt commands.

### Does Go database override project rules?

No. A project skill or agent-config rule that explicitly supersedes it takes precedence.

### Does Go database run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Go database?

Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.

### What are the best alternatives to Go database?

The closest alternatives to Go database are Go backend, Database migrations, Go GraphQL, Database migrations and Go GRPC.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Go backend](https://ai-powered.com/skills/go-backend): Go backend is an open-source agent skill for developer tools.
- [Database migrations](https://ai-powered.com/skills/database-migrations-nabwinsaud): Database migrations is an open-source agent skill for databases.
- [Go GraphQL](https://ai-powered.com/skills/go-graphql): Go GraphQL is an open-source agent skill for developer tools.
- [Database migrations](https://ai-powered.com/skills/database-migrations): Database migrations is an open-source agent skill for databases.
- [Go GRPC](https://ai-powered.com/skills/go-grpc): Go GRPC is an open-source agent skill for developer tools.
- [Go coding standards](https://ai-powered.com/skills/go-coding-standards): Go coding standards is an open-source agent skill for developer tools.
- [Go test quality](https://ai-powered.com/skills/go-test-quality): Go test quality is an open-source agent skill for developer tools.
- [Go API design](https://ai-powered.com/skills/go-api-design): Go API design is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/go-database
