Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/golid-ai/golid/sql-migrationsgit clone --depth 1 https://github.com/golid-ai/golidWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.01000 |
| Opus 5 | $0.00000 | $0.00500 |
| Sonnet 5 | $0.00000 | $0.00200 |
| Haiku 4.5 | $0.00000 | $0.00100 |
Grade A, and why
sql-migrations scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 116 lines — stays where its author put it; the contents beside it link to each section on GitHub.
SQL Migration Patterns
Thesis: Migrations are the source of truth for the data model. Every table gets UUIDs, TIMESTAMPTZ, FK indexes, and an updated_at trigger.
Reference files: 000001_init.up.sql
File Naming
000NNN_description.up.sql and 000NNN_description.down.sql — always create both.
Once Committed, Never Edited
Migrations are append-only history. Once a migration file is committed, even on a feature branch, do not modify it. Any schema change goes in a new migration with the next sequence number.
- Need to add a column? New
ALTER TABLE ... ADD COLUMN. - Need to drop a column you just added? New
ALTER TABLE ... DROP COLUMN. - Forgot an index? New
CREATE INDEX.
Editing an already-committed .up.sql silently desyncs schemas: any environment
that ran the old version will never pick up the change, while fresh databases
will. Before editing any 00NN_*.sql file, ask: "is this committed?" If yes,
create a new migration.
Up Migration
-- Enums first
CREATE TYPE item_status AS ENUM ('new', 'in_progress', 'complete', 'cancelled');
-- Tables (with UUID PKs, timestamps, FKs with ON DELETE CASCADE)
CREATE TABLE items (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
title TEXT NOT NULL,
status item_status DEFAULT 'new',
created_at TIMESTAMPTZ DEFAULT NOW(),
updated_at TIMESTAMPTZ DEFAULT NOW()
);
-- Indexes on FKs and frequently filtered columns
CREATE INDEX idx_items_user_id ON items(user_id);
CREATE INDEX idx_items_status ON items(status);
-- Reuse the existing updated_at trigger function
CREATE TRIGGER items_updated_at BEFORE
UPDATE ON items FOR EACH ROW EXECUTE FUNCTION update_updated_at();
Down Migration
Drop in reverse dependency order: columns (ALTER), then tables, then enums.
DROP TABLE IF EXISTS item_history;
DROP TABLE IF EXISTS items;
DROP TYPE IF EXISTS item_status;
Conventions
- UUIDs for all primary keys (not serial/bigint).
- TIMESTAMPTZ for all timestamps (not TIMESTAMP).
- TEXT for strings (not VARCHAR) — PostgreSQL treats them identically.
- DECIMAL(x,2) for money/hours (not FLOAT).
- JSONB for structured metadata (audit trails, preferences).
- TEXT[] for tag-like arrays (skills, industries).
- Enums for finite status sets — add a
cancelledstate if the entity can be deactivated. - ON DELETE CASCADE on child table FKs.
- Index every FK and every column used in WHERE filters.
updated_attrigger on every table that has the column.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago First seen · 116 lines · 0 tokens per session scan A 7496b38d03c5
sql-migrations is a cursor rule published in the GitHub repository golid-ai/golid (40 stars, last pushed 2mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,000 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other cursor rules, from other repositories
adapter-features
Database-specific features must be implemented in the specialized adapter only. Base adapters (postgres, mysql, etc.) must remain database-agnostic.
adapter-unit-tests
Postgres adapter unit tests are sqlmock-only; no real DB or sqlx.Connect.
sql-database-support
Classify engines, require DIFFERENCES.md, and map what/where for new SQL DB support.
integration-layout
Per-DB compose/workflow layout; Timescale runs only its package; no folding into Postgres.
server-actions
Server Action, service and tenancy contract.
prisma-schema
Prisma schema and migration conventions.