Token导航 LogoToken导航

Agent Skill · 研究检索

database-architect(数据库架构师)

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

database-architect 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 38,909。

总安装 1,493周安装 61GitHub Stars 25下载 478核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/oimiragieo/agent-studio --skill database-architect

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

database-architect 用于辅助数据库表结构、查询语句、迁移脚本和数据维护任务。适用于数据库设计、SQL 编写和迁移管理等场景。通过 GitHub 仓库安装,使用 npx skills add 命令添加技能。

使用时需要明确数据库类型、连接环境和目标表,区分只读分析与写入变更;涉及删除、更新、迁移和批量导入时,应优先 dry-run、备份或事务保护。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:skills/database-architect

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/oimiragieo/agent-studio --skill database-archi…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

database-architect 怎么安装?

在终端执行 npx skills add https://github.com/oimiragieo/agent-studio --skill database-architect。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

database-architect 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

database-architect 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

database-architect 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

database-architect 用的人多吗?

公开数据是累计安装 1,493 次,近一周安装 61 次,下载 478 次,GitHub 25 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

database-architect 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
database-architect

数据库架构师 · 本页

1,49325需要联网未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Database Architect Skill

Step 1: Understand Data Requirements

Gather requirements:

  1. Entities: What data needs to be stored?
  2. Relationships: How do entities relate (1:1, 1:N, N:M)?
  3. Access Patterns: How will data be queried?
  4. Volume: Expected data size and growth rate
  5. Consistency: ACID requirements vs eventual consistency

Step 2: Design Schema

For Relational Databases:

  1. Normalize: Start with 3NF to reduce redundancy
  2. Define Primary Keys: Use surrogate keys (UUID/SERIAL) or natural keys
  3. Define Foreign Keys: Establish referential integrity
  4. Consider Denormalization: Only for proven performance needs

For NoSQL Databases:

  1. Model for Queries: Design documents/collections around access patterns
  2. Embed vs Reference: Embed for 1:1/1:few, reference for 1:many
  3. Shard Key Selection: Choose keys that distribute evenly

Step 3: Plan Indexes

Index strategy based on query patterns:

-- Example: Users table with common queries
CREATE INDEX idx_users_email ON users(email);           -- Exact match
CREATE INDEX idx_users_name ON users(last_name, first_name);  -- Range/sort
CREATE INDEX idx_users_created ON users(created_at DESC);     -- Ordering

Index Guidelines:

  • Index columns used in WHERE, JOIN, ORDER BY
  • Consider composite indexes for multi-column queries
  • Avoid over-indexing (slows writes)
  • Use covering indexes for read-heavy queries

Step 4: Plan Migrations

Create versioned migrations:

migrations/
  001_create_users.sql
  002_add_email_index.sql
  003_create_orders.sql

Migration Best Practices:

  • Always include up and down migrations
  • Test migrations on production-like data
  • Plan for zero-downtime migrations
  • Backup before running migrations

Step 5: Optimize Queries

Analyze and improve slow queries:

  1. Use EXPLAIN ANALYZE: Understand execution plans
  2. Identify Table Scans: Replace with index scans
  3. Optimize JOINs: Ensure indexes on join columns
  4. Batch Operations: Use bulk inserts/updates
  5. Connection Pooling: Reduce connection overhead

Step 6: PostgreSQL 17 Features (2024–2026)

Leverage PostgreSQL 17 capabilities where applicable:

Performance improvements:

  • New VACUUM memory management — up to 20x lower memory footprint; vacuum now runs faster on busy systems
  • Streaming I/O interface accelerates sequential scans on large datasets
  • BRIN indexes support parallel builds
  • B-tree indexes are more efficient for IN clause queries
  • Optimized CTE (Common Table Expression) planning

SQL/JSON enhancements (PG 17):

  • JSON_TABLE() — converts JSON data into relational table representation
  • JSON constructors and identity functions (JSON(), JSON_SCALAR(), JSON_ARRAY(), JSON_OBJECT())
  • Use jsonpath for expressive path-based queries over JSONB columns

Incremental backups:

  • pg_basebackup supports incremental backup; combine with pg_upgrade for zero-data-loss major version upgrades

Logical replication improvements:

  • Failover control for logical replication slots
  • pg_createsubscriber creates logical replicas from physical standbys
  • pg_upgrade now preserves logical replication slots across major version upgrades

Security:

  • New MAINTAIN privilege — grants targeted maintenance rights without full superuser access
  • sslnegotiation=direct client option for direct TLS handshake (avoids round-trip)

COPY improvements:

  • COPY... ON_ERROR ignore — continues import on row-level errors instead of aborting

Step 7: pgvector for AI Embeddings

Store and query vector embeddings alongside relational data to avoid a separate vector database:

