hello-data

GitHub

规范数据库操作全流程,涵盖模型设计、迁移管理、事务处理、索引策略及数据完整性约束。旨在通过标准化实践确保数据安全、高性能及可维护性,适用于各类数据库交互场景。

skills/hello-data/SKILL.md hellowind777/helloagents

Trigger Scenarios

编写数据库迁移脚本 设计或修改数据Schema 执行复杂SQL查询优化 配置ORM框架如Prisma或Sequelize

Install

npx skills add hellowind777/helloagents --skill hello-data -g -y
More Options

Use without installing

npx skills use hellowind777/helloagents@hello-data

指定 Agent (Claude Code)

npx skills add hellowind777/helloagents --skill hello-data -a claude-code -g -y

安装 repo 全部 skill

npx skills add hellowind777/helloagents --all -g -y

预览 repo 内 skill

npx skills add hellowind777/helloagents --list

SKILL.md

Frontmatter
{
    "name": "hello-data",
    "description": "操作数据库、编写迁移、设计 schema、管理事务、创建索引、使用 Prisma\/Sequelize\/TypeORM\/Mongoose 等 ORM,或执行 SQL\/NoSQL 操作时使用。"
}

数据库相关代码必须遵循以下规范。

编码前

先设计数据模型、迁移策略、回滚方案,再写代码。

迁移管理

  • 所有 schema 变更通过迁移文件,不手动修改数据库
  • 迁移必须可回滚(up + down)
  • 生产迁移前在 staging 验证
  • 迁移文件按时间戳排序

事务处理

  • 多表写操作使用事务
  • 事务范围最小化,避免长事务锁表
  • 死锁预防:固定加锁顺序
  • 失败时完整回滚,不留半完成状态

索引策略

  • 查询条件字段建索引
  • 复合索引注意列顺序(最左前缀匹配)
  • 不要过度索引——每个索引都有写入成本
  • 定期检查慢查询,优化索引

数据完整性

  • 外键约束保证引用完整性
  • NOT NULL + DEFAULT 避免脏数据
  • 唯一约束防止重复
  • 软删除 vs 硬删除:根据业务需求选择,但要一致

交付检查

  • Schema 变更通过迁移文件
  • 多表写操作使用事务
  • 查询条件字段有索引
  • 无 N+1 查询(配合 hello-perf)

Version History

  • 79c0b48 Current 2026-08-20 08:25

Same Skill Collection

skills/commands/auto/SKILL.md
skills/commands/loop/SKILL.md
skills/hello-api/SKILL.md
skills/hello-errors/SKILL.md
skills/hello-perf/SKILL.md
skills/hello-security/SKILL.md
skills/hello-test/SKILL.md
skills/hello-ui/SKILL.md
skills/hello-write/SKILL.md
skills/_meta/SKILL.md
skills/commands/ask/SKILL.md
skills/commands/clean/SKILL.md
skills/commands/commit/SKILL.md
skills/commands/help/SKILL.md
skills/commands/init/SKILL.md
skills/commands/plan/SKILL.md
skills/commands/prd/SKILL.md
skills/commands/qa/SKILL.md
skills/commands/test/SKILL.md
skills/hello-arch/SKILL.md
skills/hello-debug/SKILL.md
skills/hello-reflect/SKILL.md
skills/hello-subagent/SKILL.md
skills/helloagents/SKILL.md
skills/qa-review/SKILL.md

Metadata

Files
0
Version
79c0b48
Hash
7b092deb
Indexed
2026-08-20 08:25

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-25 11:16
浙ICP备14020137号-1 $방문자$