One-click install
npx skills add https://github.com/reliant-labs/forge --skill db-reliant-labs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: db
Source: https://github.com/reliant-labs/forge/tree/main/internal/templates/project/skills/forge/db
Command: npx skills add https://github.com/reliant-labs/forge --skill db-reliant-labs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The db Skill prevents accidental coupling between your generated code and your database schema by making migrations the single source of truth.

Core Features & Use Cases

  • Enforces a migrations-first contract: database structure is defined and evolved only through SQL migrations in db/migrations/, while forge generate never edits the DB layer.
  • Clarifies proto vs schema authority: supports greenfield mode (proto authoritative) and migrated mode (migrations authoritative) with forge audit to detect alignment and divergence.
  • Guides safe schema evolution: provides patterns for adding entities, adding DB-only fields, updating entity types, writing queries, and recovering from broken migrations without running down migrations in prod.

Quick Start

Use the db Skill to guide schema changes by creating a new migration with forge db migration new <name>, writing up and down SQL, applying it with forge db migrate up --dsn "$DATABASE_URL", then updating internal/db/types.go and internal/db/<entity>_orm.go to match your new schema.

Frequently Asked Questions about db

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

FAQPage Schema
How do I keep database schema changes in migrations instead of generated code?

To keep database schema in migrations, establish SQL migration files as the authoritative source for DB structure while ensuring code generation never directly modifies the database layer.

What is the best way to handle schema evolution when using an ORM and sqlc queries?

The best way to handle schema evolution is to apply append-only SQL migrations first, then manually update internal ORM types and sqlc queries to match the new schema without regenerating existing migration files.

How do I align proto definitions with my Postgres database schema during codegen?

Proto alignment depends on your project stage: greenfield mode treats proto as authoritative, while migrated mode treats SQL migrations as authoritative, using schema introspection audits to detect divergence between the two.

How do I safely add a new database entity without breaking existing migrations?

To safely add a database entity, create a new append-only migration with up and down SQL, apply it to your Postgres database, then update your internal DB entity types and ORM CRUD operations to match the new schema.

How do I recover from a broken database migration in production without running a down migration?

To recover from a broken migration in production, write down explicit recovery steps and use a safe roll-forward migration approach, applying a new corrective migration rather than rolling back the existing one.

When should I not use generated code to modify my database schema?

You should not use generated code to modify database schema when working within a migrations-first contract, as this creates accidental coupling and bypasses the authoritative SQL migration files needed for safe schema evolution.