Token导航 LogoToken导航TokenDH.com
AI 工具只读github未标认证来源可访问clear审计未展示

data-modeling数据建模

Agent Skill

用于辅助数据整理、表格处理、CSV/Excel 分析、指标计算和图表准备。它适合让 Agent 清洗字段、汇总数据、发现异常、生成统计口径或把分析结果转成可读说明。使用时需要确认数据来源、字段含义和时间范围,避免把样本数据当全量事实;涉及敏感数据、导出文件或批量写回时,应先确认权限和脱敏边界。

总安装

212

周安装

9

GitHub Stars

265

下载量

74
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/rsmdt/the-startup --skill data-modeling

简介

专注于数据库 schema 设计与优化,平衡规范化与反规范化结构选择。

  • 适用于从领域需求设计新 schema、分析现有结构优化机会的场景。
  • 涵盖数据仓库选型、实体关系建模和 schema 演进策略规划。
  • 强调数据模型应优先保证正确性,再根据访问模式进行性能优化。
  • data-modeling 属于AI 工具类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Data Modeling

When to Use

  • Designing new database schemas from domain requirements
  • Analyzing existing schemas for optimization opportunities
  • Deciding between normalized and denormalized structures
  • Choosing appropriate data stores (relational vs NoSQL)
  • Planning schema evolution and migration strategies
  • Modeling complex entity relationships

Philosophy

Data models outlive applications. A well-designed schema encodes business rules, enforces integrity, and enables performance optimization. The goal is to create models that are correct first, then optimize for access patterns while maintaining data integrity.

Entity-Relationship Modeling

Identifying Entities

Entities represent distinct business concepts that have identity and lifecycle.

Entity Identification Checklist:

  • Has unique identity across the system
  • Has attributes that describe it
  • Participates in relationships with other entities
  • Has a meaningful lifecycle (created, modified, archived)
  • Would be stored and retrieved independently

Common Entity Patterns:

  • Core domain objects (User, Product, Order)
  • Reference/lookup data (Country, Status, Category)
  • Transactional records (Payment, LogEntry, Event)
  • Associative entities (OrderItem, Enrollment, Permission)

Relationship Types

TypeNotationExampleImplementation
One-to-One1:1User - ProfileFK with unique constraint or same table
One-to-Many1:NCustomer - OrdersFK on the "many" side
Many-to-ManyM:NStudents - CoursesJunction/bridge table

Relationship Considerations:

  • Cardinality: minimum and maximum on each side
  • Optionality: required vs optional participation
  • Direction: unidirectional vs bidirectional navigation
  • Cascade behavior: what happens on delete/update

Attribute Analysis

Attribute Types:

  • Simple: single atomic value (name, price)
  • Composite: structured value (address = street + city + postal)
  • Derived: calculated from other attributes (age from birthdate)
  • Multi-valued: repeating values (phone numbers, tags)

Key Types:

  • Natural key: business-meaningful identifier (SSN, ISBN)
  • Surrogate key: system-generated identifier (UUID, auto-increment)
  • Composite key: multiple columns forming identity
  • Candidate key: any attribute(s) that could serve as primary key

Best Practice: Prefer surrogate keys for primary keys; use natural keys as unique constraints.

Normalization

Normal Forms Progression

Each normal form builds on the previous. Normalize until requirements dictate otherwise.

First Normal Form (1NF)

Rule: Eliminate repeating groups; each cell contains atomic values.

Violation Example:

Order(id, customer, items: "widget,gadget,thing")

Resolution:

Order(id, customer)
OrderItem(order_id, item_name)

Second Normal Form (2NF)

Rule: Remove partial dependencies on composite keys.

Violation Example:

OrderItem(order_id, product_id, product_name, quantity)
                                 ^-- depends only on product_id

Resolution:

OrderItem(order_id, product_id, quantity)
Product(product_id, product_name)

Third Normal Form (3NF)

Rule: Remove transitive dependencies; non-key columns depend only on the key.

Violation Example:

Employee(id, department_id, department_name)
                            ^-- depends on department_id, not employee id

Resolution:

Employee(id, department_id)
Department(id, name)

Boyce-Codd Normal Form (BCNF)

Rule: Every determinant is a candidate key.

Violation Example:

CourseOffering(student, course, instructor)
-- Constraint: each instructor teaches only one course
-- instructor -> course (but instructor is not a candidate key)

Resolution:

InstructorCourse(instructor, course) -- instructor is key
Enrollment(student, instructor) -- references instructor

When to Stop Normalizing

Stop at 3NF for most OLTP systems. Consider BCNF when:

  • Update anomalies cause data corruption
  • Data integrity is paramount
  • Write frequency is high

Denormalization Strategies

Denormalize intentionally for read performance, not out of laziness.

Calculated Columns

Store derived values to avoid repeated computation.

Order
  - subtotal (calculated once on item changes)
  - tax_amount (calculated once)
  - total (calculated once)

Trade-off: Faster reads, more complex writes, potential consistency issues.

Materialized Relationships

Embed frequently-accessed related data.

Post
  - author_id
  - author_name (copied from User.name)
  - author_avatar_url (copied from User.avatar_url)

Trade-off: Eliminates joins, requires synchronization on source changes.

Aggregation Tables

Pre-compute summaries for reporting.

DailySales
  - date
  - product_id
  - units_sold (sum)
  - revenue (sum)

Trade-off: Fast analytics, storage overhead, stale until refreshed.

Denormalization Decision Matrix

FactorNormalizeDenormalize
Write frequencyHighLow
Read frequencyLowHigh
Data consistencyCriticalEventual OK
Query complexitySimpleComplex joins
Data sizeSmallLarge

NoSQL Data Modeling Patterns

Document Stores (MongoDB, DynamoDB)

Embedding Pattern: Embed related data that is read together and has 1:few relationship.

{
  "order_id": "123",
  "customer": {
    "id": "456",
    "name": "Jane Doe",
    "email": "jane@example.com"
  },
  "items": [
    {"product_id": "A1", "name": "Widget", "quantity": 2}
  ]
}

Referencing Pattern: Reference related data when it changes independently or is shared.

{
  "order_id": "123",
  "customer_id": "456",
  "item_ids": ["A1", "B2"]
}

Hybrid Pattern: Embed summary data, reference for full details.

{
  "order_id": "123",
  "customer_summary": {
    "id": "456",
    "name": "Jane Doe"
  },
  "items": [
    {"product_id": "A1", "name": "Widget", "quantity": 2}
  ]
}

Key-Value Stores

Access Pattern Design: Design keys around query patterns.

USER:{user_id} -> user data
USER:{user_id}:ORDERS -> list of order ids
ORDER:{order_id} -> order data

Composite Keys: Combine entity type with identifiers for namespacing.

Wide-Column Stores (Cassandra, HBase)

Partition Key Design: Choose partition keys for even distribution and access locality.

Primary Key: (user_id, order_date)
             ^-- partition key (distribution)
                       ^-- clustering column (ordering)

Avoid:

  • High-cardinality partition keys causing hot spots
  • Large partitions exceeding recommended sizes
  • Scatter-gather queries across partitions

Graph Databases

Node and Relationship Design:

  • Nodes: entities with properties
  • Relationships: named, directed, with properties
  • Labels: categorize nodes for efficient traversal
(User)-[:PURCHASED {date, amount}]->(Product)
(User)-[:FOLLOWS]->(User)
(Product)-[:BELONGS_TO]->(Category)

Schema Evolution Strategies

Additive Changes (Safe)

  • Add new nullable columns
  • Add new tables
  • Add new indexes
  • Add new optional fields (NoSQL)

Breaking Changes (Require Migration)

  • Remove columns/tables
  • Rename columns/tables
  • Change data types
  • Add non-nullable columns without defaults

Migration Patterns

Expand-Contract Pattern:

  1. Add new column alongside old
  2. Backfill new column from old
  3. Update application to use new column
  4. Remove old column

Blue-Green Schema:

  1. Create new version of schema
  2. Dual-write to both versions
  3. Migrate reads to new version
  4. Drop old version

Versioned Documents (NoSQL):

{
  "_schema_version": 2,
  "name": "Jane",
  "email": "jane@example.com"
}

Handle multiple versions in application code during transition.

Best Practices

  • Model the domain first, then optimize for access patterns
  • Use surrogate keys for primary keys; natural keys as unique constraints
  • Normalize to 3NF for OLTP; denormalize deliberately for read-heavy loads
  • Document all foreign key relationships and cascade behaviors
  • Version control all schema changes as migration scripts
  • Test migrations on production-like data volumes
  • Consider query patterns when designing NoSQL schemas
  • Plan for schema evolution from day one

Anti-Patterns

  • Designing schemas around UI forms instead of domain concepts
  • Using generic columns (field1, field2, field3)
  • Entity-Attribute-Value (EAV) for structured data
  • Storing comma-separated values in single columns
  • Circular foreign key dependencies
  • Missing indexes on foreign key columns
  • Hard-deleting data without soft-delete consideration
  • Ignoring temporal aspects (effective dates, audit trails)

References

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

04

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Claude Code

29.16%
按下载量换算22

windsurf

23.9%
按下载量换算18

OpenCode

18.05%
按下载量换算13

Codex

14.8%
按下载量换算11

Gemini CLI

7.64%
按下载量换算6

trae

4.06%
按下载量换算3

安全审计

暂无安全审计结果可展示。

权限和风险

只读

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

安装前确认

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

来源信息

继续浏览同类 Skills