360 Secure SkillHub
360 安全技能中心

Toml Validator

该 Skill 通过 Python 脚本对 TOML 配置文件执行语法校验、lint 检查、文件差异对比、内容展示与类型树查看,支持 pyproject.toml、Cargo.toml 等常见配置,可输出普通文本、JSON 或 Markdown 结果,需要 Python 3.11+ 或安装 tomli。

分类:效率
charlie-morrison
charlie-morrison
热度 30.19
最近更新 2026-05-11 17:42:36

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add charlie-morrison/toml-validator
兼容性
通用兼容
联网要求
不联网
数据出网
数据不出本机
Metadata
name
toml-validator
description
Validate, lint, diff, and inspect TOML configuration files. Use when asked to check TOML syntax, compare TOML configs, show TOML structure, validate pyproject.toml or Cargo.toml, or lint TOML files. Triggers on "TOML", "toml validate", "pyproject.toml", "Cargo.toml", "TOML syntax", "TOML diff", "config file validation".

TOML Validator & Linter

Validate TOML syntax, run lint checks, compare files, and inspect structure. Supports pyproject.toml, Cargo.toml, and any TOML config.

Validate

# Basic syntax check
python3 scripts/toml_lint.py validate config.toml

# With lint checks (empty values, mixed arrays, etc.)
python3 scripts/toml_lint.py validate --lint pyproject.toml Cargo.toml

Diff Two Files

python3 scripts/toml_lint.py diff config-prod.toml config-staging.toml

Show Contents / Extract Key

# Pretty-print entire file
python3 scripts/toml_lint.py show pyproject.toml

# Extract specific key
python3 scripts/toml_lint.py show pyproject.toml --key tool.poetry.version

Type Tree

python3 scripts/toml_lint.py types Cargo.toml

Output Formats

python3 scripts/toml_lint.py -f json validate config.toml
python3 scripts/toml_lint.py -f markdown diff a.toml b.toml

Lint Checks

Check Level Description
Empty strings Warning String values that are blank
Empty tables Warning Tables with no keys
Mixed-type arrays Warning Arrays containing different types
Empty arrays Info Arrays with no elements
Spaced keys Info Keys containing spaces (valid but unusual)
Long strings Info String values exceeding 1000 chars

Requirements

  • Python 3.11+ (has tomllib in stdlib)
  • Or: pip install tomli for Python 3.10 and below