Token导航 LogoToken导航TokenDH.com
开发只读clawhub未标认证来源可访问clear审计通过

sql-migration-linterSQL 迁移 linter

Agent Skill

用于辅助数据库表结构、查询语句、迁移脚本和数据维护任务。它适合让 Agent 分析 schema、编写 SQL、排查查询问题、整理索引或生成迁移建议。使用时需要明确数据库类型、连接环境和目标表,区分只读分析与写入变更;涉及删除、更新、迁移和批量导入时,应优先 dry-run、备份或事务保护,避免误操作。

总安装

2,228

周安装

91

GitHub Stars

公开资料未说明

下载量

721
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:sql-migration-linter(SQL 迁移 linter)
来源仓库:https://github.com/charlie-morrison/sql-migration-linter
安装命令:
openclaw skills install sql-migration-linter
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install sql-migration-linter

简介

针对 .sql 迁移文件进行常见错误 Lint 检查。

  • 检测缺少 IF EXISTS 保护、无 WHERE 的 UPDATE/DELETE。
  • 识别非幂等 CREATE 语句和事务包装缺失问题。
  • 提升数据库迁移脚本的安全性和可靠性。sql-migration-linter 属于开发类 Skill,可作为该场景下的辅助能力补充。
  • 适用于 CI/CD 流程和数据库版本控制场景。

SKILL.md

name
sql-migration-linter
description
Lint .sql migration files for common mistakes — missing IF EXISTS guards, UPDATE/DELETE without WHERE, non-idempotent CREATE, missing transaction wrappers, reserved-word identifiers, destructive DDL, and Postgres-specific issues (CREATE INDEX locks, ADD COLUMN NOT NULL without DEFAULT). 17 rules across structure, safety, and style categories. Pure Python stdlib.

SQL Migration Linter

Rule-based linter for SQL migration files. Catches mistakes that make migrations non-idempotent, destructive, or unsafe under concurrent load. Pure Python stdlib — no dependencies.

Supports dialects: generic, postgres, mysql, sqlite.

Commands

# Lint a single file
python3 scripts/sql_migration_linter.py lint migrations/001_init.sql

# Lint a directory recursively
python3 scripts/sql_migration_linter.py lint migrations/

# Specify dialect (unlocks Postgres-specific rules)
python3 scripts/sql_migration_linter.py lint migrations/ --dialect postgres

# Filter by minimum severity
python3 scripts/sql_migration_linter.py lint migrations/ --min-severity warning

# JSON output for CI
python3 scripts/sql_migration_linter.py lint migrations/ --format json

# Compact summary
python3 scripts/sql_migration_linter.py lint migrations/ --format summary

# List all rules
python3 scripts/sql_migration_linter.py rules

Rules (17 total)

Structure

  • missing-trailing-semicolon (error) — file does not end with ;
  • mixed-indentation (warning) — tabs and spaces mixed in the same line
  • trailing-whitespace (info)
  • keyword-case-inconsistent (info) — same keyword appears in mixed case

DDL safety

  • drop-without-if-exists (warning) — DROP TABLE/INDEX/... without IF EXISTS
  • destructive-drop-table (warning) — DROP TABLE flagged for review
  • create-without-if-not-exists (warning) — CREATE TABLE/INDEX/... without IF NOT EXISTS
  • create-index-locks-table (warning, postgres) — CREATE INDEX without CONCURRENTLY
  • add-column-not-null-no-default (error, postgres) — ADD COLUMN ... NOT NULL without DEFAULT
  • reserved-word-identifier (warning) — identifier matches a SQL reserved word (e.g. user, order)

DML safety

  • update-without-where (error)
  • delete-without-where (error)
  • truncate-is-destructive (warning)
  • select-star (info) — SELECT * in migrations
  • insert-without-conflict-handling (info) — INSERT without ON CONFLICT / ON DUPLICATE KEY

Transactions

  • missing-transaction (warning) — 2+ DDL statements without explicit BEGIN/COMMIT
  • begin-without-commit (error)

Output formats

  • text (default) — grouped by file, line:severity: [rule] message, with totals
  • json — array of {file, line, rule, severity, message} objects
  • summary — counts per severity + top 10 rules by frequency

Exit codes (CI-friendly)

  • 0 — clean (or only info below min-severity)
  • 1 — warnings present, no errors
  • 2 — errors present

Examples

# Pre-commit hook — fail on any warning or error
python3 scripts/sql_migration_linter.py lint migrations/ --min-severity warning

# CI gate — fail only on errors
python3 scripts/sql_migration_linter.py lint migrations/ --min-severity error

# Postgres-specific audit
python3 scripts/sql_migration_linter.py lint migrations/ --dialect postgres --format json > report.json

Why this exists

Migrations that look fine locally fail in production because:

  • They aren't idempotent (re-run fails)
  • They lock large tables (Postgres CREATE INDEX, ADD COLUMN NOT NULL)
  • They mutate every row (UPDATE / DELETE without WHERE)
  • They use reserved words as identifiers and break under different parsers

This linter catches those before the PR gets merged.

Limitations

  • Uses regex + statement splitting; not a full SQL parser
  • No schema knowledge — cannot check FK targets, column types, etc.
  • keyword-case-inconsistent is per-statement, not repo-wide

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

93.47%
按下载量换算674

安全审计

VirusTotal

通过

ClawScan

通过

Static analysis

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills