360 Secure SkillHub
360 安全技能中心

Toml Validator

核心功能:验证TOML语法,运行空值、混合数组等多维度lint检查,对比两个配置文件差异,查看文件结构、提取指定键,生成类型树。支持pyproject.toml、Cargo.toml等各类TOML文件,输出可选JSON、Markdown等格式。典型场景:检查配置语法正确性、对比环境配置差异、排查配置lint问题、提取特定配置项。输入为TOML文件路径及指令参数,输出对应结果报告。

charlie-morrison
charlie-morrison
热度 53.17
最近更新 2026-05-11 17:42:36
分类:开发依赖:代码执行 / 读写文件应用场景:DevOps / 数据处理

安装技能

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

执行命令安装此 skill: npx secure-skills-cli add 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