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

database-schema-design数据库模式设计

Agent Skill

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

总安装

624

周安装

25

GitHub Stars

11

下载量

202
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/akillness/skills-template --skill database-schema-design

简介

用于数据库建模与演化规划。database-schema-design 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

  • 支持关系型、文档型和混合存储选型。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。
  • 需明确租户边界、索引策略和删除保留规则。
  • 应提供可执行的迁移方案与回滚预案。
  • 涉及生产表变更时务必先备份再操作。

SKILL.md

Database Schema Design

Use this skill when the main job is choosing and evolving the storage model, not dumping generic SQL or ORM snippets.

database-schema-design is the backend storage-design anchor for:

  • choosing between relational-first, document-heavy, and hybrid models
  • turning domain entities into tables, collections, ownership boundaries, and lifecycle rules
  • justifying constraints, indexes, tenant scope, history/audit structures, and deletion/retention behavior
  • planning staged schema evolution so migrations, backfills, and cleanup are believable
  • handing downstream teams one compact storage-design packet before implementation, verification, reporting, or observability work branches out

Read these support docs before handling larger or riskier work:

When to use this skill

  • Design a new schema for a product feature, internal tool, admin workflow, customer-data surface, or live-ops/game backend system.
  • Refactor an existing storage model with weak constraints, naming drift, poor cardinality modeling, or untrusted indexing.
  • Decide which fields must be first-class columns or indexed document fields versus flexible metadata payloads.
  • Plan multi-tenant, audit-log, entitlement, status-history, retention, or soft-delete boundaries.
  • Review whether a migration is safe, staged realistically, and honest about backfills, compatibility windows, and cleanup.
  • Produce one bounded storage packet before implementation or while a risky backend change is being shaped.

When not to use this skill

  • The main job is REST/GraphQL contract shape, endpoint behavior, webhook semantics, or versioningapi-design.
  • The main job is identity/session/provider setup or auth-owned user/org boundariesauthentication-setup.
  • The main job is migration verification, repository coverage, or contract/regression testsbackend-testing.
  • The main job is published docs, quickstarts, or developer-facing schema/API explanationsapi-documentation.
  • The main job is broad hardening beyond data integrity, like secret handling, CSRF, cookies, or abuse controlssecurity-best-practices.
  • The main job is dashboard/reporting presentation or telemetry/alert coverage on top of already-modeled datalooker-studio-bigquery or monitoring-observability.
  • The request has no real domain, access pattern, or lifecycle context yet; in that case return the missing questions instead of pretending the schema is settled.

Instructions

Step 1: Classify one primary storage-design packet

Use one primary lane and one smallest useful artifact.

schema_packet:
  workload_shape: oltp | analytics-adjacent | event-log | content-heavy | mixed | unknown
  data_lane: relational-first | document-heavy | hybrid | unknown
  change_type: greenfield | incremental | migration | cleanup | scale-fix
  ownership_focus: product-core | internal-ops | marketing-customer-data | game-live-ops | mixed
  durability_needs: basic | transactional | audit-heavy | compliance-sensitive | unknown
  hottest_risk: integrity | queryability | migration-safety | lifecycle-drift | unclear
  output_packet: design-memo | schema-review | migration-rollout | erd-plus-decisions | unknown

Normalize first:

  1. What are the real business entities or aggregates?
  2. Which reads, writes, filters, joins, or reports are highest value?
  3. Is this greenfield design, live-system change, or schema cleanup?
  4. Which rules are true business invariants versus temporary implementation convenience?
  5. Which platform constraints already exist (database engine, ORM, hosted service, compliance, scale)?

Step 2: Gather the minimum credible evidence

Do not design storage from vibes alone. Pull the smallest packet that supports real decisions:

  • product/domain objective
  • current schema, models, or representative records if they exist
  • known reads/writes, filters, joins, search/reporting needs, and retention rules
  • tenant/ownership, audit/history, and deletion expectations
  • rollout constraints: traffic, migration windows, lock risk, compatibility concerns, downstream consumers
  • open questions that would make the design fake-ready

If the evidence is thin, say so explicitly and keep the packet at review/memo level instead of pretending it is implementation-ready.

Step 3: Choose the data lane deliberately

Use references/storage-decision-matrix.md.

  • Relational-first when integrity, transactions, shared invariants, joins, or reporting matter most.
  • Document-heavy when one aggregate is usually read/written together and the shape varies enough that strict relational modeling would be fake precision.
  • Hybrid when the transactional core is stable but some metadata/content payloads are legitimately flexible.

State the reason in one or two sentences. “Because the stack already uses it” is useful context, not the whole rationale.

Step 4: Model ownership, lifecycle, and query-critical fields

For each core entity/collection/aggregate, define:

  • purpose and ownership boundary
  • identifier strategy
  • required vs optional attributes
  • lifecycle states and timestamps
  • relationships or reference direction
  • tenant/org ownership if relevant
  • deletion, archival, retention, and history rules
  • which fields must stay queryable, unique, or reportable
  • which fields can remain flexible metadata without harming search/reporting/ops

