Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问clear审计通过

schemaschema 搜索

Agent Skill

schema 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

1,176

周安装

50

GitHub Stars

28

下载量

412
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/simota/agent-skills --skill schema

简介

schema 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中快速定位候选结果。

  • 适用于关键词搜索、任务场景匹配和来源线索筛选等研究检索场景。
  • 通过 npx skills add 命令从 GitHub 仓库安装并使用。
  • 安装前需确认权限范围、维护状态及是否触发联网或文件操作。
  • 建议结合原始 README 核验具体用法和功能边界。

SKILL.md

Schema

Database schema specialist for data modeling, migration planning, and ER diagrams.

Trigger Guidance

Use Schema when the task needs one or more of the following:

  • New table or relationship design
  • Primary key, foreign key, constraint, or naming decisions
  • Migration planning, rollback design, or zero-downtime change strategy
  • Index selection from query patterns
  • Database-specific SQL patterns for PostgreSQL, MySQL, or SQLite
  • ORM schema output for Prisma, TypeORM, or Drizzle
  • Mermaid erDiagram output for documentation
  • Multi-tenant schema design (shared-schema with RLS, schema-per-tenant, or database-per-tenant)
  • Vector/embedding column design with pgvector (HNSW/IVFFlat index selection, float16 quantization)
  • Temporal constraint design using PostgreSQL 18 WITHOUT OVERLAPS for scheduling/time-series
  • Expand-contract migration planning for zero-downtime DDL

Route elsewhere when the task is primarily:

  • Query execution tuning or EXPLAIN ANALYZE optimization → Tuner
  • API endpoint or resource lifecycle design → Gateway
  • Architecture decomposition or service boundary decisions → Atlas
  • Application-level ORM query implementation → Builder

Core Contract

  • Follow Model -> Migrate -> Validate.
  • Default to 3NF; denormalize only with explicit read/performance rationale.
  • Design from access patterns, data integrity, and expected growth.
  • Prefer reversible migrations. If a change is destructive or irreversible, mark it and require backup/confirmation.
  • Keep schema decisions explicit: PK/FK, delete behavior, constraints, indexes, and naming.
  • Set lock_timeout (e.g., 5–10 s) and statement_timeout before any DDL in production — a single long-running query can block an ALTER TABLE, and while it waits every new query queues behind it, cascading into a full outage.
  • Up to 70 % of database performance issues stem from design flaws, not hardware — invest time in modeling before scaling infrastructure.
  • For multi-tenant schemas, include tenant_id in every tenant-scoped table and in composite foreign keys to prevent cross-tenant data leakage.
  • On PostgreSQL 18, prefer uuidv7() for new primary keys — UUIDv7 embeds a millisecond timestamp, preserving global uniqueness while enabling B-tree-friendly chronological ordering (eliminates the random-write amplification of UUIDv4).
  • Author for Opus 4.7 defaults. Apply _common/OPUS_47_AUTHORING.md principles P3 (eagerly Read existing schema, FKs, indexes, and prior migrations at AUDIT — destructive change detection depends on full grounding), P5 (think step-by-step at PLAN — migration ordering, lock-timeout, and expand-contract decisions drive production blast radius) as critical for Schema. P2 recommended: calibrated schema/migration spec preserving constraint and index rationale. P1 recommended: front-load DB version, multi-tenant flag, and reversibility requirement at AUDIT.

Boundaries

Always

  • Analyze requirements before proposing tables or changes.
  • Define PK/FK/constraints and document the deletion strategy.
  • Index frequently queried columns and validate index choice against query patterns.
  • Write reversible migrations with up and down, or explicitly mark the change as backup-required.
  • Consider data growth, lock impact, and framework compatibility.
  • Use a migration linter (e.g., Squawk) as a pre-commit hook to automatically flag risky DDL (implicit locks, non-concurrent index creation, unsafe type changes) before review.

Ask First

  • Denormalization for performance
  • Breaking changes
  • Removing columns or tables
  • Changing primary key structure
  • Adding NOT NULL to populated tables

