Skip to content
Back to skills

Payload

ASecurity

Validate a CSV file against a JSON column contract of required columns, types, allowed values, ranges, uniqueness and empty-cell rules, and report violations by row and column.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 26, 2026
ai-agentspythonbash

Security analysis

A100/100

Pro scans all 8 files and shows the line behind each finding

Scanned September 26, 2026

npx -y skills add alisonjieli-png/loop-engine --skill payload --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Payload?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Payload
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/alisonjieli-png-payload-f989a22e/badge)](https://www.skillsdirectory.com/skills/alisonjieli-png-payload-f989a22e)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: "check-csv-column-contract"
description: "Validate a CSV file against a JSON column contract of required columns, types, allowed values, ranges, uniqueness and empty-cell rules, and report violations by row and column."
license: MIT
compatibility: "Python 3.10 or later, standard library only."
metadata:
  version: "0.1.0"
---

# Check a CSV against a column contract

The script `scripts/check_column_contract.py` does every check. It reads the two files and writes nothing. In each command, `SKILL_DIR` is the folder that holds this file. Run commands from the workspace root. Paths are relative to it.

## When to use it

Use it when a table must follow written column rules: after a cleaning step, before a hand-off, or when the task says the output must follow a contract. The script applies only the rules in the contract. The format is in `references/contract-format.md`, and `examples/column-contract.json` is a complete contract.

## First action

```bash
python3 -I -B SKILL_DIR/scripts/check_column_contract.py --csv data/clean/customers.csv --contract contracts/customers.json
```

## Steps

1. If the task names no contract file, stop and report. Do not write a contract from the table you are checking.
2. Run the first action with the task's paths. For a tab or semicolon file, add `--delimiter tab` or `--delimiter semicolon`.
3. Read `status`, `failed_checks` and `violations_by_column`.
4. For each failed check, quote one or two items of `violations` with their `row`, `column`, `rule` and `value`.
5. Answer every item in `references/checklist.md`.

## Checks

- Exit code 0 and `status` `pass`: every contract rule held on every row.
- Exit code 1 and `status` `fail`: the counts in `checks` are complete, even when `violations` lists only examples.
- `contract_columns_not_checked` is empty. A name listed there did not appear once in the header, so its rules did not run.

## Done when

The report gives the status, the CSV path and its `sha256`, each failed check with its counts per column, and the checklist answers.

## Stop and report when

- Exit code 2: report `reason` and `detail`. An unknown contract key or type is refused on purpose, so a typing error cannot switch a rule off.
- The contract and the task disagree about a column.
- The table seems to need fixing. This step only checks. It never edits the table or the contract.

## Known-wrong example

A model looks at a few rows of a cleaned customer table, sees two-letter country codes and reports that the file follows the contract. The table still holds `Germany` in `country`, and customer `C-0002` appears twice after a merge. The script reads every row and reports both with their row, line and column. Run it with `--bundle examples/known-wrong-bundle.json` to see these two and five more violations.

Files in this skill

  • LICENSE1 KB
  • SKILL.md2.7 KB
  • examples/column-contract.json1 KB
  • examples/known-wrong-bundle.json1.6 KB
  • references/checklist.md815 B
  • references/contract-format.md2.8 KB
  • scripts/check_column_contract.py32.4 KB
  • tests/test_check_column_contract.py16.1 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.