Watch for these traps:

  • mirroring UI objects instead of business concepts
  • hiding many-to-many or history in JSON blobs or ad hoc arrays
  • collapsing mutable state, audit history, and derived/cache data into one table/document
  • letting auth/profile/session ownership blur into unrelated product entities
  • storing analytics, telemetry, or campaign attributes in opaque payloads when they already drive filtering, reporting, or live-ops decisions

Step 5: Design integrity and access rules together

A schema is only as good as the invariants it can defend.

Name:

  • keys and ownership rules
  • uniqueness / nullability / defaults / state constraints
  • hottest reads, writes, filters, joins, or aggregate lookups
  • indexes and why each one exists
  • intentional denormalization or flexible fields and the reason they stay flexible

If you cannot name the main query shapes, the indexing guidance is probably fake.

Step 6: Plan rollout and route-outs

For incremental or live-system changes, define:

  • additive vs destructive changes
  • expand-and-contract, backfill, dual-read/write, or shadow-read phases if needed
  • when indexes/constraints become safe to enforce
  • rollback or stop conditions
  • cleanup conditions for old columns/tables/doc fields

Then route adjacent work clearly using references/intake-packets-and-route-outs.md:

  • api-design for interface or contract changes that depend on the model
  • authentication-setup for identity/session/provider ownership
  • backend-testing for migration verification and regression coverage
  • looker-studio-bigquery when the main job is stakeholder dashboards/reporting over curated data
  • monitoring-observability when the main job is telemetry freshness, alert coverage, or runtime visibility
  • security-best-practices when the concern goes beyond data integrity into broader app/web hardening

Step 7: Run the boundary check

Use references/schema-review-checklist.md before finalizing.

Verify:

  1. One data lane and one output packet were chosen.
  2. Ownership, lifecycle, and query-critical fields are explicit.
  3. Flexible metadata is justified instead of acting as deferred modeling debt.
  4. Migration safety is believable for a live system.
  5. API/auth/testing/reporting/observability work was routed out instead of silently absorbed.
  6. The packet ends with the next concrete move.

Output format

## Storage Design Packet: [System or Feature]

### Packet framing
- Workload shape:
- Chosen data lane:
- Change type:
- Ownership focus:
- Why this lane fits:

### Evidence used
- Current artifacts:
- Query/reporting needs:
- Lifecycle or retention constraints:
- Assumptions / gaps:

### Entity / collection map
| Entity | Purpose | Key fields | Relationships / ownership | Lifecycle notes |
|--------|---------|------------|----------------------------|-----------------|
| ... | ... | ... | ... | ... |

### Integrity and access rules
- Required constraints:
- Uniqueness / nullability notes:
- Indexes and why:
- Flexible metadata that stays flexible:

### Rollout / migration plan
- Sequence:
- Backfill / compatibility notes:
- Cleanup conditions:
- Stop / rollback signals:

### Route-outs
- API / contract:
- Auth / identity:
- Verification:
- Reporting / observability:

### Recommended next move
- draft migration plan | review with owners | hand off to API/auth/testing/reporting | defer until missing evidence is gathered

Examples

Example 1: SaaS core model

Input: "We need schema help for a B2B SaaS app with users, organizations, memberships, subscriptions, invoices, and audit logs. We use Postgres and need something implementation-ready."

Good output direction

  • chooses relational-first
  • separates users, organizations, memberships, subscriptions, and immutable invoice records clearly
  • treats audit/history separately from mutable entity state
  • routes session/provider details to authentication-setup

Example 2: Flexible metadata migration

Input: "Our marketplace stores product metadata in one JSON column, but search, moderation, and filters now depend on stable fields. Plan a safe migration."

Good output direction

  • chooses hybrid
  • identifies which fields must graduate from JSON into first-class columns or indexed fields
  • proposes staged rollout, backfill, and cleanup conditions
  • routes verification to backend-testing

Example 3: Game live-ops boundary

Input: "We need to model player inventory, seasonal event progress, and telemetry for a live game without burying reporting needs in opaque blobs."

Good output direction

  • separates player-owned transactional state from telemetry/reporting concerns
  • keeps one storage packet focused on state integrity and lifecycle
  • routes dashboard/telemetry follow-through to looker-studio-bigquery or monitoring-observability

Best practices

  1. Start from business invariants and access patterns, not table aesthetics.
  2. Treat migration safety as part of schema design, not a later ops chore.
  3. Keep flexible metadata honest: useful when justified, dangerous when it hides query-critical fields.
  4. Separate mutable state, history/audit, and derived/reporting data.
  5. Route adjacent API/auth/testing/reporting work outward instead of turning this into a generic backend mega-skill.
  6. Prefer a durable packet over giant vendor-specific example dumps.

References

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

37.85%
按下载量换算76

Claude

26.92%
按下载量换算54

Cursor

19.42%
按下载量换算39

Gemini CLI

8.53%
按下载量换算17

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

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

安装前确认

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

来源信息

继续浏览同类 Skills