From go-backend-skills
PostgreSQL schema design and goose migration conventions. Use when writing or reviewing SQL migrations, indexes, constraints, schema changes, or database design in Go projects using goose.
How this skill is triggered — by the user, by Claude, or both
Slash command
/go-backend-skills:postgresqlThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
| Component | Technology |
| Component | Technology |
|---|---|
| Database | PostgreSQL 16+ |
| Migrations | goose/v3 (SQL) |
| Query builder | Squirrel (sq) |
| Rule | Do | Don't |
|---|---|---|
| Naming | {number}_{description}.sql (zero-padded) | Timestamps, gaps |
| Format | -- +goose Up / -- +goose Down | Missing Down section |
| Down idempotent | DROP TABLE IF EXISTS | DROP TABLE without IF EXISTS |
| Applied migrations | Never edit or delete — always create a new migration | Modify in place |
| New columns | DEFAULT value or NULL | NOT NULL without default on existing tables |
| Rule | Do | Don't |
|---|---|---|
| Keywords/types | UPPERCASE | create table, text |
| Column names | lowercase_snake_case | camelCase |
| Alignment | Align types vertically, 4-space indent | Ragged, tabs |
| Rule | Do | Don't |
|---|---|---|
| Timestamps | TIMESTAMP(0) WITHOUT TIME ZONE, DEFAULT CURRENT_TIMESTAMP | TIMESTAMPTZ unless you need time zones |
| Foreign keys | Inline REFERENCES public.table(id) | Separate constraint when inlinable |
| Strings | TEXT | VARCHAR(N) |
| Booleans | BOOLEAN NOT NULL DEFAULT false | Nullable booleans |
| JSON | JSONB DEFAULT NULL | Multiple columns for nested config |
| Soft delete | deleted_at TIMESTAMP(0) ... DEFAULT NULL | is_deleted flag |
| Indexes | CREATE INDEX {table}_{columns}_idx | Anonymous indexes |
| Rule | Do | Don't |
|---|---|---|
| Filter cols | Index WHERE columns | Index every column |
| Sort cols | Index ORDER BY columns | Missing sort indexes on paginated queries |
| Unique | CREATE UNIQUE INDEX for natural keys | App-level uniqueness only |
| FK cols | Index FK columns | Missing FK indexes |
When a migration transforms existing data (not just adding columns), verify the full round-trip through the API — not just the SQL transformation:
goose upThe test suite seeds fresh data per test and never touches pre-existing rows, so passing tests alone do not prove migrated data works.
Never: use CREATE TYPE enums (use integer codes), raw SQL in handlers, edit applied migrations.
Searches MemPalace before answering questions about past work, people, projects, or prior decisions. Returns verbatim stored content instead of guessing from model memory.
Guides Payload CMS config (payload.config.ts), collections, fields, hooks, access control, APIs. Debugs validation errors, security, relationships, queries, transactions, hook behavior.
Implements vector databases with Pinecone, Weaviate, Qdrant, Milvus, pgvector for semantic search, RAG, recommendations, and similarity systems. Optimizes embeddings, indexing, and hybrid search.
npx claudepluginhub klaidliadon/skills