-- Install extension
CREATE EXTENSION IF NOT EXISTS vector;

-- Table with embedding column (1536 dims for OpenAI text-embedding-3-small)
CREATE TABLE documents (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    content TEXT NOT NULL,
    embedding vector(1536),
    created_at TIMESTAMPTZ DEFAULT NOW()
);

-- IVFFlat index for approximate nearest neighbor (ANN) search
-- lists = sqrt(row_count) is a good starting value
CREATE INDEX idx_documents_embedding ON documents
    USING ivfflat (embedding vector_cosine_ops) WITH (lists = 100);

-- HNSW index (faster queries, more memory; preferred for < 1M vectors)
CREATE INDEX idx_documents_embedding_hnsw ON documents
    USING hnsw (embedding vector_cosine_ops) WITH (m = 16, ef_construction = 64);

-- Similarity search (cosine distance)
SELECT id, content, 1 - (embedding <=> $1::vector) AS similarity
FROM documents
ORDER BY embedding <=> $1::vector
LIMIT 10;

When to use pgvector vs. dedicated vector DB:

  • Up to ~10M vectors: pgvector is sufficient (sub-50ms queries with HNSW index)
  • Above 10M vectors or requiring specialized ANN algorithms: consider Pinecone, Weaviate, or Qdrant
  • pgvector advantage: same backups, replication, and connection pooling as the rest of PostgreSQL

Step 8: Table Partitioning Strategies

Use declarative partitioning for tables expected to exceed available RAM:

-- Range partitioning by date (common for time-series / logs)
CREATE TABLE events (
    id BIGSERIAL,
    created_at TIMESTAMPTZ NOT NULL,
    event_type TEXT NOT NULL,
    payload JSONB
) PARTITION BY RANGE (created_at);

-- Monthly partitions
CREATE TABLE events_2025_01 PARTITION OF events
    FOR VALUES FROM ('2025-01-01') TO ('2025-02-01');
CREATE TABLE events_2025_02 PARTITION OF events
    FOR VALUES FROM ('2025-02-01') TO ('2025-03-01');

-- Hash partitioning for even distribution (e.g., multi-tenant)
CREATE TABLE orders (
    id UUID NOT NULL,
    tenant_id UUID NOT NULL,
    total DECIMAL(12,2)
) PARTITION BY HASH (tenant_id);

CREATE TABLE orders_p0 PARTITION OF orders FOR VALUES WITH (modulus 4, remainder 0);
CREATE TABLE orders_p1 PARTITION OF orders FOR VALUES WITH (modulus 4, remainder 1);
CREATE TABLE orders_p2 PARTITION OF orders FOR VALUES WITH (modulus 4, remainder 2);
CREATE TABLE orders_p3 PARTITION OF orders FOR VALUES WITH (modulus 4, remainder 3);

Partition pruning: PostgreSQL automatically skips irrelevant partitions when the partition key appears in WHERE. Always include the partition key in queries.

Index on partitioned tables: Indexes created on the parent table are automatically created on all child partitions.

Step 9: JSONB Patterns at Scale

-- Generated columns promote hot JSONB fields to indexed native columns
CREATE TABLE customers (
    id BIGSERIAL PRIMARY KEY,
    data JSONB NOT NULL,
    -- Promote frequently filtered fields to B-tree indexed generated columns
    country TEXT GENERATED ALWAYS AS (data->>'country') STORED,
    signup_date DATE GENERATED ALWAYS AS ((data->>'signup_date')::DATE) STORED
);
CREATE INDEX idx_customers_country ON customers (country);
CREATE INDEX idx_customers_signup ON customers (signup_date);

-- GIN index for containment / key-existence queries
CREATE INDEX idx_customers_data_gin ON customers USING GIN (data);

-- Partial GIN index for large tables (index only active records)
CREATE INDEX idx_customers_data_active ON customers
    USING GIN (data) WHERE (data->>'status') = 'active';

-- jsonpath query example (PG 17)
SELECT * FROM customers
WHERE data @? '$.tags[*] ? (@ == "premium")';

Step 10: Connection Pooling

Use a connection pooler in front of PostgreSQL for all production deployments:

PgBouncer (lightweight, battle-tested):

# pgbouncer.ini
[databases]
mydb = host=127.0.0.1 port=5432 dbname=mydb

[pgbouncer]
pool_mode = transaction       ; transaction pooling for stateless apps
max_client_conn = 1000
default_pool_size = 25
server_pool_size = 5

Supavisor (cloud-native, multi-tenant, Elixir-based):

  • Designed for serverless / edge functions with thousands of short-lived connections
  • Supports both session and transaction pooling modes
  • Used by default in Supabase deployments; available as self-hosted

