python-data-validation

Implements data validation in Python using pandera schemas and pydantic models.

Updated Jul 29, 2026
One-click install
npx skills add https://github.com/chris-prener/dev-kit --skill python-data-validation-chris-prener
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: python-data-validation
Source: https://github.com/chris-prener/dev-kit/tree/main/dev-kit/skills/python-data-validation
Command: npx skills add https://github.com/chris-prener/dev-kit --skill python-data-validation-chris-prener

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pandera, pydantic, prefect, polars.

What problem does it solve? Data pipelines silently propagate corrupt or malformed data when inputs and outputs are never checked. This Skill defines conventions for validating dataframes and structured records in Python so bad data fails loudly at pipeline boundaries instead of corrupting downstream results. ## Core Features & Use Cases - Framework selection guidance: Choose between pandera for dataframe-shaped data, pydantic for structured records crossing process boundaries, and plain asserts for simple preconditions. - Schema and model patterns: Ready-to-adapt pandera DataFrameSchema definitions with checks for ranges, regex, uniqueness, and allowed values, plus pydantic models with field validators. - Pipeline integration and reporting: Decorator-based input/output validation, Prefect task gates, lazy validation that collects all violations, and JSONL audit logging of validation results. - Use Case: You are building an orders pipeline and need to guarantee every record has a valid order ID, a positive amount, and a known status before processing. Use this Skill to define a pandera schema, wire it into your Prefect flow as a validation task, and log pass/fail results for audit. ## Quick Start Ask the AI to add pandera validation for your pipeline's input and output dataframes, including a schema with range and allowed-value checks and a failure report.

Frequently Asked Questions about python-data-validation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I validate a pandas or polars DataFrame in Python?▼

Use pandera to define a DataFrameSchema declaring each column's dtype and checks such as in_range, isin, str_matches, and unique. Call schema.validate(df) to fail fast, or pass lazy=True to collect every violation into a failure_cases DataFrame.

pandera vs pydantic: which should I use for data validation?▼

Use pandera for dataframe-shaped data such as polars or pandas tables in pipelines. Use pydantic for individual structured records crossing process boundaries, like API payloads, config files, and CLI arguments, since it validates on model construction.

How do I collect all validation errors instead of failing on the first one?▼

In pandera, call schema.validate(df, lazy=True) and catch SchemaErrors to access the failure_cases DataFrame with every violation. In pydantic, model_validate raises a ValidationError whose .errors() method lists all field failures at once.

Can I use pandera validation inside a Prefect pipeline?▼

Yes. Wrap the schema validation call in a Prefect @task function that returns the validated dataframe. If the schema check fails, the task raises and the flow halts, giving you a pass/fail gate between pipeline stages.

When should I not use pandera or pydantic for validation?▼

Skip these frameworks for simple function preconditions, where a plain assert or ValueError check is enough. They also do not cover statistical validation like distribution tests or outlier detection, and they are runtime tools, not a replacement for static type checking.