360 Secure SkillHub
360 安全技能中心

SchemGuard

通过 npx 调用 schemaguard 命令行工具,对比新旧 OpenAPI 规范以识别破坏性变更(删除端点、新增必填参数、字段类型变化等),并提供规范质量 lint 与 CI 退出码判定,支持 JSON 输出和 MCP 工具集成。

sethclawd-prog
sethclawd-prog
热度 63.53
最近更新 2026-05-17 12:26:30
分类:开发依赖:代码执行 / 读写文件 / MCP 服务应用场景:API 集成 / 代码审查 / DevOps

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add schemaguard
Metadata
name
schemaguard
description
Detect breaking changes in OpenAPI specs. Use when reviewing API changes, validating PRs that modify API specs, checking backward compatibility, or linting OpenAPI spec quality. Provides diff, lint, and CI check tools.
metadata
{"clawdbot":{"requires":{"bins":["npx"]}}}

SchemGuard — API Schema Drift Monitor

Quick Start

# Diff two specs (breaking vs non-breaking)
npx @sethclawd/schemaguard diff old.yaml new.yaml

# CI check (exit 0=safe, 1=breaking, 2=error)
npx @sethclawd/schemaguard ci --spec ./openapi.yaml --baseline ./baseline.yaml

# Lint spec quality
npx @sethclawd/schemaguard lint ./openapi.yaml

# JSON output for programmatic use
npx @sethclawd/schemaguard diff old.yaml new.yaml --format json

When to Use

  • Before committing changes to an OpenAPI spec
  • When reviewing PRs that modify API routes
  • After generating/updating OpenAPI specs from code
  • Before deploying API changes to production
  • Validating that a migration maintains backward compatibility

Breaking Changes Detected

Rule What It Catches
endpoint-removed Deleted endpoints
required-param-added New required parameters
field-type-changed Changed field types
response-field-removed Removed response fields
enum-value-removed Narrowed enums
auth-requirement-changed Changed security schemes

Non-Breaking (Info Only)

Added endpoints, optional params, response fields, widened enums, deprecations.

MCP Server

For direct tool integration:

npx @sethclawd/schemaguard --mcp

Exposes: schemaguard_diff, schemaguard_lint, schemaguard_check