Skip to content
Agentmart
Submit a tool

database-design

数据库设计规范 —— 范式设计、索引策略、分库分表、命名约定与迁移管理

Skill by Sweetteabittersugar

IndexedMIT★ 3
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/sweetteabittersugar-database-design

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

数据库设计规范 —— 范式设计、索引策略、分库分表、命名约定与迁移管理

Use cases: design, backend

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/database-design

What's inside

Skill name
database-design
Description
数据库设计规范 —— 范式设计、索引策略、分库分表、命名约定与迁移管理
License
MIT
Instructions
32 lines in SKILL.md · view on GitHub

Files (2)

  • SKILL.md
  • SKILL.md.disabled

SKILL.md (first lines)

# 数据库设计规范

## 概述
提供关系型数据库设计的最佳实践,覆盖表结构设计、索引策略、命名规范、迁移管理和性能考量。

## 使用场景
- 新项目设计数据模型和表结构
- 现有表结构评审和优化
- 分库分表方案设计
- 数据迁移方案评审

## 核心原则
1. **第三范式为准,反范式为例外**:默认遵循 3NF,仅在性能瓶颈且其他优化无效时考虑反范式。
2. **索引少而精**:每个查询只用一个索引。为查询创建联合索引,不为每列单独建索引。
3. **命名见名知意**:表名用复数名词或单数实体名,字段名不用拼音和缩写,主键统一为 `id`。
4. **所有迁移都有回滚方案**:每份迁移脚本必须配套一份回滚脚本,并验证回滚后数据一致性。
5. **不在数据库做业务逻辑**:存储过程、触发器、视图中的业务逻辑难以测试和版本管理,优先放在应用层。

## 设计要点
- **字段类型选择**:使用最小的合适类型(如状态码用 `tinyint` 而非 `int`),避免 `NULL` 滥用(设 NOT NULL + 默认值)
- **主键策略**:优先自增整型或有序 UUID(ULID、Snowflake),避免随机 UUID 导致页分裂
- **时间字段**:统一 UTC 存储,应用层转换时区;使用 `timestamp` 而非 `datetime`
- **软删除**:统一 `deleted_at` 字段,所有查询默认过滤软删除记录

## 检查清单
- [ ] 是否遵循第三范式(反范式有明确理由)?
- [ ] 每个查询是否都有对应的索引覆盖?
- [ ] 迁移脚本是否包含回滚方案并经回滚验证?
- [ ] 字段命名是否清晰一致(无拼音、无缩写)?
- [ ] 是否有文档记录核心表的字段含义和关系?

From Sweetteabittersugar/agency, MIT.

More from Sweetteabittersugar/agency

Signals

Stars
3
Forks
1
Open issues
0
Last commit (this folder)
Jun 10, 2026 (4 months ago)
Last release
Aug 24, 2026 (2 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from Sweetteabittersugar

Cite this page

database-design skill. Agent Mart. https://agentmart.dev/skills/sweetteabittersugar-database-design (last updated 2026-10-24)