Token导航 LogoToken导航TokenDH.com
运维和基础设施只读github未标认证来源可访问许可证需确认审计通过

database-patterns数据库模式

Agent Skill

用于辅助数据库表结构、查询语句、迁移脚本和数据维护任务。它适合让 Agent 分析 schema、编写 SQL、排查查询问题、整理索引或生成迁移建议。使用时需要明确数据库类型、连接环境和目标表,区分只读分析与写入变更;涉及删除、更新、迁移和批量导入时,应优先 dry-run、备份或事务保护,避免误操作。

总安装

3,515

周安装

151

GitHub Stars

160

下载量

1,232
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:database-patterns(数据库模式)
来源仓库:https://github.com/yonatangross/orchestkit
仓库路径:skills/database-patterns
安装命令:
npx skills add https://github.com/yonatangross/orchestkit --skill database-patterns
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/yonatangross/orchestkit --skill database-patterns

简介

用于辅助数据库表结构、查询语句和迁移脚本处理,适合数据维护场景。

  • 可分析 schema、编写 SQL、排查查询问题或生成迁移建议,支持多宿主环境。
  • 需明确数据库类型、连接环境和目标表,区分只读分析与写入变更。
  • 涉及删除、更新、迁移和批量导入时,应优先 dry-run、备份或事务保护。
  • database-patterns 属于运维和基础设施类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

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 Migrations3CRITICALAutogenerate, data migrations, branch management
Schema Design3HIGHNormalization, indexing strategies, NoSQL patterns
Versioning3HIGHChangelogs, rollback plans, schema drift detection
Zero-Downtime Migration2CRITICALExpand-contract, pgroll, rollback monitoring

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

Total: 12 rules across 5 categories

Quick Start

# 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')
-- Schema: Normalization to 3NF with proper indexing
CREATE TABLE orders (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    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
Autogenerate${CLAUDE_SKILL_DIR}/rules/alembic-autogenerate.mdAuto-generate from models, async env.py, review workflow
Data Migration${CLAUDE_SKILL_DIR}/rules/alembic-data-migration.mdBatch backfill, two-phase NOT NULL, zero-downtime
Branching${CLAUDE_SKILL_DIR}/rules/alembic-branching.mdFeature branches, merge migrations, conflict resolution

Schema Design

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

RuleFileKey Pattern
Normalization${CLAUDE_SKILL_DIR}/rules/schema-normalization.md1NF-3NF, when to denormalize, JSON vs normalized
Indexing${CLAUDE_SKILL_DIR}/rules/schema-indexing.mdB-tree, GIN, HNSW, partial/covering indexes
NoSQL Patterns${CLAUDE_SKILL_DIR}/rules/schema-nosql.mdEmbed vs reference, document design, sharding

Versioning

Database version control and change management across environments.

RuleFileKey Pattern
Changelog${CLAUDE_SKILL_DIR}/rules/versioning-changelog.mdSchema version table, semantic versioning, audit trails
Rollback${CLAUDE_SKILL_DIR}/rules/versioning-rollback.mdRollback testing, destructive rollback docs, CI verification
Drift Detection${CLAUDE_SKILL_DIR}/rules/versioning-drift.mdEnvironment sync, checksum verification, migration locks

Database Selection

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

RuleFileKey Pattern
Selection Guide${CLAUDE_SKILL_DIR}/rules/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)

# 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
${CLAUDE_SKILL_DIR}/references/Advanced patterns: Alembic, normalization, migration, audit, environment, versioning
${CLAUDE_SKILL_DIR}/checklists/Migration deployment and schema design checklists
${CLAUDE_SKILL_DIR}/examples/Complete migration examples, schema examples
${CLAUDE_SKILL_DIR}/scripts/Migration templates, model change detector

Zero-Downtime Migration

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

RuleFileKey Pattern
Expand-Contract${CLAUDE_SKILL_DIR}/rules/migration-zero-downtime.mdExpand phase, backfill, contract phase, pgroll automation
Rollback & Monitoring${CLAUDE_SKILL_DIR}/rules/migration-rollback.mdpgroll rollback, lock monitoring, replication lag, backfill progress

Related Skills

  • 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

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.92%
按下载量换算455

Claude

33.72%
按下载量换算415

Cursor

17.85%
按下载量换算220

Gemini CLI

8.8%
按下载量换算108

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills