parsing-validation

Validate and parse external data using Pydantic models with structured error handling.

Updated Sep 2, 2026
One-click install
npx skills add https://github.com/Dazlarus/karl-code --skill parsing-validation-dazlarus
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: parsing-validation
Source: https://github.com/Dazlarus/karl-code/tree/main/.agents/skills/parsing-validation
Command: npx skills add https://github.com/Dazlarus/karl-code --skill parsing-validation-dazlarus

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pydantic, aiohttp.

What problem does it solve? Parsing untrusted external data like JSON, CSV, or API responses without validation leads to runtime crashes, silent type coercion bugs, and cryptic error messages that are hard to debug. ## Core Features & Use Cases - Pydantic-Based Validation: Enforces schemas with field constraints, custom validators, and strict mode to control type coercion. - Graceful Error Handling: Wraps JSON decode and validation failures in contextual ParseError exceptions with line numbers and field names. - Use Case: When consuming a third-party REST API, define an ExternalUser Pydantic model with field aliases, validate the response payload, and raise descriptive errors instead of letting malformed data propagate through your application. ## Quick Start Review my data parsing code and apply Pydantic validation with clear error messages for all external inputs.

Frequently Asked Questions about parsing-validation

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

FAQPage Schema
How do I validate JSON data with Pydantic in Python?▼

Define a Pydantic BaseModel with typed fields and constraints, then call Model.model_validate(data) on the parsed JSON. ValidationError exceptions report exactly which fields failed and why.

How to write custom validators in Pydantic models?▼

Use the @field_validator decorator for single-field checks like password strength, and @model_validator(mode="after") for cross-field rules such as confirming two passwords match. Raise ValueError with a clear message to fail validation.

Does Pydantic coerce string types to integers automatically?▼

By default Pydantic coerces compatible types, so the string "123" becomes an integer. Set model_config = ConfigDict(strict=True) to disable coercion and reject non-matching types outright.

How do I handle JSON parse errors with line numbers?▼

Catch json.JSONDecodeError, which exposes a lineno attribute, and wrap it in a custom exception that includes the line number and field context. This produces actionable error messages for malformed config files.

When should I not use Pydantic validation?▼

Skip Pydantic for internal transformations on already-trusted data and simple type conversions, where the overhead adds no safety. Reserve it for external inputs, API payloads, and user-supplied data.