encore-go-database

Enable type-safe Go database access and migrations in Encore services.

26|5|Updated Jan 8, 2026
One-click install
npx skills add https://github.com/encoredev/skills --skill encore-go-database
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: encore-go-database
Source: https://github.com/encoredev/skills/tree/main/encore/go-database
Command: npx skills add https://github.com/encoredev/skills --skill encore-go-database

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Encore Go projects often struggle with unsafe, ad-hoc database access and unmanaged migrations. This Skill provides type-safe query patterns, structured migrations, and robust error handling to reduce runtime errors and drift between code and database.

Core Features & Use Cases

  • Type-safe queries with generics using sqldb.Query, sqldb.QueryRow, and sqldb.Exec.
  • Migrations structure with automatic application on startup and clear versioning.
  • Safe struct mapping and SQL injection protection for common Go data access patterns.

Use cases include building data access layers for users, accounts, and transactions, executing multi-step operations within transactions, and maintaining consistent schema evolution across services.

Quick Start

Set up a Go service, configure the Encore database with your migrations, and implement a sample user query using sqldb.Query.

Frequently Asked Questions about encore-go-database

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

FAQPage Schema
How do I write type-safe database queries in Go using Encore?

Type-safe database queries in Go are written using sqldb.Query, sqldb.QueryRow, and sqldb.Exec with generics, ensuring safe struct mapping and SQL injection protection for your Encore services.

How do database migrations work in an Encore Go service?

Database migrations in Encore require a configured migrations directory. Schema migrations are automatically applied on application startup, providing clear versioning and consistent schema evolution across services.

What is the best way to manage transactional records and user accounts in Encore?

Managing transactional records and user accounts in Encore involves building data access layers with sqldb.Query and sqldb.Exec, enabling multi-step operations within transactions for robust record handling.

Do I need to manually apply schema migrations for Encore SQL databases?

No, you do not need to manually apply schema migrations. Encore automatically applies migrations from your configured migrations directory on startup, preventing drift between code and database.

Can I use Encore for multi-step transactional database operations in Go?

Yes, Encore supports multi-step transactional database operations in Go. By using sqldb methods, you can execute structured queries that maintain safe data access and robust error handling.