pg-aiguide is a knowledge and tooling project that gives AI coding assistants version-aware PostgreSQL documentation and curated database practices. Developers use it through agent skills, an MCP server, or a Claude Code plugin to help coding tools generate better PostgreSQL code. The catalogue entries are its skills, instructions, MCP integration, and rule.
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 skills add timescale/pg-aiguide --skill postgres-database-migrationgit clone --depth 1 https://github.com/timescale/pg-aiguideWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/timescale/pg-aiguide/postgres-database-migration)<a href="https://agentmods.dev/skills/timescale/pg-aiguide/postgres-database-migration"><img src="https://agentmods.dev/badge/skills/timescale/pg-aiguide/postgres-database-migration/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/timescale/pg-aiguide/postgres-database-migration"><img src="https://agentmods.dev/badge/skills/timescale/pg-aiguide/postgres-database-migration.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector warn
SkillSpector: 1 finding, up to high
These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →
- high Memory Poisoning · line 381 Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.Fix: Protect agent memory and state from modification by untrusted content. Use read-only memory for critical instructions and validate all state changes.
What 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.1 | $0.00220 | $0.05620 |
| Opus 5.5 | $0.00088 | $0.02248 |
| Sonnet 5.5 | $0.00044 | $0.01124 |
| Haiku 4.5 | $0.00022 | $0.00562 |
Grade A, and why
postgres-database-migration 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 1mo 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 — 487 lines — stays where its author put it; the contents beside it link to each section on GitHub.
PostgreSQL Database Migrations
A schema migration that works on an empty dev database can fail, lock, or corrupt data on a production table with millions of rows. This guide covers how to assess risk, test against real data, and execute migrations safely.
DDL Lock Reference
Every schema change acquires a lock. The critical question is: does it block reads and writes, and for how long?
Fast, Non-Blocking Operations
These complete in milliseconds regardless of table size. They only hold a brief AccessExclusiveLock for the catalog update, not for data rewriting.
| Operation | Lock Level | Notes |
|---|---|---|
ADD COLUMN (nullable, no default) |
AccessExclusiveLock (brief) |
Fast. No table rewrite. Metadata-only change. |
ADD COLUMN ... DEFAULT x (PG 11+) |
AccessExclusiveLock (brief) |
Fast. Non-volatile defaults stored in catalog, not backfilled. |
DROP COLUMN |
AccessExclusiveLock (brief) |
Fast. Column marked invisible; space reclaimed by VACUUM over time. |
SET DEFAULT / DROP DEFAULT |
AccessExclusiveLock (brief) |
Metadata change only. Does not touch existing rows. |
CREATE INDEX CONCURRENTLY |
ShareUpdateExclusiveLock |
Non-blocking. Allows reads and writes during build. Slower than regular index creation. |
DROP INDEX CONCURRENTLY |
ShareUpdateExclusiveLock |
Non-blocking. Waits for queries using the index to finish, then drops. No table-level exclusive lock. |
RENAME COLUMN |
AccessExclusiveLock (brief) |
Metadata change only. Fast. |
RENAME TABLE |
AccessExclusiveLock (brief) |
Metadata change only. Fast. |
ADD CONSTRAINT ... NOT VALID |
ShareUpdateExclusiveLock |
Adds constraint for new rows only. Does not scan existing data. |
VALIDATE CONSTRAINT |
ShareUpdateExclusiveLock |
Scans existing rows but allows concurrent reads and writes. |
CREATE/DROP TRIGGER |
ShareRowExclusiveLock |
Brief catalog update. |
Slow or Blocking Operations
What ships with it
3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
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.
- 1mo ago Changed · -2 tokens per session b37d01fa733e
- 1mo ago First seen · 487 lines · 222 tokens per session scan A 19cb18c5a55d
postgres-database-migration is a skill published in the GitHub repository timescale/pg-aiguide (1,870 stars, last pushed 2d ago), licensed Apache-2.0. It adds 220 tokens to every session and 5,620 once invoked, about $0.0009 per session on Opus 5.5. 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 skills, from other repositories
database-optimizer
Optimizes database queries and improves performance across PostgreSQL and MySQL systems. Use when investigating slow queries, analyzing execution plans, or optimizing database performance. Invoke for index design, query rewrites, configuration tuning, partitioning strategies, lock contention resolution.
postgres-pro
Use when optimizing PostgreSQL queries, configuring replication, or implementing advanced database features. Invoke for EXPLAIN analysis, JSONB operations, extension usage, VACUUM tuning, performance monitoring.
kysely
Guidelines for developing with Kysely, a type-safe TypeScript SQL query builder with autocompletion support.
postgresql-best-practices
PostgreSQL development best practices for schema design, query optimization, and database administration.
pdlc-db-migrate
A database migration manager driven by database design documents. A migration is a versioned script that changes a database structure and can also undo that change.
pdlc-db-design
A database design workflow that turns an existing product requirements document and, when available, API design into a database plan. It describes entities, fields, links, indexes, constraints, and an entity-relationship diagram, which shows how data types connect.