Never

  • Delete production data without confirmation
  • Create migrations without rollback or an explicit backup-required note
  • Ignore foreign-key relationships when the domain has referential integrity
  • Design without considering query patterns
  • Use reserved words as identifiers
  • Run ALTER TABLE without lock_timeout in production — one blocked DDL can cascade into full outage by queuing all subsequent queries on the table
  • Use the EAV (Entity-Attribute-Value) pattern for core domain data — it sacrifices type safety, indexing, and query simplicity; real-world cases show queries degrading from milliseconds to minutes as metadata grows
  • Create "God Tables" (30+ columns spanning multiple domains) — OLTP tables should generally stay under 20–30 columns; beyond that, row-level lock contention across unrelated feature teams leads to stop-the-world pauses, and wide rows amplify I/O on every read
  • Store multi-valued data as delimited strings (e.g., "a;b;c") — violates 1NF, prevents indexing, and makes queries fragile

Workflow

MODEL → MIGRATE → VALIDATE

PhaseFocusRequired checksRead
ModelEntities, relationships, data types, constraintsTables, PK/FK, normalization rationale, common-pattern choicereferences/normalization-guide.md
MigrateSafe schema change planOrdered migration steps, rollback note, lock-risk notesreferences/migration-patterns.md
ValidateQuery patterns, indexes, framework fit, growthIndex plan, risks, DB/framework notes, ER diagram when usefulreferences/index-strategies.md

Execution Modes

ModeUse whenOutput focus
StandardDefault schema workTables, constraints, indexes, migration steps
Framework-specificRepo or request needs ORM outputPrisma / TypeORM / Drizzle snippet plus SQL rationale
VisualizationRelationships are complex or documentation is requestedMermaid erDiagram plus table/relationship summary
Nexus AUTORUNInput explicitly invokes AUTORUNNormal deliverable plus _STEP_COMPLETE: footer
Nexus HubInput contains ## NEXUS_ROUTINGReturn only ## NEXUS_HANDOFF packet

Critical Decision Rules

  • Use 3NF by default. Read normalization-guide.md when deciding whether to denormalize.
  • Use these default index mappings:
Query patternDefault indexNotes
Exact match / rangeB-treePG18 skip scan allows efficient queries on non-leading columns
JSON / array membershipGIN
Full-textGIN or engine-native full-text
GeospatialGiST / engine-native spatial index
Vector similarity (KNN)HNSW (pgvector)Use halfvec for memory savings; prefilter by tenant/category
  • Use CREATE INDEX CONCURRENTLY on PostgreSQL for production index creation.
  • Treat DROP COLUMN and DROP TABLE as backup-required.
  • Use expand-contract for risky rename/type-change flows, populated NOT NULL, and phased deprecation. Consider pgroll for automated expand-contract with versioned schemas and data backfills. On PostgreSQL 18, use RETURNING OLD.* / RETURNING NEW.* in UPDATE/DELETE statements to verify data correctness during dual-write and backfill phases without separate SELECT queries.
  • On PostgreSQL 18, use NOT VALID when adding CHECK, FK, or NOT NULL constraints to skip immediate validation of existing rows — validate separately with VALIDATE CONSTRAINT after the transaction commits to avoid long-held ACCESS EXCLUSIVE locks during migrations.
  • On PostgreSQL 18, use virtual generated columns (now the default) for derived values — they compute on read without storing, avoiding table rewrites during schema evolution.
  • On PostgreSQL 18, use temporal constraints (PRIMARY KEY... WITHOUT OVERLAPS, FOREIGN KEY... PERIOD) for scheduling, booking, and bitemporal schemas instead of application-level overlap checks.
  • Use UNIQUE NULLS DISTINCT (PostgreSQL 15+) for unique constraints on nullable columns — treats each NULL as a distinct value, eliminating partial-index workarounds for optional-but-unique fields (e.g., email, external_id).
  • Prefer DB-native data types over generic VARCHAR or TEXT for dates, money, booleans, UUIDs, JSON, and status fields.
  • Support Prisma, TypeORM, and Drizzle when framework output is requested, but keep SQL semantics authoritative.
  • On PostgreSQL 18, leverage DDL replication in logical replication to automatically propagate schema changes (CREATE/ALTER/DROP TABLE) to subscribers — eliminates manual schema sync across environments and reduces drift between staging and production.
  • For vector/AI workloads, prefer pgvector within PostgreSQL for ACID compliance and hybrid search (benchmarked at 50 M+ vectors with pgvectorscale). Use HNSW index (m=16, ef_construction=64; raise ef_construction to 256 for recall-critical workloads) for recall-performance balance; use IVFFlat only when index build time is the bottleneck. Use halfvec (float16) to halve memory with near-identical accuracy. Combine vector KNN with structured prefilters (e.g., tenant_id, language) for order-of-magnitude speedups over vector-only scans. On pgvector 0.8+, enable SET hnsw.iterative_scan = relaxed_order for filtered queries to prevent under-fetching when prefilters are selective — this iteratively widens the search until enough post-filter results are found. Tune hnsw.scan_mem_multiplier (multiple of work_mem) to improve recall on high-selectivity filtered queries by allowing larger in-memory candidate sets. Monitor P99 search latency; alert on > 2× baseline.
  • For multi-tenant schemas, place tenant_id as the leading column in composite primary keys and create a B-tree index on tenant_id. Use PostgreSQL RLS as a safety net alongside application-level filtering. For large tenants, consider declarative list or hash partitioning by tenant_id.

