Agent skill

Database Patterns

by yonatangross in yonatangross/orchestkit

Database design and migration patterns for Alembic migrations, schema design (SQL/NoSQL), and database versioning.

MITAuto-check passedDatabases

Install Database Patterns

skills CLI
$ npx skills add yonatangross/orchestkit --skill database-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install yonatangross/orchestkit database-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/yonatangross/orchestkit.git skills-src && mkdir -p .claude/skills && cp -r skills-src/src/skills/database-patterns .claude/skills/database-patterns && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
database-patterns
GitHub stars
289
Token cost
~2.5k tokens
SKILL.md length
665 words
Files
25 (incl. scripts, references)
Skills in repo
108
Repo updated
First seen
Licence
MIT

At a glance

Database design and migration patterns for Alembic migrations, schema design (SQL/NoSQL), and database versioning.

  • Creating migrations
  • SKILL.md covers Quick Reference, Upstream coverage (do not…, Quick Start and Alembic Migrations, plus 8 more sections
  • Designing schemas
  • Normalizing data

What it does

Database Patterns is an agent skill from yonatangross/orchestkit. Database design and migration patterns for Alembic migrations, schema design (SQL/NoSQL), and database versioning. Use when creating migrations, designing schemas, normalizing data, managing database versions, or handling schema drift.

Its SKILL.md is about 2.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 26 other files, including scripts and reference files (for example `metadata.json`, `references/cost-comparison.md` and `references/db-migration-paths.md`). Compatibility notes: Claude Code 2.1.277+.

It sits in Databases, covering Database schema design, Database migrations and NoSQL databases. It works with SQL. The repository describes itself as: The Complete AI Development Toolkit for Claude Code. 106 skills, 36 agents, 171 hooks. Install ork for stable (v9.x), or ork-alpha for the v10 line, which ships daily. The licence is MIT.

When your agent uses it

  • Creating migrations
  • Designing schemas
  • Normalizing data
  • Managing database versions

Example prompts

  • “/database-patterns”

Requirements

  • Python 3
  • Compatibility (from SKILL.md): Claude Code 2.1.277+.
  • Pre-approved tools (allowed-tools): Read, Glob, Grep, WebFetch, WebSearch

What it can do on your machine

Read from SKILL.md and the folder at commit 0ef71d2. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Glob
    • Grep
    • WebFetch
    • WebSearch

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/, which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • postgresql.org
    • alembic.sqlalchemy.org
    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Claude Code 2.1.277+.

    From compatibility in the SKILL.md frontmatter.

Context cost

Database Patterns loads about 2.5k tokens when it runs, and up to ~7.6k if it reads all its reference files. Until then it costs about 63 tokens; SKILL.md has 665 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~63
When it runs · the whole SKILL.md, loaded when a task matches
~2.5k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~7.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from yonatangross/orchestkit at commit 0ef71d2, republished under its MIT licence (© yonatangross). 665 words, ~2,531 tokens.

Download SKILL.mdSave it as .claude/skills/database-patterns/SKILL.md (or your agent's skills folder). This skill also uses 24 other files; get the full folder from GitHub.
name
database-patterns
description
Database design and migration patterns for Alembic migrations, schema design (SQL/NoSQL), and database versioning. Use when creating migrations, designing schemas, normalizing data, managing database versions, or handling schema drift.
allowed-tools
Read, Glob, Grep, WebFetch, WebSearch
compatibility
Claude Code 2.1.277+.
license
MIT
user-invocable
false
disable-model-invocation
false
metadata.owner-agent
database-engineer
metadata.category
document-asset-creation
metadata.version
2.0.0
metadata.author
OrchestKit
metadata.complexity
medium
metadata.tags
database, migrations, alembic, schema-design, versioning, postgresql, sql, nosql
paths
**/migrations/**, **/models/**, alembic.ini, **/schema*
<!-- directive-density: intentional (teaches migration anti-patterns; NEVER markers describe real production-break conditions, not aspirational guidance) -->

Database Patterns

Comprehensive patterns for database migrations, schema design, and version management. Each category has individual rule files in rules/ loaded on-demand.

Quick Reference

CategoryRulesImpactWhen to Use
Alembic Migrations2CRITICALData migrations, branch management
Schema Design3HIGHNormalization, indexing strategies, NoSQL patterns
Versioning2HIGHChangelogs, schema drift detection
Zero-Downtime Migration2CRITICALExpand-contract, pgroll, rollback monitoring

| Database Selection | 1 | HIGH | Choosing the right database, PostgreSQL vs MongoDB, cost analysis |

Total: 10 rules across 5 categories

This skill is a wrap around Alembic and PostgreSQL, not a replacement for their docs. Read references/ork-delta.md first: it holds the version floors, corrections and house conventions that upstream does not carry. Everything in the table below was removed on purpose.

Upstream coverage (do not restate)

These topics are vendor documentation. Fetch them from the source instead of re-teaching them here.

TopicFirst-party source
Alembic autogenerate, async env.py template, revision/upgrade/downgrade/history CLIhttps://alembic.sqlalchemy.org/en/latest/autogenerate.html (our one correction to the async template is in references/ork-delta.md)
Migration branches, merge revisions, tuple down_revision, branch labelshttps://alembic.sqlalchemy.org/en/latest/branches.html
Multi-database env.py, batched backfill recipes, migration hooks, environment-conditional migrationshttps://alembic.sqlalchemy.org/en/latest/cookbook.html
Rollback and data-integrity test harnessesreferences/migration-testing.md
JSONB operators, indexing and storage tradeoffshttps://www.postgresql.org/docs/current/datatype-json.html (normal forms and the house denormalization call stay in rules/schema-normalization.md)
Full index-type reference and syntax (B-tree, GIN, partial, covering, CREATE INDEX CONCURRENTLY, REINDEX)https://www.postgresql.org/docs/current/sql-createindex.html (the house subset we actually apply stays in rules/schema-indexing.md)
lock_timeout, statement_timeout, advisory locks during migrationhttps://www.postgresql.org/docs/current/runtime-config-client.html and rules/versioning-drift.md
Enum type changeshttps://www.postgresql.org/docs/current/datatype-enum.html
Table partitioninghttps://www.postgresql.org/docs/current/ddl-partitioning.html
Trigger functionshttps://www.postgresql.org/docs/current/plpgsql-trigger.html
Foreign-key cascade semanticshttps://www.postgresql.org/docs/current/ddl-constraints.html
Temporal and audit-trail tables, CDC change logs, stored-procedure and view versioninghttps://www.postgresql.org/docs/18/sql-createtable.html (read references/ork-delta.md before assuming these give row history)
HNSW and vector index tuning (m, ef_construction, hnsw.ef_search)https://github.com/pgvector/pgvector
Generic pre-deployment, backup and schema-review checklistshttps://alembic.sqlalchemy.org/en/latest/tutorial.html
Async SQLAlchemy sessions, FastAPI wiring, connection pool tuningork:python-backend skill

Quick Start

python
# Alembic: Auto-generate migration from model changes
# alembic revision --autogenerate -m "add user preferences"

def upgrade() -> None:
    op.add_column('users', sa.Column('org_id', UUID(as_uuid=True), nullable=True))
    op.execute("UPDATE users SET org_id = 'default-org-uuid' WHERE org_id IS NULL")

def downgrade() -> None:
    op.drop_column('users', 'org_id')
sql
-- Schema: Normalization to 3NF with proper indexing
-- PG18: prefer uuidv7() (time-ordered, better B-tree locality) over gen_random_uuid() (random v4)
CREATE TABLE orders (
    id UUID PRIMARY KEY DEFAULT uuidv7(),
    customer_id UUID NOT NULL REFERENCES customers(id),
    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX idx_orders_customer_id ON orders(customer_id);

Alembic Migrations

Migration management with Alembic for SQLAlchemy 2.0 async applications.

RuleFileKey Pattern
Data Migrationrules/alembic-data-migration.mdBatch backfill, two-phase NOT NULL, zero-downtime
Branchingrules/alembic-branching.mdFeature branches, merge migrations, conflict resolution

Autogenerate setup is upstream. Our one deviation from Alembic's async env.py template (the in_greenlet() guard) is in references/ork-delta.md.

Schema Design

SQL and NoSQL schema design with normalization, indexing, and constraint patterns.

RuleFileKey Pattern
Normalizationrules/schema-normalization.md1NF-3NF, when to denormalize, JSON vs normalized
Indexingrules/schema-indexing.mdB-tree, GIN, HNSW, partial/covering indexes
NoSQL Patternsrules/schema-nosql.mdEmbed vs reference, document design, sharding
Show full SKILL.md (274 more words)Show less

Versioning

Database version control and change management across environments.

RuleFileKey Pattern
Changelogrules/versioning-changelog.mdSchema version table, semantic versioning, audit trails
Drift Detectionrules/versioning-drift.mdEnvironment sync, checksum verification, migration locks

Rollback testing lives in references/migration-testing.md; the docstring convention for lossy downgrades is in references/ork-delta.md.

Database Selection

Decision frameworks for choosing the right database. Default: PostgreSQL.

RuleFileKey Pattern
Selection Guiderules/db-selection.mdPostgreSQL-first, tier-based matrix, anti-patterns

Key Decisions

DecisionRecommendationRationale
Async dialectpostgresql+asyncpgNative async support for SQLAlchemy 2.0
NOT NULL columnTwo-phase: nullable first, then alterAvoids locking, backward compatible
Large table indexCREATE INDEX CONCURRENTLYZero-downtime, no table locks
Normalization target3NF for OLTPReduces redundancy while maintaining query performance
Primary key strategyUUID for distributed, INT for single-DBContext-appropriate key generation
Soft deletesdeleted_at timestamp columnPreserves audit trail, enables recovery
Migration granularityOne logical change per fileEasier rollback and debugging
Production deploymentGenerate SQL, review, then applyNever auto-run in production

Anti-Patterns (FORBIDDEN)

python
# NEVER: Add NOT NULL without default or two-phase approach
op.add_column('users', sa.Column('org_id', UUID, nullable=False))  # LOCKS TABLE!

# NEVER: Use blocking index creation on large tables
op.create_index('idx_large', 'big_table', ['col'])  # Use CONCURRENTLY

# NEVER: Skip downgrade implementation
def downgrade():
    pass  # WRONG - implement proper rollback

# NEVER: Modify migration after deployment - create new migration instead

# NEVER: Run migrations automatically in production
# Use: alembic upgrade head --sql > review.sql

# NEVER: Run CONCURRENTLY inside transaction
op.execute("BEGIN; CREATE INDEX CONCURRENTLY ...; COMMIT;")  # FAILS

# NEVER: Delete migration history
command.stamp(alembic_config, "head")  # Loses history

# NEVER: Skip environments (Always: local -> CI -> staging -> production)

Detailed Documentation

ResourceDescription
references/ork-delta.mdOur corrections and house conventions. Read this first
references/migration-testing.mdUpgrade/downgrade cycle and data-integrity test harnesses
references/postgres-vs-mongodb.mdHead-to-head comparison behind the PostgreSQL-first default
references/db-migration-paths.mdCross-engine migration risk matrix
references/cost-comparison.mdManaged database cost analysis
references/storage-and-cms.mdObject storage and CMS selection
scripts/Migration template, model change detector

Zero-Downtime Migration

Safe database schema changes without downtime using expand-contract pattern and online schema changes.

RuleFileKey Pattern
Expand-Contractrules/migration-zero-downtime.mdExpand phase, backfill, contract phase, pgroll automation
Rollback & Monitoringrules/migration-rollback.mdpgroll rollback, lock monitoring, replication lag, backfill progress
  • sqlalchemy-2-async - Async SQLAlchemy session patterns
  • ork:testing-integration - Integration testing patterns including migration testing
  • caching - Cache layer design to complement database performance
  • ork:performance - Performance optimization patterns

© yonatangross, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 24 other files (scripts, references) in src/skills/database-patterns of yonatangross/orchestkit.

  • SKILL.md
  • metadata.json
  • references/cost-comparison.md
  • references/db-migration-paths.md
  • references/migration-testing.md
  • references/ork-delta.md
  • references/postgres-vs-mongodb.md
  • references/storage-and-cms.md
  • rules/_sections.md
  • rules/_template.md
  • rules/alembic-branching.md
  • rules/alembic-data-migration.md
  • rules/db-selection.md
  • rules/migration-rollback.md
  • rules/migration-zero-downtime.md
  • rules/schema-indexing.md
  • rules/schema-normalization.md
  • rules/schema-nosql.md
  • rules/versioning-changelog.md
  • … and 6 more

Open the folder on GitHubat commit 0ef71d2

Compare with similar skills

Database Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Database Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Database Patterns this skillyonatangross/orchestkit289—~2.5kAutomated safety check: PassMIT
Database MigrationDokhacgiakhoa/Agent-Skills-4-Vibe-Coding-CLI507—~227Automated safety check: PassCustom licence
DatabasesMicrock/ordinary-claude-skills403—~1.9kAutomated safety check: NotesMIT
DB Migrationskurealnum/dotfiles290—~820Automated safety check: PassNone
Migrationkortix-ai/suna20k—~1.2kAutomated safety check: PassCustom licence
Database Designeralirezarezvani/claude-skills28k—~3.2kAutomated safety check: PassMIT

Similar skills

  • Database Migration

    Dokhacgiakhoa/Agent-Skills-4-Vibe-Coding-CLI

    MASTER DB: Zero-Downtime, Schema Design (3NF), SQL/NoSQL. An agent skill from Dokhacgiakhoa/Agent-Skills-4-Vibe-Coding-CLI.

    507 GitHub stars~227 tokensUpdated 3 mo ago
    DatabasesAuto-check passed
  • Databases

    Microck/ordinary-claude-skills

    Work with MongoDB (document database, BSON documents, aggregation pipelines, Atlas cloud) and PostgreSQL (relational database, SQL queries, psql CLI, pgAdmin).

    403 GitHub stars~1.9k tokensUpdated 1 mo ago
    DatabasesAuto-check: notes
  • DB Migrations

    kurealnum/dotfiles

    A skill your agent uses when generating or regenerating Drizzle migration files, changing database schema tables or columns, resolving migration sequence conflicts after rebase, reviewing migration…

    290 GitHub stars~820 tokensUpdated 5 mo ago
    DatabasesAuto-check passed
  • Migration

    kortix-ai/suna

    How to change the database schema in this repo. An agent skill from kortix-ai/suna.

    20k GitHub stars~1.2k tokensUpdated today
    DatabasesAuto-check passed
  • Database Designer

    alirezarezvani/claude-skills

    A skill your agent uses when the user asks to design database schemas, plan data migrations, optimize queries, choose between SQL and NoSQL, or model data relationships.

    28k GitHub stars~3.2k tokensUpdated 1 mo ago
    DatabasesAuto-check passed
  • Database Architecture Interviewer

    PrepLabsAI/InterviewMentor

    A Principal Database Engineer interviewer. An agent skill from PrepLabsAI/InterviewMentor.

    112 GitHub stars~2.4k tokensUpdated yesterday
    DatabasesAuto-check passed

More from yonatangross/orchestkit

All 108 skills in this repo
  • API Design

    yonatangross/orchestkit

    API contract design for REST and GraphQL, covering resource shape, URL and header versioning with deprecation windows, RFC 9457 Problem Details error handling, and OpenAPI specs.

    289 GitHub stars~2.9k tokensUpdated today
    Auto-check passed
  • Architecture Decision Record

    yonatangross/orchestkit

    ADR templates in the Nygard format with context, decision, consequences, and alternatives.

    289 GitHub stars~2k tokensUpdated today
    Auto-check passed
  • Audit Full

    yonatangross/orchestkit

    Single-pass codebase analysis leveraging a 1M-token context window for comprehensive security scanning, architecture review, and dependency auditing.

    289 GitHub stars~3.5k tokensUpdated today
    Auto-check: notes
  • Code Review Playbook

    yonatangross/orchestkit

    Structured review processes, conventional comments, language-specific checklists, and feedback templates.

    289 GitHub stars~2.2k tokensUpdated today
    Auto-check passed
  • Create PR

    yonatangross/orchestkit

    Creates GitHub pull requests with pre-flight validation, conventional title formatting, and structured summary generation.

    289 GitHub stars~4.5k tokensUpdated today
    Auto-check: notes
  • Explore

    yonatangross/orchestkit

    Multi-angle codebase exploration spawning 3-5 parallel agents for code structure, data flow, architecture patterns, and health assessment.

    289 GitHub stars~3.9k tokensUpdated today
    Auto-check: notes

Works with

Categories

Questions about Database Patterns

What does Database Patterns do?

Database design and migration patterns for Alembic migrations, schema design (SQL/NoSQL), and database versioning. Database Patterns is an agent skill from yonatangross/orchestkit. Database design and migration patterns for Alembic migrations, schema design (SQL/NoSQL), and database versioning.

When should I use Database Patterns?

Database Patterns fits situations like: creating migrations; designing schemas; normalizing data; managing database versions.

How do I install Database Patterns in Claude Code?

Run `npx skills add yonatangross/orchestkit --skill database-patterns -a claude-code`. Or copy the skill folder (src/skills/database-patterns in yonatangross/orchestkit) into .claude/skills/database-patterns in your project. Claude Code loads it when a task matches its description.

How do I install Database Patterns in Codex?

Run `npx skills add yonatangross/orchestkit --skill database-patterns -a codex`. Or copy the skill folder (src/skills/database-patterns in yonatangross/orchestkit) into .agents/skills/database-patterns in your project. Codex loads it when a task matches its description.

Can I use Database Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add yonatangross/orchestkit --skill database-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/database-patterns, .gemini/skills/database-patterns, .github/skills/database-patterns and .opencode/skills/database-patterns in your project.

What does Database Patterns need to run?

SKILL.md names no scripts, command-line tools or credentials: Database Patterns is instructions for the agent only. Our summary lists: Python 3. Its frontmatter pre-approves these tools: Read, Glob, Grep, WebFetch, WebSearch. Compatibility (from SKILL.md): Claude Code 2.1.277+..

Does Database Patterns access the network?

SKILL.md names 3 domains. As links in the text: postgresql.org, alembic.sqlalchemy.org and github.com. This is read from the text; nothing was executed.

Is Database Patterns safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Database Patterns use?

Database Patterns is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Database Patterns use?

About 2.5k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 5.1k tokens, read only when the agent opens those files.

What are the alternatives to Database Patterns?

Skills that share tags, products or a category with Database Patterns: Database Migration (Dokhacgiakhoa/Agent-Skills-4-Vibe-Coding-CLI, 507 stars), Databases (Microck/ordinary-claude-skills, 403 stars), DB Migrations (kurealnum/dotfiles, 290 stars) and Migration (kortix-ai/suna, 20k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Database Patterns?

yonatangross (a GitHub user) maintains it in yonatangross/orchestkit, which has 289 GitHub stars. The repository holds 108 skills in this directory. The repository was last updated on October 7, 2026.

Source: yonatangross/orchestkit on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.