跳到正文
Skillpedia
API 与服务器(后端)81k · #1659

migrate-validate

它能做什么

这项技能审查尚未应用的数据库迁移文件,查找常见的安全问题。适合希望在修改正式数据库之前发现错误的开发者。

适用场景

  • ✓当你有待执行的迁移,并希望在应用之前进行检查时。
  • ✓当某个迁移删除了表或列,需要进行安全审查时。
  • ✓当你希望在发布流程中加入命名和安全检查时。

技能链接

https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-migrations/skills/migrate-validate/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-migrations/skills/migrate-validate/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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

  1. Find pending migrations -- use Glob to list all migration files, cross-reference with applied history via mcp__plugin_ruflo-core_ruflo__memory_search --namespace migrations (or memory_list) to identify pending ones. The memory_* tool family routes by namespace; agentdb_hierarchical-* does NOT (it routes by tier), so use memory_* here.
  2. Parse SQL -- use Read to load each pending .up.sql and .down.sql file and parse the SQL statements
  3. Check foreign keys -- verify that all REFERENCES targets exist in the current schema or in prior migrations (both applied and pending)
  4. Check NOT NULL defaults -- verify that any ADD COLUMN with NOT NULL has a DEFAULT value
  5. Check rollback completeness -- verify every CREATE/ALTER in the UP file has a corresponding DROP/ALTER in the DOWN file
  6. Flag destructive ops -- warn on DROP TABLE, DROP COLUMN, TRUNCATE without explicit confirmation
  7. Check idempotency -- verify IF EXISTS / IF NOT EXISTS is used for safety
  8. Check naming -- verify table names are plural, column names are snake_case, index names follow idx_table_column convention
  9. 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-store with type: 'migration-validation'. No namespace arg — ReasoningBank routes it.
    • Plain store (namespace-routable): mcp__plugin_ruflo-core_ruflo__memory_store --namespace migrations for validation results tied to a specific migration number.
  10. 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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能