python-adapters-failure

Detects hand-rolled boundary crossings in Python code that bypass Pydantic adapter constructs.

Updated Jul 15, 2026
One-click install
npx skills add https://github.com/kyzobuild/kyzo-python --skill python-adapters-failure-kyzobuild
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: python-adapters-failure
Source: https://github.com/kyzobuild/kyzo-python/tree/main/cursor/skills/python-adapters-failure
Command: npx skills add https://github.com/kyzobuild/kyzo-python --skill python-adapters-failure-kyzobuild

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Boundary crossings in Python applications often get hand-rolled through before-validators, broad try/except blocks, and premature serialization instead of being built as proper foreign models, contract models, or ordered unions, producing unproven data inside the domain. ## Core Features & Use Cases - Pre-construction munging detection: Flags before-validators that index, rename, route, or compute on raw foreign data instead of using Field(alias=...), validation_alias, AliasPath, or nested foreign models. - Swallowed failure detection: Identifies try/except blocks catching Exception or ValidationError, or running multi-statement except bodies, instead of letting proof failures propagate or capturing declared exceptions into an ordered union. - Serialization placement enforcement: Catches .model_dump and .model_dump_json calls outside the two legal sites, the route reply in api/ and the client binding in service/. - Use Case: While reviewing a trading service, the Skill flags a verb that publishes self.latest.model_dump() to a message bus and directs the author to publish the whole value and let the binding serialize at the wire. ## Quick Start Review this Python module for hand-rolled boundary crossings such as data-fixing before-validators, broad exception catching, or model_dump calls outside route replies and client bindings.

Frequently Asked Questions about python-adapters-failure

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

FAQPage Schema
How do I handle key renames in Pydantic incoming data?▼

Use Field(alias="px") on the target field instead of a before-validator that pops and reassigns keys. For data wrapped at one key use validation_alias, and for nested wrappers use AliasPath with the wrapper modeled and never indexed past.

When is a Pydantic before-validator acceptable?▼

The only legal before-validator is the ordered union's wrap: a single line on the failure variant placing the bare input under its field name so variants can be attempted. One return, constant keys, the input as every value.

Should I catch ValidationError in Python domain code?▼

No. A construction refusal proves nothing and must propagate; catching ValidationError manufactures an unproven value. A domain no is modeled as a value through an ordered union, capturing declared exceptions in a verb and constructing from that variable.

Where can I call model_dump in a Python application?▼

Only at the two edge sites: the route reply in api/ and the client binding in service/. Inside concept models, derivations, verbs, or the consistency model, values move whole and the binding serializes at the wire.

Why is catching Exception in adapter code a failure pattern?▼

A try/except wider than the single capture form turns failure into procedure and erases the distinction between a domain no and a proof failure. Let proof failures propagate, or capture each declared exception into one variable and feed the ordered union's constructor.