Pooling modes:

ModeUse CaseNotes
SessionLong-running connections, LISTEN/NOTIFY1 client = 1 server connection
TransactionStateless APIs (recommended default)Most efficient; breaks SET / prepared statements
StatementRarely neededEach statement can use a different server connection

</execution_process>

<best_practices>

  1. Normalize First: Optimize later based on data
  2. Index Thoughtfully: Based on actual query patterns
  3. Use Migrations: Never modify schema directly
  4. Monitor Performance: Use database profiling tools
  5. Plan for Scale: Consider partitioning for large tables
  6. Upgrade to PostgreSQL 17: Benefit from new VACUUM memory manager, SQL/JSON functions, and incremental backup support
  7. Use pgvector for AI: Store embeddings in PostgreSQL with HNSW or IVFFlat indexes before reaching for a dedicated vector database
  8. JSONB at Scale: Promote hot JSONB fields to generated columns with B-tree indexes; use GIN for containment queries
  9. Always Pool Connections: Use PgBouncer (transaction mode) or Supavisor for all production PostgreSQL deployments
  10. Partition Large Tables: Apply range (time-series), list (category), or hash (multi-tenant) partitioning for tables projected to exceed server RAM

</best_practices>

Design a schema for an e-commerce orders system

Example Response:

-- Users table
CREATE TABLE users (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    email VARCHAR(255) UNIQUE NOT NULL,
    created_at TIMESTAMP DEFAULT NOW()
);

-- Orders table
CREATE TABLE orders (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    user_id UUID REFERENCES users(id),
    status VARCHAR(20) DEFAULT 'pending',
    total_amount DECIMAL(10,2),
    created_at TIMESTAMP DEFAULT NOW()
);

-- Order items (1:N relationship)
CREATE TABLE order_items (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    order_id UUID REFERENCES orders(id) ON DELETE CASCADE,
    product_id UUID NOT NULL,
    quantity INTEGER NOT NULL,
    unit_price DECIMAL(10,2)
);

-- Indexes for common queries
CREATE INDEX idx_orders_user ON orders(user_id);
CREATE INDEX idx_orders_status ON orders(status);
CREATE INDEX idx_order_items_order ON order_items(order_id);

</usage_example>

Rules

  • Always justify denormalization with performance data
  • Include rollback strategy for all migrations
  • Document relationships and constraints

Related Workflow

This skill has a corresponding workflow for complex multi-agent scenarios:

  • Workflow: .claude/workflows/database-architect-skill-workflow.md
  • When to use workflow: For comprehensive database design including requirements analysis, schema design, query optimization, migration planning, and testing (multi-phase, multi-agent)
  • When to use skill directly: For quick schema reviews or single-agent database tasks

Iron Laws

  1. NEVER make schema changes without versioned migrations that include both UP and DOWN scripts — manual DDL in production is not recoverable.
  2. ALWAYS normalize to at least 3NF before considering denormalization — never prematurely optimize without measured performance evidence.
  3. ALWAYS plan indexes based on actual query patterns from EXPLAIN ANALYZE — never add indexes speculatively before profiling real workloads.
  4. NEVER test or deploy a migration without running it against production-like data first — schema issues surface under realistic volume, not on empty tables.
  5. ALWAYS use connection pooling (Supavisor or PgBouncer) in production — direct connections from serverless functions exhaust the database connection limit under load.

Anti-Patterns

Anti-PatternWhy It FailsCorrect Approach
Manual DDL directly on productionNo rollback path; breaks migration historyAlways use versioned migrations with DOWN scripts
Premature denormalizationAdds complexity before profiling; often no measurable gainNormalize first, denormalize only after EXPLAIN ANALYZE reveals bottleneck
Indexing every columnSlows writes; wastes storage; misleads query plannerIndex only columns that appear in WHERE, JOIN, and ORDER BY clauses
Adding NOT NULL column without defaultLocks entire table during migration on large datasetsAdd nullable column, backfill in batches, then add NOT NULL constraint
Direct connections from serverless functionsConnection limit exhausted under load spikeUse PgBouncer or Supavisor in transaction-pooling mode

Memory Protocol (MANDATORY)

Before starting:

cat .claude/context/memory/learnings.md

After completing:

  • New pattern -> .claude/context/memory/learnings.md
  • Issue found -> .claude/context/memory/issues.md
  • Decision made -> .claude/context/memory/decisions.md
ASSUME INTERRUPTION: Your context may reset. If it's not in memory, it didn't happen.

平台分布

Codex

37.15%
按下载量换算178

Claude

30.96%
按下载量换算148

Cursor

17.21%
按下载量换算82

Gemini CLI

8.79%
按下载量换算42

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

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

继续浏览同类 Skills