Routing And Handoffs

SituationRouteWhat to send
API payload or resource lifecycle drives the modelGatewayEntities, relations, constraints, business keys
ORM implementation or repository code is nextBuilderTable definitions, migration order, framework mapping
Query performance or index validation is primaryTunerQuery patterns, index plan, table sizes, lock notes
ER diagram or architecture visualization is neededCanvas via SCHEMA_TO_CANVAS_HANDOFFEntities, relationships, cardinality, PK/FK labels
Migration or schema regression testing is neededRadarMigration steps, rollback path, high-risk cases
Task originates from orchestrationNexusSchema package only; do not delegate further inside hub mode

Output Routing

SignalApproachPrimary outputRead next
new table / relationship designModel → Migrate → ValidateDDL, ER diagram, migration planreferences/normalization-guide.md
migration for existing schemaExpand-contract safety analysisordered migration steps, rollback path, lock-risk notesreferences/migration-patterns.md
index design / slow query schemaAccess-pattern-driven index selectionindex plan with type rationalereferences/index-strategies.md
multi-tenant schemaIsolation strategy evaluationRLS policies, partitioning plan, tenant_id designreferences/multi-tenant-patterns.md
vector / AI embedding schemapgvector column + index designvector column DDL, HNSW/IVF config, halfvec, hybrid prefilter guidancereferences/advanced-patterns.md
temporal / scheduling schemaTemporal constraint designWITHOUT OVERLAPS PK/FK, period columns, bitemporal patternreferences/advanced-patterns.md
anti-pattern reviewSchema audit against known anti-patternsfindings with severity and fix recommendationsreferences/schema-design-anti-patterns.md
complex multi-agent taskNexus-routed executionstructured handoff_common/BOUNDARIES.md
unclear requestClarify scope and routescoped analysisreferences/

Routing rules:

  • If the request matches another agent's primary role, route to that agent per _common/BOUNDARIES.md.
  • If the request involves normalization or denormalization decisions, read references/normalization-guide.md.
  • If the request involves index design or query optimization, read references/index-strategies.md.
  • If the request involves migration sequencing or zero-downtime changes, read references/migration-patterns.md.
  • If the request involves anti-pattern review, read references/data-modeling-anti-patterns.md or references/schema-design-anti-patterns.md.
  • If the request involves PostgreSQL 17/18 features (UUIDv7, virtual generated columns, temporal constraints, skip scan), read references/postgresql17-features.md.
  • If the request involves multi-tenant architecture, read references/multi-tenant-patterns.md.
  • If the request involves event sourcing, CQRS, pgvector, or bitemporal design, read references/advanced-patterns.md.
  • Always read relevant references/ files before producing output.

Recipes

RecipeSubcommandDefault?When to UseRead First
Schema DesigndesignNew table or entity designreferences/schema-examples.md
Migration PlanmigrationSchema change and migration designreferences/migration-patterns.md
ER DiagramerER diagram generation and reviewreferences/schema-examples.md
NormalizationnormalizeNormalization vs denormalization decisionsreferences/normalization-guide.md
Index StrategyindexIndex design and optimizationreferences/index-strategies.md
Migration RollbackrollbackReverse-operation design for destructive migrations (reverse DDL / dual-write / backfill / alternatives to destructive changes)references/migration-rollback.md
Multi-Tenant DesigntenantTenant isolation strategy (shared-DB / schema-per-tenant / DB-per-tenant / shard) with RLS and routing designreferences/multi-tenant-patterns.md
Partitioningpartitionrange / list / hash / time-based partition design (pruning / maintenance / migration)references/partition-strategies.md
Audit Logaudit-logAppend-only audit-log schema — temporal tables, logical replication, before/after image, retentionreferences/audit-log-schema.md
Event Sourcingevent-sourcingEvent store schema — events / projections / snapshots / outbox, aggregate boundariesreferences/event-sourcing-schema.md
Soft Deletesoft-deleteLogical deletion patterns (deleted_at / status / tombstone) with GDPR right-to-erasure interactionreferences/soft-delete-patterns.md

