凡自治之物 · LGD 治理学 · 创造术家族 | 评测协议:skill-quality-gate
English
When to use
- When users report that model JSON output keeps breaking — missing fields cause downstream API or database parsing to fail — this skill performs structured repair.
- When the project must force the LLM to return compliant structures (such as function-calling tool arguments) under specific schema constraints.
- As a safety barrier for "untrusted external input", validating model output against the registered/evidenced/gated principles before any code logic executes.
Usage
The core script is schema_guard.py, callable either as an imported Python module or directly from the command line. Two key parameters are required: the raw text or JSON string to be validated, and a schema-definition object (required fields, data types and enum-value lists). The skill loads and caches its internal logic in __pycache__ automatically; no manual compilation is needed.
Workflow
- Receive the LLM output and the associated schema validation rules.
- Run
schema_guard.pyfor initialization and data loading. - Walk through the input fields, compare required items and type constraints, and check enum compliance.
- Validate per the LGD Three Laws (registered · evidenced · gated); on error, do not simply raise.
- Return repair guidance pinpointing the exact location, or the cleaned corrected data.
- Record the validation status so the system can continuously improve the trustworthiness and format stability of future model output.
Evidence & safety statement
- Evidence: TBD (no evaluation / badge link yet; update here once produced)
- Version: 1.0.1
- Safety: no independent security scan has been performed (TBD); the conclusion is pending and no endorsement is given until it is completed.
中文
何时用
- 当用户反馈模型 JSON 输出格式崩溃、字段缺失导致下游 API 或数据库解析失败时,本技能可执行结构化修复。
- 在项目需要强制 LLM 返回合规结构(如函数调用工具参数)且必须满足特定 Schema 约束时使用。
- 作为『不可信外部输入』的安全屏障,在执行代码逻辑前校验模型输出是否符合有籍·有证·有门禁原则。
用法
核心脚本为 schema_guard.py,支持通过 Python 模块导入方式或直接命令调用。调用时需提供两个关键参数:一是待校验的原始文本或 JSON 字符串,二是 Schema 定义对象(含必填字段、数据类型及枚举值列表)。技能将自动在内部加载并缓存于 __pycache__ 环境中的逻辑,无需用户手动编译即可运行。
流程
- 接收用户输入的 LLM 输出内容及相关 Schema 校验规则。
- 调用
schema_guard.py脚本进行初始化配置与数据加载。 - 遍历输入字段,比对必填项与类型约束,检测枚举值合规性。
- 依据 LGD 三律(有籍·有证·有门禁)逻辑执行验证,若发现错误则不直接报错。
- 生成包含具体修改位置的修复提示或清洗后的修正数据返回给用户。
- 记录校验状态以便系统持续优化后续模型输出的可信度与格式稳定性。
证据与安全声明
- 证据:TBD(暂无评测/徽章链接;产生后在此更新实际链接)
- 版本:1.0.1
- 安全:未做独立安全扫描(TBD),结论待补;补全前不作推荐背书。
