Home / kingxiaozhe / cm-workflow · skills/cm-database-engineer/SKILL.md · GitHub

cm-database-engineer skillA

cm-database-engineer is agent-read markdown (skill) from kingxiaozhe/cm-workflow: 数据库工程师 Skill,执行数据模型设计、migration、查询优化,自动适配 ORM 和数据库类型.

Indexed from public GitHub and served as immutable, content-addressed versions. Install it pinned to an exact SHA-256 with the mdr CLI, and every file is verified against the hash recorded here before it reaches your agent. The deterministic audit below grades the latest version, and the same file always earns the same grade.

What the file says

# cm-database-engineer — 数据库工程师

执行数据库相关开发任务。自动识别 ORM/查询工具和数据库类型。

## 触发条件

由 `/cm-ai` 自动调用,当 task 涉及数据库开发时触发。

## 工作流程

### 1. 识别技术栈

自动检测,不做硬编码假设:

- **ORM/查询工具**:Prisma / TypeORM / Drizzle / Knex / Sequelize / SQLAlchemy / GORM / diesel / raw SQL
- **数据库类型**:PostgreSQL / MySQL / SQLite / MongoDB / Redis / DynamoDB
- **Migration 工具**:ORM 内置 / Flyway / Alembic / golang-migrate / 自定义
- 扫描现有 migration 文件了解数据库演进历史和命名规范

### 2. 读取上下文

- `.claude/rules/database.md`、`.claude/rules/security.md`(如存在)
- design.md 中的数据模型和接口契约
- 现有 schema/model 文件

### 3. 开发

**Migration:**

- 遵循项目已有的 migration 命名规范(时间戳/序号)
- 确保可回滚(up + down),破坏性变更需暂停确认
- 新表包含审计字段(created_at、updated_at)
- 索引、外键、约束在 migration 中一并创建

**数据模型/Schema:**

- 跟随项目 ORM 的模型定义规范
- 字段类型精确(enum 不用 string 代替,decimal 不用 float)
- 关联关系清晰定义

**查询层:**

- 复杂查询封装为独立函数/repository
- 避免 N+1(eager loading / join / dataloader)
- 大数据量加分页和游标

**Seed 数据:**

- 如需开发用测试数据,创建 seed 脚本

### 4. 安全检查

- 连接字符串从环境变量读取
- 参数化查询,防止注入
- 敏感字段(密码、token)加密/哈希存储
- migration 不包含生产数据

### 5. 验证

```bash
# 根据项目实际工具执行
npx prisma migrate dev --name xxx    # Prisma
npx knex migrate:latest              # Knex
alembic upgrade head                 # Alembic
```

- migration 正常执行
…

Read the whole file at its exact version.

How to install

Latest version
mdr add kingxiaozhe/cm-workflow/cm-database-engineer@git:20260723.0314405
Exact content
mdr add kingxiaozhe/cm-workflow/cm-database-engineer@sha256:2a66d46052211ab3

Pin to a label to follow the author's releases, or to a sha256 to freeze the exact bytes forever. Either way the resolved hash is written to mdr.lock, and mdr install reproduces it on any machine.

Badge

mdr badge

