Skip to content
cccskills
FreePublished on GitHub

schema_validator

显式 schema 校验工具。读取结构化数据与用户提供的 schema,检查字段存在性、字段类型、枚举、范围、长度、正则格式、日期格式、表级行数与缺失率约束,并输出校验报告。当用户提到 schema 校验、结构校验、模式校验、字段存在性检查、字段类型检查、枚举校验、范围校验、格式校验、表头结构校验等需求时使用此 skill。

即使用户没有明确说出"schema_validator",只要任务是在检查结构化数据是否符合明确 schema 规则,就应该使用此 skill。不负责数据清洗、去重、业务合理性判断、跨字段一致性、参照完整性、分布异常分析或数据转换。

The English summary is being prepared. Showing the original description.

See how to install

Files included (4)

  • SKILL.md5.0 KB
  • scripts/example_input.json545 B
  • scripts/run_schema_validator.py20.4 KB
  • skill.json2.0 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Schema Validator 显式 schema 校验 Skill

功能概述

本 skill 用于验证结构化数据是否符合用户提供的明确 schema 规则。它检查字段是否存在、类型是否匹配、枚举值是否合规、数值是否超出范围、字符串长度是否合规、正则格式是否匹配、日期格式是否正确,以及嵌套对象/数组结构是否符合定义。它还支持表级约束,例如最小行数、最大缺失率、字段顺序与额外字段控制。

触发条件

当用户请求以下任务时,应使用此 skill:

  • schema 校验
  • 结构校验
  • 模式校验
  • 字段存在性检查
  • 字段类型检查
  • 枚举校验
  • 范围校验
  • 格式校验
  • 表头结构校验

schema 定义格式

{
  "fields": {
    "id": {
      "type": "int",
      "required": true,
      "nullable": false
    },
    "name": {
      "type": "str",
      "required": true,
      "min_length": 1,
      "max_length": 100
    },
    "status": {
      "type": "str",
      "enum": ["active", "inactive", "pending"]
    },
    "score": {
      "type": "float",
      "min": 0,
      "max": 100
    },
    "email": {
      "type": "str",
      "pattern": "^[\\w.-]+@[\\w.-]+\\.\\w+$"
    },
    "created_at": {
      "type": "date",
      "format": "%Y-%m-%d"
    }
  },
  "table_constraints": {
    "min_rows": 10,
    "max_missing_ratio": 0.2,
    "strict_columns": true,
    "check_column_order": true
  }
}

支持的验证规则

规则说明适用类型
type数据类型所有
required是否必填所有
nullable是否允许空值所有
min最小值int, float
max最大值int, float
min_length最小长度str
max_length最大长度str
pattern正则表达式str
enum枚举值列表str, int
format日期/日期时间格式date, datetime
min_rows最小行数table_constraints
max_missing_ratio最大缺失率table_constraints
strict_columns禁止额外字段table_constraints
check_column_order校验字段顺序table_constraints

使用方法

使用内联 schema

python scripts/run_schema_validator.py \
  --input data.csv \
  --output report.json \
  --schema '{"fields":{"id":{"type":"int","required":true},"name":{"type":"str","required":true}},"table_constraints":{"min_rows":10,"max_missing_ratio":0.2}}'

使用 schema 文件

python scripts/run_schema_validator.py \
  --input data.csv \
  --output report.json \
  --schema schema.json

导出无效数据

python scripts/run_schema_validator.py \
  --input data.csv \
  --output report.json \
  --schema schema.json \
  --output_invalid invalid_rows.csv

参数说明

参数必填说明
--input是输入文件路径
--output是验证报告路径
--schema是schema 定义
--output_invalid否无效数据输出路径

输出示例

验证报告(JSON):

{
  "summary": {
    "total_rows": 1000,
    "valid_rows": 950,
    "invalid_rows": 50,
    "validation_rate": 95.0
  },
  "schema_errors": [
    {"field": "status", "error": "missing_required_field", "expected": "present", "actual": "missing"}
  ],
  "field_errors": {
    "id": {"type_error": 3},
    "email": {"pattern_error": 42}
  },
  "sample_errors": [
    {"row": 10, "field": "email", "error": "pattern_error", "value": "invalid-email"}
  ]
}

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

领域缩略语展开 Skill:按内置或外部词典将独立缩略语替换为全称,可选在全称后保留原缩写。 适用于技术文本、论文摘要和业务记录中的缩写清洗;不负责模糊缩写消歧或大小写无关替换。

The English summary is being prepared. Showing the original description.

cas-bigdatalab/piflow541Updated Oct 17, 2026

字母数字比例过滤器。过滤文本中字母/数字比例不在指定范围内的样本。 当用户提到文本过滤、比例筛选、字母比例、数字比例、清理乱码文本等需求时使用此skill。 即使用户没有明确说出"过滤",只要任务涉及根据文本中字母或数字的比例来筛选数据, 就应该使用此skill。

The English summary is being prepared. Showing the original description.

cas-bigdatalab/piflow541Updated Oct 17, 2026

平均行长度过滤器。过滤文本平均行长度不在指定范围内的样本。 当用户提到行长度过滤、平均行长度、文本行长度筛选、按行筛选等需求时使用此skill。 即使用户没有明确说出"平均行长度",只要任务涉及根据文本中每行的平均长度来筛选数据, 就应该使用此skill。

The English summary is being prepared. Showing the original description.

cas-bigdatalab/piflow541Updated Oct 17, 2026

批量文件清单采集器。扫描一个或多个本地文件/目录,或从任务列表加载路径, 按支持的扩展名生成文件元信息清单,供后续文本、表格、文档、图像等采集流程继续处理。 当用户需要批量盘点待采集文件、生成本地文件 manifest、统计输入文件类型或为后续采集算子准备文件清单时使用此 skill。

The English summary is being prepared. Showing the original description.

cas-bigdatalab/piflow541Updated Oct 17, 2026

批量数据均匀分片工具。读取json/jsonl/csv输入,按份数或固定条数切成多个子文件,输出一个清单JSON供下游节点消费。 当用户提到数据分割、批量拆分、数据分片、均匀分块等需求时使用此skill。 即使用户没有明确说出"分片",只要任务是把整份批量数据均匀拆成多个文件,就应该使用此skill。 不负责按字段分组导出或随机采样。

The English summary is being prepared. Showing the original description.

cas-bigdatalab/piflow541Updated Oct 17, 2026

本skill是用于单细胞测序数据分析的专用技能,首先需要用户上传需要处理的单细胞测序数据,再对经过预处理的单细胞表达数据进行自动化细胞类型注释。它通过基因比对、数据标准化、降维等一系列流程,将细胞聚类结果与已知参考数据库进行匹配,从而为每个细胞分配生物学功能标签。

The English summary is being prepared. Showing the original description.

cas-bigdatalab/piflow541Updated Oct 17, 2026

See all skills by cas-bigdatalab

Report a problem with this skill