python-values-success

Build proven Pydantic domain data shapes including scalars, value objects, concept models, collections, and unions.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pydantic.

What problem does it solve? Python domain models often rely on bare primitives, mutable dataclasses, and scattered string literals that carry no proof of validity, forcing defensive checks throughout the codebase. This Skill provides five proven construction patterns so every domain value is valid by construction. ## Core Features & Use Cases - Semantic Scalars: Wrap primitives in frozen RootModel types with Field constraints or documented openness, replacing bare str/int fields. - Value Objects & Concept Models: Compose scalars into frozen BaseModel structures with reparameterized cross-field relations instead of validators. - Collections & Unions: Build proven tuple/dict collections with query models, and discriminated unions with pinned kind literals replacing match/if-elif ladders. - Use Case: When modeling a trading system, use this Skill to define Price, Quantity, Fill, and an OrderOutcome union so invalid states like inverted spreads or missing kinds have no representation. ## Quick Start Ask the AI to model your domain data using the values patterns, for example: replace my bare string and Optional fields with proven semantic scalars and discriminated union variants.

Frequently Asked Questions about python-values-success

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

FAQPage Schema
How do I model domain values in Python with Pydantic?▼

Wrap each primitive in a frozen RootModel with a Field constraint stating the domain bound, such as Price over Decimal with gt=0. Compose scalars into frozen BaseModel value objects and concept models so every value is proven at construction.

How to replace Optional fields in Pydantic domain models?▼

Never use T | None fields in domain models. Model meaningful absence as a union variant named for what absence means, or use a defaulted field whose default states what omission means when lifting foreign data.

When should I use a discriminated union instead of an enum in Python?▼

Use a discriminated union when any member of a vocabulary needs a field or behavior its siblings lack. Each variant pins one StrEnum member with kind: Literal[Axis.MEMBER], and the alias Annotated[A | B, Field(discriminator="kind")] constructs it.

Does this approach work with dataclasses or TypedDict?▼

No, dataclasses, NamedTuple, and TypedDict are replaced forms because they carry shape without construction proof. The skill requires frozen Pydantic BaseModel or RootModel types with extra="forbid" so invalid states have no representation.

Why avoid validators for cross-field relations in Pydantic models?▼

A validator asserting a relation between fields performs a check after construction instead of proving the value. Reparameterize the relation into one constrained field plus a derivation, so an invalid combination like an inverted spread cannot be constructed.