[![mdr](https://markdownregistry.com/badge/art_avgtqfeamlmizxby.svg)](https://markdownregistry.com/a/art_avgtqfeamlmizxby)

1 badge views in 30 days

Versions

versioncommittedcommitsizeaudit
git:20260723.0314405 latest2026-07-23 0314405 2,675 BA view · diff
git:20260707.60332da2026-07-07 60332da 2,675 BA view

Audit of the latest version

A  17 of 17 checks passed. Deterministic, no model, same answer every run.
  • pass: Frontmatter block present
  • pass: Frontmatter declares a name
  • pass: Frontmatter declares a description
  • pass: Size between 200 bytes and 200 KB (2675 bytes)
  • pass: No zero-width or bidi control characters
  • pass: No instruction hidden inside an HTML comment
  • pass: No link to an exfiltration or paste host
  • pass: No credential-shaped string
  • pass: No instruction to send local credentials anywhere
  • pass: No text hidden with inline styles
  • pass: No prompt-injection phrasing
  • pass: No curl or wget piped into a shell
  • pass: No recursive delete of root, home or parent
  • pass: No instruction to read or print local credentials
  • pass: No base64 blob over 200 characters
  • pass: No link to a raw IP address
  • pass: No script tag

Source

GitHub

kingxiaozhe/cm-workflow · 29 stars · license MIT · pushed 2026-09-24 · branch main

API

GET https://markdownregistry.com/api/v1/artifacts/art_avgtqfeamlmizxby
GET https://markdownregistry.com/api/v1/resolve?ref=kingxiaozhe/cm-workflow/cm-database-engineer
GET https://markdownregistry.com/api/v1/blob/2a66d46052211ab3d6c63527e895f5b961668ab0f9c14a2e319e09863bf25236

Your agent does the legwork. You hear about the deals worth your word. Hand yours the standing instructions at modelranch.com and it joins the network that reads files like this one.

More from kingxiaozhe/cm-workflow

CLAUDE.md@.claude claude
kingxiaozhe/cm-workflow · .claude/CLAUDE.md
git:20260917.8e7a8ed · audit A · 29 stars
AGENTS.md agents
kingxiaozhe/cm-workflow · AGENTS.md
git:20260924.3f79f65 · audit A · 29 stars
cm-ai skill
kingxiaozhe/cm-workflow · skills/cm-ai/SKILL.md · 用户明确说“规格已确认,开始实现”或要求按已审批 CM specs 开发时使用。新任务默认由 JS workflow 驱动 N1-N8,完成开发、独立审查、QA 与文档同步;模糊点子、未审规格和单独一句“继续”不能触发编码批准。
git:20260924.056a6a9 · audit A · 29 stars
cm-backend-engineer skill
kingxiaozhe/cm-workflow · skills/cm-backend-engineer/SKILL.md · 后端 API 工程师 Skill,执行服务端 API 层开发(路由、业务逻辑、鉴权中间件、缓存、队列),自动适配语言和框架
git:20260723.0314405 · audit A · 29 stars
cm-check skill
kingxiaozhe/cm-workflow · skills/cm-check/SKILL.md · 用户说“检查工作流是否安装正确”“为什么找不到 cm 命令”时使用。默认查询 npm 稳定版,有新版自动升级已管理的 CM 安装,再检查插件、核心 Skills、兼容包装与模板引用;不测试或修改业务代码。
git:20260920.38ea993 · audit A · 29 stars
cm-contract-engineer skill
kingxiaozhe/cm-workflow · skills/cm-contract-engineer/SKILL.md · 智能合约工程师 Skill,执行合约开发、测试、部署,自动适配 EVM/Solana/Move 等链和开发框架
git:20260723.0314405 · audit A · 29 stars
cm-devops-engineer skill
kingxiaozhe/cm-workflow · skills/cm-devops-engineer/SKILL.md · 发布/运维工程师 Skill,执行 staging 部署、冒烟验证、发布记录与生产发布待决清单编制,自动适配部署栈;生产发布与基础设施变更强制人工确认
git:20260804.c914f1d · audit A · 29 stars
cm-doc-syncer skill
kingxiaozhe/cm-workflow · skills/cm-doc-syncer/SKILL.md · 文档同步 Skill,开发完成后自动更新 README、.claude/ 配置、specs CHANGELOG,保持文档与代码一致
git:20260916.9ebbf71 · audit A · 29 stars
cm-finance-expert skill
kingxiaozhe/cm-workflow · skills/cm-finance-expert/SKILL.md · 金融专家 Skill,覆盖 Web3 与证券/资产/交易领域的正确性审核、营销合规红线识别、合规问题清单生成、业务验收协同;把关型角色,只举旗不定性
git:20260723.0314405 · audit A · 29 stars
cm-fix skill
kingxiaozhe/cm-workflow · skills/cm-fix/SKILL.md · 用户说“修复这个可复现 bug”或要求根据失败报告修代码时使用。执行红灯测试、根因定位、最小修复、独立审查和回归;尚未确认的问题先用 cm-test,新功能和架构重设计转交 cm-prd。
git:20260924.9116423 · audit A · 29 stars
cm-frontend-engineer skill
kingxiaozhe/cm-workflow · skills/cm-frontend-engineer/SKILL.md · 前端工程师 Skill,执行前端开发任务,自动适配项目技术栈(React/Vue/Svelte/Next.js 等),支持 Figma/Stitch 设计稿还原
git:20260723.0314405 · audit A · 29 stars
cm-idea skill
kingxiaozhe/cm-workflow · skills/cm-idea/SKILL.md · 用户说“我有个点子”“帮我梳理产品”或需要先聊清目标时使用。通过逐题访谈整理为可交给 cm-prd 的 PRD;已有明确需求文档时改用 cm-prd,不写代码、不拆开发任务。
git:20260918.eae0cf7 · audit A · 29 stars

Every file in kingxiaozhe/cm-workflow

Browse by kind, by grade A, or by owner.