database

Design database schemas, manage migrations, and optimize SQL queries.

111|73|Updated Mar 20, 2026
One-click install
npx skills add https://github.com/autopus-ai/autopus-adk --skill database-autopus-ai
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: database
Source: https://github.com/autopus-ai/autopus-adk/tree/main/.omp/skills/database
Command: npx skills add https://github.com/autopus-ai/autopus-adk --skill database-autopus-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Designing normalized database schemas, writing safe zero-downtime migrations, and fixing slow queries are error-prone tasks that can cause data loss or production outages when done incorrectly. ## Core Features & Use Cases - Schema Design Guidance: Applies normalization rules (1NF-3NF), naming conventions, and common column patterns including soft delete and audit timestamps. - Safe Migration Management: Enforces numbered up/down migration file pairs, sequential numbering per directory, and lock-minimizing patterns like CREATE INDEX CONCURRENTLY for large tables. - Query Optimization: Covers EXPLAIN ANALYZE interpretation, index strategies (composite, partial, covering), and N+1 query prevention in Go code. - Use Case: When adding a new feature that requires a users table with an email index, use this Skill to generate the correctly numbered migration pair with concurrent index creation and a matching rollback script. ## Quick Start Use the database skill to design a normalized schema and write a safe up/down migration for adding an orders table with proper indexes.

Frequently Asked Questions about database

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

FAQPage Schema
How do I write a safe database migration for a large table?▼

Use CREATE INDEX CONCURRENTLY to avoid table locks when adding indexes, and add columns as nullable first before setting NOT NULL constraints in separate steps. Split incompatible changes like column renames into multi-deploy sequences: add new column, copy data, then drop the old one.

How should database migration files be numbered and named?▼

Use six-digit zero-padded sequential numbers computed as max existing number plus one within the target migrations directory only. Name files as {number}_{description}.up.sql and {number}_{description}.down.sql with matching stems, and never renumber already committed migrations.

What Go libraries are recommended for database access?▼

The standard database/sql package provides the base interface, sqlx adds struct mapping extensions, and pgx is the native PostgreSQL driver. For migration management, goose or migrate are the recommended tools.

How do I fix N+1 query problems in Go?▼

Replace per-row queries inside loops with batch queries using IN clauses or JOINs. For example, instead of calling FindOrdersByUserID for each user, collect all user IDs and call FindOrdersByUserIDs once.

Why does my query use a sequential scan instead of an index?▼

Run EXPLAIN ANALYZE to compare estimated versus actual row counts and check the scan type. A Seq Scan suggests a missing index, while large row estimate gaps indicate stale table statistics that need refreshing.