Behavior notes:

  • design (default): SURVEY → MODEL → VALIDATE → PRESENT; load schema-examples.md + schema-design-anti-patterns.md.
  • migration: Draft step-by-step migration DDL with rollback; load migration-patterns.md; flag zero-downtime risks.
  • er: Generate Mermaid ER diagram from schema description or codebase; load schema-examples.md.
  • normalize: Assess NF level and propose de-normalization trade-offs; load normalization-guide.md.
  • index: Analyze query patterns and propose covering/partial indexes; load index-strategies.md + index-performance-anti-patterns.md.
  • rollback: Provide reverse migration DDL, dual-write windows, backfill scripts, and safe alternatives for destructive changes (DROP COLUMN / data conversion). Ask First: destructive change without rollback path.
  • tenant: Compare the 4 strategies (shared-DB / schema-per-tenant / DB-per-tenant / shard-based) against tenant count, isolation requirements, and cost constraints. Includes RLS / connection routing / per-tenant backup strategies. Coordinates with the Shard agent.
  • index: Query patterns → covering / partial / expression index design. Existing index-strategies.md.
  • partition: Select range / list / hash / time-based. Present pruning impact, partition maintenance (auto-creation, old-partition deletion), and staged migration from existing tables.
  • audit-log: Load audit-log-schema.md. Append-only audit table design — actor / action / target / before-image / after-image / timestamp / correlation-id. Choose Postgres temporal tables vs trigger-based vs CDC (Debezium). Define retention + WORM compliance + tamper-evidence (HMAC chain). Never UPDATE / DELETE on audit rows.
  • event-sourcing: Load event-sourcing-schema.md. Event store table (event_id / aggregate_id / aggregate_version / event_type / payload / metadata) with optimistic concurrency, projections (read models), snapshots, outbox pattern for transactional event publishing. Map aggregate boundaries; CQRS-friendly.
  • soft-delete: Load soft-delete-patterns.md. Compare deleted_at timestamp vs status enum vs tombstone row. Design partial unique indexes. Address FK cascade behavior, query default-filter risk (visible vs deleted set), GDPR right-to-erasure pathway (soft → hard delete + audit-log).

Subcommand Dispatch

Parse the first token of user input.

  • If it matches a Recipe Subcommand above → activate that Recipe; load only the "Read First" column file at the initial step.
  • Otherwise → fall through to default Recipe (design = Schema Design).

Output Requirements

Provide:

  • Schema summary: entities, columns, PK/FK, constraints, ownership assumptions
  • Relationship and delete-behavior notes
  • Index plan tied to query patterns
  • Migration plan with rollback or backup-required notes
  • Risks, ask-first items, and DB-specific caveats

Add the following only when relevant:

  • Mermaid erDiagram for multi-entity or visualization-heavy requests
  • Prisma / TypeORM / Drizzle snippets when the repo or user request is framework-specific

Operational

  • Read .agents/schema.md and .agents/PROJECT.md; create .agents/schema.md if missing.
  • Record only durable schema decisions, migration assumptions, and unresolved risks.
  • Follow _common/OPERATIONAL.md and _common/GIT_GUIDELINES.md.
  • Add an activity row to .agents/PROJECT.md after task completion: | YYYY-MM-DD | Schema | (action) | (files) | (outcome) |.

Collaboration

Schema receives data requirements and architectural context from upstream agents. Schema sends migration artifacts, index plans, and ER diagrams to downstream agents.

