postgresql-expert-best-practices-code-review — скилл для Claude Code
Набор правил по схемам, миграциям и индексам PostgreSQL. Агент подхватывает их, когда вы пишете или правите миграции.
npx skills add wispbit-ai/skills --skill postgresql-expert-best-practices-code-review -a claude-codeЧто делает postgresql-expert-best-practices-code-review
Скилл разбит на десять файлов-правил в папке rules/. Каждый файл — короткое объяснение, почему правило важно, уровень влияния, пример неудачной миграции и правильный вариант. Приоритеты расставлены по категориям: управление индексами идёт первым, дальше безопасность ограничений, проектирование схемы и стандарты именования.
Из правил видно, на чём чаще всего ломается продакшен. Индексы советует создавать через CONCURRENTLY, чтобы не блокировать запись. Внешние ключи добавлять без проверки, а валидировать отдельным шагом. NOT NULL ставить после проверочного ограничения. Для JSON брать JSONB, а не JSON. Уникальность оформлять как конкурентный индекс плюс ограничение.
Есть и договорённости по структуре: в каждой таблице id, created_at и updated_at, не более трёх колонок в неуникальном индексе, имена вида idx_tablename_columnname и snake_case для колонок. Скилл ничего не запускает сам — это справочник, который агент читает перед генерацией SQL. Без него модель спокойно выдаст CREATE INDEX без CONCURRENTLY на живой таблице, и это повод проверить миграцию до деплоя.
Какие задачи решает
- создать индекс на большой таблице и не заблокировать запись
- добавить внешний ключ без долгой блокировки
- перевести колонку в NOT NULL без простоя
- выбрать JSONB вместо JSON для индексируемых полей
- привести имена индексов и колонок к одному виду
Примеры запросов агенту
- Напиши миграцию: добавляю колонку
statusв таблицуorders, проверь по правилам скилла - Отревьюй эту миграцию и скажи, где я нарушил best practices PostgreSQL
- Спроектируй таблицу
paymentsс учётом правил скилла
Как установить postgresql-expert-best-practices-code-review
1Через Skills CLI (Vercel)
npx skills add wispbit-ai/skills --skill postgresql-expert-best-practices-code-review -a claude-code2Вручную: положить файлы
~/.claude/skills/postgresql-expert-best-practices-code-review/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/postgresql-expert-best-practices-code-review/
1Через Skills CLI (Vercel)
npx skills add wispbit-ai/skills --skill postgresql-expert-best-practices-code-review -a codex2Вручную: положить файлы
.agents/skills/postgresql-expert-best-practices-code-review/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add wispbit-ai/skills --skill postgresql-expert-best-practices-code-review -a cursor2Вручную: положить файлы
.cursor/skills/postgresql-expert-best-practices-code-review/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install wispbit-ai/skills postgresql-expert-best-practices-code-review2Вручную: положить файлы
.github/skills/postgresql-expert-best-practices-code-review/SKILL.md1Через Skills CLI (Vercel)
npx skills add wispbit-ai/skills --skill postgresql-expert-best-practices-code-review -a gemini-cli2Командой платформы
gemini skills install https://github.com/wispbit-ai/skills --path skills/postgresql-expert-best-practices-code-reviewВручную: положить файлы
.devin/skills/postgresql-expert-best-practices-code-review/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add wispbit-ai/skills --skill postgresql-expert-best-practices-code-review -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о postgresql-expert-best-practices-code-review
Как установить postgresql-expert-best-practices-code-review в Claude Code?
Выполните npx skills add wispbit-ai/skills --skill postgresql-expert-best-practices-code-review -a claude-code. Файл скилла окажется по пути ~/.claude/skills/postgresql-expert-best-practices-code-review/SKILL.md.
Что делает этот скилл?
Даёт агенту свод правил по проектированию схем PostgreSQL, миграциям и индексам. Агент обращается к ним, когда пишет или правит SQL.
На каких платформах он работает?
Claude, Codex, Cursor, GitHub Copilot, Gemini CLI и OpenCode. Для каждой платформы своя команда установки.
Исходный текст
SKILL.md · MIT
--- name: postgresql-expert-best-practices-code-review description: PostgreSQL database design, migration, and performance optimization best practices. This skill should be used when writing, reviewing, or refactoring database schemas, migrations, or query patterns. Triggers on tasks involving PostgreSQL databases, schema design, migration optimization, or data modeling. license: MIT metadata: author: wispbit version: "1.0.0" --- # PostgreSQL Expert Best Practices Simple, pragmatic, opinionated. Only what matters for writing production-grade PostgreSQL queries. ## When to Apply Reference these guidelines when: - Writing database migrations or schema changes - Creating or modifying PostgreSQL tables and columns - Adding indexes, constraints, or foreign keys - Reviewing database schema for performance issues - Refactoring existing database structures - Optimizing query performance or database design ## Rule Categories by Priority | Priority | Category | Impact | Prefix | |----------|----------|--------|--------| | 1 | Index Management | CRITICAL-HIGH | `only-concurrent-indexes`, `add-index-for-foreign-key` | | 2 | Constraint Safety | HIGH | `unique-constraint`, `split-foreign-key`, `set-column-not-null` | | 3 | Schema Design | MEDIUM | `only-jsonb`, `always-include-columns`, `limit-non-unique-index` | | 4 | Naming Standards | LOW | `index-naming-standards`, `column-naming-standards` | ## Quick Reference - `only-concurrent-indexes` - Always use CONCURRENTLY to prevent blocking writes during index creation - `add-index-for-foreign-key` - Create indexes for foreign keys to improve query performance - `unique-constraint` - Split unique constraint creation into concurrent index + constraint steps - `split-foreign-key` - Add foreign keys without validation first, then validate separately - `set-column-not-null` - Use check constraints before setting NOT NULL to avoid table locks - `only-jsonb` - Use JSONB instead of JSON for better performance and indexing capabilities - `always-include-columns` - Include id, created_at, and updated_at in all tables for auditability - `limit-non-unique-index` - Limit non-unique indexes to maximum three columns for efficiency - `index-naming-standards` - Use consistent index naming: idx_tablename_columnname - `column-naming-standards` - Maintain consistent snake_case naming and use id suffix for foreign keys ## How to Use Read individual rule files for detailed explanations and code examples: ``` rules/only-concurrent-indexes.md rules/add-index-for-foreign-key.md rules/unique-constraint.md rules/split-foreign-key.md rules/set-column-not-null.md rules/only-jsonb.md rules/always-include-columns.md rules/limit-non-unique-index.md rules/index-naming-standards.md rules/column-naming-standards.md ``` Each rule file contains: - Brief explanation of why it matters - Impact level and description - Incorrect migration example with explanation - Correct migration example with best practices - Additional context and references
© wispbit · MIT · wispbit-ai/skills