Python Configuration
wshobson/agents
Python configuration management via environment variables and typed settings.
A skill your agent uses when defining request/response schemas, writing custom validators, controlling serialization for PATCH endpoints, validating non-model data with TypeAdapter, or configuring…
$ npx skills add kid-sid/claude-spellbook --skill pydantic -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install kid-sid/claude-spellbook pydantic --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/kid-sid/claude-spellbook.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/pydantic .claude/skills/pydantic && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "pydantic" agent skill from https://github.com/kid-sid/claude-spellbook/tree/main/skills/pydantic into .claude/skills/pydantic/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pydantic", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/kid-sid/claude-spellbook/tree/main/skills/pydanticType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add kid-sid/claude-spellbook --skill pydantic -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install kid-sid/claude-spellbook pydantic --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/kid-sid/claude-spellbook.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/pydantic .agents/skills/pydantic && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "pydantic" agent skill from https://github.com/kid-sid/claude-spellbook/tree/main/skills/pydantic into .agents/skills/pydantic/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pydantic", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add kid-sid/claude-spellbook --skill pydantic -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install kid-sid/claude-spellbook pydantic --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/kid-sid/claude-spellbook.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/pydantic .cursor/skills/pydantic && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "pydantic" agent skill from https://github.com/kid-sid/claude-spellbook/tree/main/skills/pydantic into .cursor/skills/pydantic/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pydantic", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/kid-sid/claude-spellbook.git --path skills/pydantic--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add kid-sid/claude-spellbook --skill pydantic -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install kid-sid/claude-spellbook pydantic --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/kid-sid/claude-spellbook.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/pydantic .gemini/skills/pydantic && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "pydantic" agent skill from https://github.com/kid-sid/claude-spellbook/tree/main/skills/pydantic into .gemini/skills/pydantic/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pydantic", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install kid-sid/claude-spellbook pydanticInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add kid-sid/claude-spellbook --skill pydantic -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/kid-sid/claude-spellbook.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/pydantic .github/skills/pydantic && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "pydantic" agent skill from https://github.com/kid-sid/claude-spellbook/tree/main/skills/pydantic into .github/skills/pydantic/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pydantic", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add kid-sid/claude-spellbook --skill pydantic -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install kid-sid/claude-spellbook pydantic --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/kid-sid/claude-spellbook.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/pydantic .opencode/skills/pydantic && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "pydantic" agent skill from https://github.com/kid-sid/claude-spellbook/tree/main/skills/pydantic into .opencode/skills/pydantic/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pydantic", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
pydanticA skill your agent uses when defining request/response schemas, writing custom validators, controlling serialization for PATCH endpoints, validating non-model data with TypeAdapter, or configuring…
Pydantic is an agent skill from kid-sid/claude-spellbook. Use when defining request/response schemas, writing custom validators, controlling serialization for PATCH endpoints, validating non-model data with TypeAdapter, or configuring app settings from environment variables with pydantic-settings.
Its SKILL.md is about 3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in DevOps & Cloud, covering Secrets management. It works with Pydantic. The repository describes itself as: A curated collection of skills, prompts, and workflows that extend Claude's capabilities — your personal grimoire for AI-powered development. The licence is MIT.
Read from SKILL.md and the folder at commit a7c2ac9. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are python).
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Pydantic loads about 3k tokens when it runs. Until then it costs about 62 tokens; SKILL.md has 415 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check noted patterns worth knowing about, such as sudo or a known installer.
env_file=".env",Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from kid-sid/claude-spellbook at commit a7c2ac9, republished under its MIT licence (© kid-sid). 415 words, ~3,042 tokens.
.claude/skills/pydantic/SKILL.md (or your agent's skills folder).Validation, serialization, and settings management with Pydantic v2.
@field_validator or @model_validator for custom validationAnnotated to build reusable constrained typesmodel_dump() / model_dump_json()TypeAdapterpydantic-settingsfrom pydantic import BaseModel, Field
from datetime import datetime
from uuid import UUID
class User(BaseModel):
id: UUID
name: str
email: str
age: int = Field(ge=0, le=150)
role: str = "user" # default value
created_at: datetime | None = None
# Instantiate
user = User(id="a1b2...", name="Alice", email="alice@example.com", age=30)
# Access
user.name # "Alice"
user.model_fields # dict of FieldInfo
# Validate from dict / JSON
user = User.model_validate({"id": "...", "name": "Alice", ...})
user = User.model_validate_json('{"id": "...", "name": "Alice", ...}')from pydantic import BaseModel, Field
from typing import Annotated
class Product(BaseModel):
name: str = Field(min_length=1, max_length=200, strip_whitespace=True)
price: float = Field(gt=0, description="Price in USD")
discount: float = Field(ge=0, le=1, default=0.0) # 0–100%
tags: list[str] = Field(default_factory=list, max_length=10)
sku: str = Field(pattern=r"^[A-Z]{3}-\d{6}$")
metadata: dict = Field(default_factory=dict)
# Alias — accept "product_name" in input, use "name" in Python
name: str = Field(alias="product_name")Annotatedfrom typing import Annotated
from pydantic import Field
# Define once, reuse everywhere
PositiveInt = Annotated[int, Field(gt=0)]
Percentage = Annotated[float, Field(ge=0.0, le=1.0)]
NonEmptyStr = Annotated[str, Field(min_length=1, strip_whitespace=True)]
EmailStr = Annotated[str, Field(pattern=r"^[^@]+@[^@]+\.[^@]+$")]
UserId = Annotated[str, Field(min_length=36, max_length=36)]
class CreateUserRequest(BaseModel):
name: NonEmptyStr
email: EmailStr
age: PositiveInt
discount: Percentage = 0.0@field_validator — validate / transform a single fieldfrom pydantic import BaseModel, field_validator
class User(BaseModel):
name: str
email: str
role: str
@field_validator("email")
@classmethod
def lowercase_email(cls, v: str) -> str:
return v.strip().lower()
@field_validator("role")
@classmethod
def valid_role(cls, v: str) -> str:
allowed = {"admin", "user", "viewer"}
if v not in allowed:
raise ValueError(f"role must be one of {allowed}")
return v
# Validate multiple fields at once
@field_validator("name", "email", mode="before") # runs before type coercion
@classmethod
def strip_strings(cls, v: str) -> str:
return v.strip() if isinstance(v, str) else vmode="before" runs before type coercion. mode="after" (default) runs after.
@model_validator — validate across multiple fieldsfrom pydantic import BaseModel, model_validator
class DateRange(BaseModel):
start_date: datetime
end_date: datetime
max_days: int = 90
@model_validator(mode="after")
def check_date_range(self) -> "DateRange":
if self.end_date <= self.start_date:
raise ValueError("end_date must be after start_date")
delta = (self.end_date - self.start_date).days
if delta > self.max_days:
raise ValueError(f"Range cannot exceed {self.max_days} days")
return self
class PasswordReset(BaseModel):
password: str
confirm_password: str
@model_validator(mode="after")
def passwords_match(self) -> "PasswordReset":
if self.password != self.confirm_password:
raise ValueError("Passwords do not match")
return self
# mode="before" — receives raw dict, before field validation
@model_validator(mode="before")
@classmethod
def handle_legacy_format(cls, data: dict) -> dict:
if "user_name" in data:
data["name"] = data.pop("user_name") # rename legacy field
return datafrom pydantic import BaseModel, ConfigDict
class UserResponse(BaseModel):
model_config = ConfigDict(
from_attributes=True, # allow ORM model → Pydantic (was orm_mode in v1)
populate_by_name=True, # accept both alias and field name
str_strip_whitespace=True, # strip whitespace from all str fields
str_to_lower=False,
extra="forbid", # reject unknown fields (good for request schemas)
# extra="ignore" # silently drop unknown fields
# extra="allow" # keep unknown fields in __pydantic_extra__
frozen=True, # immutable instances (hashable)
arbitrary_types_allowed=True, # allow non-Pydantic types
json_schema_extra={"example": {"name": "Alice", "email": "alice@example.com"}},
)user = User(id=uuid4(), name="Alice", email="alice@example.com", role="admin")
# To dict
user.model_dump()
user.model_dump(exclude={"password", "internal_id"})
user.model_dump(include={"id", "name", "email"})
user.model_dump(exclude_none=True) # omit None values
user.model_dump(exclude_unset=True) # omit fields not explicitly set (useful for PATCH)
user.model_dump(by_alias=True) # use field aliases as keys
user.model_dump(mode="json") # serialize to JSON-compatible types (UUID → str)
# To JSON string
user.model_dump_json()
user.model_dump_json(indent=2, exclude_none=True)
# From ORM (with from_attributes=True)
orm_user = db.query(UserORM).first()
user = UserResponse.model_validate(orm_user)
# Copy with overrides
updated = user.model_copy(update={"role": "admin"})from pydantic import BaseModel
from typing import Literal, Union, Annotated
from pydantic import Field
class CreditCard(BaseModel):
type: Literal["credit_card"]
number: str
expiry: str
cvv: str
class BankTransfer(BaseModel):
type: Literal["bank_transfer"]
account_number: str
routing_number: str
class Crypto(BaseModel):
type: Literal["crypto"]
wallet_address: str
currency: str
PaymentMethod = Annotated[
Union[CreditCard, BankTransfer, Crypto],
Field(discriminator="type"), # Pydantic uses "type" to pick the right model
]
class Order(BaseModel):
id: str
payment: PaymentMethod
# Pydantic automatically picks the right union member
order = Order.model_validate({
"id": "o-123",
"payment": {"type": "credit_card", "number": "4111...", "expiry": "12/26", "cvv": "123"},
})
isinstance(order.payment, CreditCard) # Truefrom pydantic import BaseModel
from typing import TypeVar, Generic
T = TypeVar("T")
class Page(BaseModel, Generic[T]):
items: list[T]
total: int
page: int
page_size: int
has_next: bool
class ApiResponse(BaseModel, Generic[T]):
data: T
status: int = 200
message: str = "ok"
# Concrete usage — fully typed
users_page: Page[User] = Page[User](items=[...], total=100, page=1, page_size=20, has_next=True)
response: ApiResponse[User] = ApiResponse[User](data=user)from pydantic import TypeAdapter
# Validate a plain type or complex type
ta = TypeAdapter(list[int])
ta.validate_python([1, 2, "3"]) # [1, 2, 3] — coerces "3" to 3
ta.validate_json("[1, 2, 3]")
# Validate arbitrary dict shape
ta = TypeAdapter(dict[str, list[int]])
ta.validate_python({"a": [1, 2], "b": [3]})
# Great for validating webhook payloads, external API responses
StrippedStr = Annotated[str, Field(strip_whitespace=True, min_length=1)]
ta = TypeAdapter(StrippedStr)
ta.validate_python(" hello ") # "hello"from pydantic_settings import BaseSettings, SettingsConfigDict
from pydantic import Field
from functools import lru_cache
class Settings(BaseSettings):
model_config = SettingsConfigDict(
env_file=".env",
env_file_encoding="utf-8",
case_sensitive=False,
extra="ignore",
)
# Required — raises if missing from env
database_url: str
secret_key: str
# Optional with defaults
environment: str = "development"
debug: bool = False
redis_url: str = "redis://localhost:6379"
allowed_origins: list[str] = ["http://localhost:3000"]
# Nested prefix: reads TEMPORAL__ADDRESS from env
temporal_address: str = Field("localhost:7233", alias="TEMPORAL_ADDRESS")
@property
def is_production(self) -> bool:
return self.environment == "production"
@lru_cache
def get_settings() -> Settings:
return Settings()
settings = get_settings() # cached singletonEnv var names match field names case-insensitively. list[str] reads from ALLOWED_ORIGINS=http://a.com,http://b.com (comma-separated).
default_factory — tags: list[str] = [] shares the same list object across all instances; use tags: list[str] = Field(default_factory=list) for any mutable defaultmodel_dump(exclude_unset=True) for PATCH — model_dump() on a partial-update model includes all fields set to their defaults, overwriting database values the client never sent; exclude_unset=True returns only the fields the caller explicitly providedorm_mode = True (v1 syntax) in a v2 project — the v1 config key is silently ignored in Pydantic v2; use model_config = ConfigDict(from_attributes=True) insteadException from model_validate — validation errors from Pydantic are ValidationError, not ValueError or Exception; catching the wrong type means bad input crashes the caller with an unhandled exception instead of a structured error responsemodel_dump() when JSON-safe types are needed — model_dump() returns Python objects (UUID, datetime, Decimal) that are not JSON-serializable; use model_dump(mode="json") or model_dump_json() when the result will be serialized to JSON or stored as a dict in MongoDBField(gt=0) on every model instead of Annotated types — duplicating constraints is error-prone and hard to update; define PositiveInt = Annotated[int, Field(gt=0)] once and reuse it everywhereAnnotated used to define reusable constrained types (not repeating Field() everywhere)@field_validator with mode="before" for input normalization (strip, lowercase)@model_validator for cross-field validation (date ranges, password confirm)from_attributes=True in ConfigDict for ORM → schema conversionextra="forbid" on request schemas to reject unknown inputmodel_dump(exclude_unset=True) for PATCH endpoints (only update what was sent)model_dump(mode="json") when serializing UUIDs/datetimes to dictsTypeAdapter for validating non-model types (lists, dicts, scalars)pydantic-settings for all environment variable config (not raw os.environ)@lru_cache on get_settings() — load once, reuse© kid-sid, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in skills/pydantic of kid-sid/claude-spellbook.
Open the folder on GitHubat commit a7c2ac9
Pydantic next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Pydantic this skillkid-sid/claude-spellbook | 189 | — | ~3k | Automated safety check: Notes | MIT | |
| Python Configurationwshobson/agents | 40k | — | ~1.6k | Automated safety check: Notes | MIT | |
| Specx Settingsmaksimzayats/specx | 202 | — | ~707 | Automated safety check: Notes | MIT | |
| Env Configaiskillstore/marketplace | 430 | — | ~2.3k | Automated safety check: Notes | None | |
| Iron Proxy Gateway for NanoClawnanocoai/nanoclaw | 31k | — | ~4.6k | Automated safety check: Notes | MIT | |
| LangBot Deployment Guidelangbot-app/LangBot | 18k | — | ~1.2k | Automated safety check: Notes | Apache-2.0 |
wshobson/agents
Python configuration management via environment variables and typed settings.
maksimzayats/specx
Add runtime configuration to specx Python services with pydantic-settings.
aiskillstore/marketplace
A skill your agent uses when setting up environment configuration, loading .env files, or managing application settings across environments.
nanocoai/nanoclaw
Installs or refreshes Iron Proxy and its Iron Control web console for NanoClaw, with a local Docker setup, database, credentials and a human approval bridge.
langbot-app/LangBot
Deploys and configures a LangBot instance with Docker Compose or Kubernetes, covering config.yaml, the Box sandbox runtime, the plugin runtime and the global API key.
sgl-project/sglang
Conventions for SGLang environment variables — where to define, how to access, how to name, and how to deprecate.
kid-sid/claude-spellbook
A skill your agent uses when building or reviewing UI components for keyboard and screen reader compatibility, adding ARIA to custom widgets, auditing a page for WCAG AA conformance, or preparing…
kid-sid/claude-spellbook
A skill your agent uses when building, wiring, or debugging an Agentex agent — choosing agent type, configuring acp.py and manifest.yaml, using adk.messages or adk.state, or resolving…
kid-sid/claude-spellbook
A skill your agent uses when building production LLM applications — designing RAG pipelines, choosing vector databases, implementing agent orchestration, optimizing cost, or adding AI safety…
kid-sid/claude-spellbook
A skill your agent uses when building or refactoring Angular applications — choosing between signals, RxJS, and NgRx for state, configuring routing with guards and lazy loading, optimizing change…
kid-sid/claude-spellbook
A skill your agent uses when designing new REST endpoints, reviewing an existing API contract, adding pagination or filtering, planning a versioning strategy, or building a public or partner-facing…
kid-sid/claude-spellbook
A skill your agent uses when implementing login flows, issuing or validating JWTs, setting up OAuth2/OIDC with a provider, designing role-based or attribute-based access control, securing API…
Works with
Categories
A skill your agent uses when defining request/response schemas, writing custom validators, controlling serialization for PATCH endpoints, validating non-model data with TypeAdapter, or configuring…. Pydantic is an agent skill from kid-sid/claude-spellbook. Use when defining request/response schemas, writing custom validators, controlling serialization for PATCH endpoints, validating non-model data with TypeAdapter, or configuring app settings from environment variables with pydantic-settings.
Pydantic fits situations like: defining request/response schemas; writing custom validators; controlling serialization for PATCH endpoints; validating non-model data with TypeAdapter.
Run `npx skills add kid-sid/claude-spellbook --skill pydantic -a claude-code`. Or copy the skill folder (skills/pydantic in kid-sid/claude-spellbook) into .claude/skills/pydantic in your project. Claude Code loads it when a task matches its description.
Run `npx skills add kid-sid/claude-spellbook --skill pydantic -a codex`. Or copy the skill folder (skills/pydantic in kid-sid/claude-spellbook) into .agents/skills/pydantic in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add kid-sid/claude-spellbook --skill pydantic -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/pydantic, .gemini/skills/pydantic, .github/skills/pydantic and .opencode/skills/pydantic in your project.
SKILL.md names no scripts, command-line tools or credentials: Pydantic is instructions for the agent only. Our summary lists: Python 3.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found notes only (mentions a .env file), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.
Pydantic is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 3k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Pydantic: Python Configuration (wshobson/agents, 40k stars), Specx Settings (maksimzayats/specx, 202 stars), Env Config (aiskillstore/marketplace, 430 stars) and Iron Proxy Gateway for NanoClaw (nanocoai/nanoclaw, 31k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
kid-sid (a GitHub user) maintains it in kid-sid/claude-spellbook, which has 189 GitHub stars. The repository holds 52 skills in this directory. The repository was last updated on August 5, 2026.
Source: kid-sid/claude-spellbook on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.