migrate-validate
它能做什么
这项技能审查尚未应用的数据库迁移文件,查找常见的安全问题。适合希望在修改正式数据库之前发现错误的开发者。
适用场景
- ✓当你有待执行的迁移,并希望在应用之前进行检查时。
- ✓当某个迁移删除了表或列,需要进行安全审查时。
- ✓当你希望在发布流程中加入命名和安全检查时。
技能链接
https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-migrations/skills/migrate-validate/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“在我应用待执行的数据库迁移之前,请检查其中是否有风险较高的改动。”
每周 5 个新技能,1 分钟读完。
工作原理
这项技能找出待执行的迁移文件,读取其 SQL,并检查外键目标、新增必填列的默认值、撤销步骤是否完整、破坏性操作、安全的措辞以及表命名。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Migrate Validate
Validate all pending database migrations for correctness, safety, and adherence to best practices.
When to use
Before applying migrations to catch issues early -- foreign key references to non-existent tables, missing rollback SQL, destructive operations without safeguards, and naming convention violations.
Steps
- Find pending migrations -- use
Globto list all migration files, cross-reference with applied history viamcp__plugin_ruflo-core_ruflo__memory_search --namespace migrations(ormemory_list) to identify pending ones. Thememory_*tool family routes by namespace;agentdb_hierarchical-*does NOT (it routes by tier), so usememory_*here. - Parse SQL -- use
Readto load each pending.up.sqland.down.sqlfile and parse the SQL statements - Check foreign keys -- verify that all REFERENCES targets exist in the current schema or in prior migrations (both applied and pending)
- Check NOT NULL defaults -- verify that any ADD COLUMN with NOT NULL has a DEFAULT value
- Check rollback completeness -- verify every CREATE/ALTER in the UP file has a corresponding DROP/ALTER in the DOWN file
- Flag destructive ops -- warn on DROP TABLE, DROP COLUMN, TRUNCATE without explicit confirmation
- Check idempotency -- verify IF EXISTS / IF NOT EXISTS is used for safety
- Check naming -- verify table names are plural, column names are snake_case, index names follow
idx_table_columnconvention - Store validation patterns -- two paths (per ruflo-cost-tracker ADR-0001 dual-path pattern):
- Pattern store (typed, recommended):
mcp__plugin_ruflo-core_ruflo__agentdb_pattern-storewithtype: 'migration-validation'. No namespace arg — ReasoningBank routes it. - Plain store (namespace-routable):
mcp__plugin_ruflo-core_ruflo__memory_store --namespace migrationsfor validation results tied to a specific migration number.
- Pattern store (typed, recommended):
- Report -- display: errors (must fix), warnings (should fix), info (suggestions), with file path and line number for each issue
CLI alternative
npx @claude-flow/cli@latest memory search --query "migration validation results" --namespace migrations
常见问题
什么算是破坏性改动?
删除表、删除列和清空表(truncate)语句会被标记,以便你确认。
它会修改迁移文件吗?
描述中涵盖检查和报告,因此请查看发现的问题,再决定如何修改。
它如何知道哪些迁移待执行?
它会将迁移文件与存储在 migrations 记忆命名空间中的历史记录进行比较。
详情
作者的原始描述
Validate pending migrations for foreign key consistency, rollback safety, and best practices
repo: ruvnet/ruflo
热度
- GitHub 星标
- 81k
- 排名
- #1659
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
agent-adaptive-coordinator
81k帮你的智能体在工作量变化时拆分和重新平衡一组 AI 智能体,并选择适合任务的分工方式。
agent-agent
81k教你的智能体把一个大目标拆成有顺序的行动计划,并在情况变化时重新规划。
agent-agentic-payments
81k帮你的智能体管理 AI 购物的消费授权,包括消费上限、时间窗口、商户规则和签名审批。
agent-analyze-code-quality
81k帮你的智能体检查代码质量,找出代码异味、技术债务和重构建议,且不改动文件。