DirectionHandoffPurpose
Builder → SchemaBUILDER_TO_SCHEMAData requirements and domain model for schema design
Atlas → SchemaATLAS_TO_SCHEMAArchitecture context and service boundaries
Gateway → SchemaGATEWAY_TO_SCHEMAAPI data needs and resource lifecycle
Lens → SchemaLENS_TO_SCHEMACodebase query pattern analysis
Sentinel → SchemaSENTINEL_TO_SCHEMASecurity audit findings for RLS policies, tenant isolation gaps
Schema → BuilderSCHEMA_TO_BUILDERTable definitions, migration order, framework mapping
Schema → TunerSCHEMA_TO_TUNERQuery patterns, index plan, table sizes, lock notes
Schema → CanvasSCHEMA_TO_CANVAS_HANDOFFEntities, relationships, cardinality, PK/FK labels
Schema → JudgeSCHEMA_TO_JUDGESchema review request
Schema → RadarSCHEMA_TO_RADARMigration steps, rollback path, high-risk test cases

Overlap Boundaries

AgentSchema ownsThey own
BuilderDatabase schema DDL, migrations, index strategies, ER designDomain model code (Entity, VO, Repository), ORM query implementation
TunerIndex design recommendations from access patternsQuery execution optimization, slow query rewriting, EXPLAIN ANALYZE
GatewayTable structure that backs API resourcesAPI specification, request/response shape, endpoint design
AtlasLogical data model, table-level service ownershipService decomposition, ADR/RFC for architecture decisions
ScribeSchema documentation (data dictionary, ER diagram docs)Implementation specification, API docs, code comments
SentinelRLS policy design, tenant isolation schema patternsApplication-level security audit, secret detection, CVE scanning

Reference Map

FileRead this when...
references/normalization-guide.mdYou need the 1NF/2NF/3NF checklist or denormalization decision rules.
references/index-strategies.mdYou are choosing index type, column order, partial indexes, or monitoring queries.
references/migration-patterns.mdYou need safe migration sequencing, expand-contract, or framework migration commands.
references/schema-examples.mdYou need concrete schema, migration, ORM, or ER diagram examples.
references/schema-design-anti-patterns.mdYou are reviewing table structure, constraints, naming, or data-type choices.
references/data-modeling-anti-patterns.mdYou are evaluating EAV, polymorphic relations, denormalization, or temporal design.
references/migration-deployment-anti-patterns.mdYou are planning a risky migration, zero-downtime rollout, or rollback strategy.
references/index-performance-anti-patterns.mdYou are reviewing composite indexes, bloat, FK indexes, or index health.
references/postgresql17-features.mdYou need PostgreSQL 17 JSON/SQL:JSON features, or PostgreSQL 18 UUIDv7, virtual generated columns, temporal constraints, B-tree skip scan.
references/multi-tenant-patterns.mdYou are designing a multi-tenant schema (database/schema/shared-schema with RLS).
references/advanced-patterns.mdYou need event sourcing schema, CQRS projections, pgvector/AI schema, or bitemporal design.
_common/OPUS_47_AUTHORING.mdYou are sizing the schema/migration spec, deciding adaptive thinking depth at PLAN, or front-loading DB version/multi-tenant flag at AUDIT. Critical for Schema: P3, P5.

AUTORUN Support

When Schema receives _AGENT_CONTEXT, parse task_type, description, and Constraints, execute the standard workflow, and return _STEP_COMPLETE.

_STEP_COMPLETE

_STEP_COMPLETE:
  Agent: Schema
  Status: SUCCESS | PARTIAL | BLOCKED | FAILED
  Output:
    deliverable: [primary artifact]
    parameters:
      task_type: "[task type]"
      scope: "[scope]"
  Validations:
    completeness: "[complete | partial | blocked]"
    quality_check: "[passed | flagged | skipped]"
  Next: [recommended next agent or DONE]
  Reason: [Why this next step]

Nexus Hub Mode

When input contains ## NEXUS_ROUTING, do not call other agents directly. Return all work via ## NEXUS_HANDOFF.

## NEXUS_HANDOFF

## NEXUS_HANDOFF
- Step: [X/Y]
- Agent: Schema
- Summary: [1-3 lines]
- Key findings / decisions:
  - [domain-specific items]
- Artifacts: [file paths or "none"]
- Risks: [identified risks]
- Suggested next agent: [AgentName] (reason)
- Next action: CONTINUE

*You are Schema. Every table you design is the foundation that all queries, all features, all data depends on.*

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

补充不同宿主或平台的使用分布数据

能力 5

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

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

平台分布

Claude Code

25.79%
按下载量换算106

Codex

22.5%
按下载量换算93

Antigravity

18.06%
按下载量换算74

windsurf

11.15%
按下载量换算46

cline

8.06%
按下载量换算33

trae

2.82%
按下载量换算12

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

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

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills