Agent skill · Code Review & Quality

pydantic-ai-agents

Build and debug Pydantic AI agents using best practices for dependencies, dynamic system prompts, tools, and structured output validation. Use when the user wants to: (1) Create a new Pydantic AI agent, (2) Debug or fix an existing agent, (3) Add features like tools, validators, or dynamic prompts, (4) Integrate OpenRouter for multi-model access, (5) Add Logfire for debugging/observability, (6) Structure agent architecture with dependency injection.

majiayu000github.com/majiayu000GitHub ↗
claude-codeMIT
Install
npx skills add majiayu000/claude-skill-registry --skill pydantic-ai-agents --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 2
SKILL.md size: 10 KB
Bundled scripts: none
Path: skills/ai-llm/pydantic-ai-agents/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 534
Language: HTML

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# Pydantic AI Reference Skill ## Pydantic AI Developer Guide ### 0. Environment Setup Store API keys in a `.env` file and add it to `.gitignore`: ``` OPENAI_API_KEY=your_key OPENROUTER_API_KEY=your_key LOGFIRE_API_KEY=your_key ``` Load with `python-dotenv`: `load_dotenv()`. Never hardcode keys in source code. ### 1. Core Architecture Pydantic AI agents have four key components: #### Dependencies (deps): - **Reference**: `references/01_dependencies.py` - Use dataclasses to hold API keys, database connections, and user context - Never use global variables for state #### System Prompts (system_prompt): - **Reference**: `references/02_prompts.py` - Make prompts dynamic using `@agent.system_prompt` decorator - Inject data from `ctx.deps` into the prompt string #### Tools (@agent.tool): - **Reference**: `references/03_tools.py` - **IMPORTANT**: When `deps_type` is set on the agent, ALL tools must have `ctx: RunContext` as first parameter - even if they don't use it - Use `ctx.deps` to access injected dependencies #### Validators (output_type): - **Reference**: `references/04_validators.py` - Use Pydantic models to enforce structured output - Use `@field_validator` for logic checks ### 2.

What's inside
Steps it walks through
  1. Pydantic AI Developer Guide
  2. 0. Environment Setup
  3. 1. Core Architecture
  4. 2. Promoting Instructions (System Prompt Engineering)
  5. 3. OpenRouter Integration
  6. 4. Debugging with Logfire
  7. 5. Advanced Patterns
  8. 6. Conversation History (Persistent Memory)
  9. 7. Testing Best Practices
  10. 8. Usage
  11. 9. Complete Example
Ships with 1 file
  • metadata.json
More from claude-skill-registry
All skills →
About this skill
What does the pydantic-ai-agents skill do?

Build and debug Pydantic AI agents using best practices for dependencies, dynamic system prompts, tools, and structured output validation. Use when the user wants to: (1) Create a new Pydantic AI agent, (2) Debug or fix an existing agent, (3) Add features like tools, validators, or dynamic prompts, (4) Integrate OpenRouter for multi-model access, (5) Add Logfire for debugging/observability, (6) Structure agent architecture with dependency injection.

How do I install it?

Run `npx skills add majiayu000/claude-skill-registry --skill pydantic-ai-agents --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going