api-request-validation
A skill for implementing robust API request validation in Python web frameworks like FastAPI using Pydantic. Covers Pydantic models, custom validators (email, password), field-level and cross-field validation, query/file validation, and structured error responses. Use when you need to validate incoming API requests.
Best use case
api-request-validation is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
A skill for implementing robust API request validation in Python web frameworks like FastAPI using Pydantic. Covers Pydantic models, custom validators (email, password), field-level and cross-field validation, query/file validation, and structured error responses. Use when you need to validate incoming API requests.
Teams using api-request-validation should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/api-request-validation/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How api-request-validation Compares
| Feature / Agent | api-request-validation | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
A skill for implementing robust API request validation in Python web frameworks like FastAPI using Pydantic. Covers Pydantic models, custom validators (email, password), field-level and cross-field validation, query/file validation, and structured error responses. Use when you need to validate incoming API requests.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# API Request Validation Skill ## Overview This skill provides guidance and reusable components for implementing robust API request validation in Python, primarily using FastAPI and Pydantic. It covers: - Basic validation with Pydantic models. - Custom validation logic for specific fields. - Advanced validation scenarios like cross-field validation and query parameters. - Standardized error handling for validation failures. ## Getting Started The most common validation tasks are broken down into reference files. Start with the one that best fits your needs. - **Basic Validation**: If you're new to Pydantic or need to validate a simple data structure, see `references/pydantic-models.md`. - **Custom Rules**: For validating specific formats like emails or password strength, see `references/custom-validators.md`. - **Complex Scenarios**: For validating query parameters, file uploads, or dependencies between fields, see `references/advanced-validation.md`. - **Error Responses**: To customize how validation errors are returned to the client, see `references/error-handling.md`. ## Resources ### `references/` - **`pydantic-models.md`**: Guide to creating basic Pydantic models for request body validation. - **`custom-validators.md`**: How to write custom validator functions for fields. - **`advanced-validation.md`**: Covers cross-field validation, query parameters, and file uploads. - **`error-handling.md`**: Instructions for creating a custom FastAPI exception handler for validation errors. ### `scripts/` - **`validators.py`**: A collection of reusable Pydantic validator functions (e.g., for email, password strength). - **`error_handler.py`**: A pre-built FastAPI exception handler for `RequestValidationError`. - **`main_example.py`**: A full FastAPI application demonstrating all validation techniques covered in this skill. You can run this file to see the validation in action.
Related Skills
creating-pull-request
Create a high-quality PR end-to-end with automated lifecycle loop (pre-checks, branch/commit, PR metadata, review handling, CI fixes) based on TileOPs workflow
bio-alignment-validation
Validate alignment quality with insert size distribution, proper pairing rates, GC bias, strand balance, and other post-alignment metrics. Use when verifying alignment data quality before variant calling or quantification.
date-validation
Use when editing Planning Hubs, timelines, calendars, or any file with day-name + date combinations (Wed Nov 12), relative dates (tomorrow), or countdowns (18 days until) - validates day-of-week accuracy, relative date calculations, and countdown math with two-source ground truth verification before allowing edits
spring-validation
Bean Validation (Jakarta Validation) with Spring Boot. Custom validators, validation groups, cross-field validation, and internationalized error messages.
fullstack-validation
Comprehensive validation methodology for multi-component applications including backend, frontend, database, and infrastructure
api-validation
Apply when validating API request inputs: body, query params, path params, and headers. This skill covers Zod v4 patterns.
api-request-builder
Build a basic HTTP request (curl or fetch) for an API. Use when a junior developer needs a quick request example.
api-contracts-and-zod-validation
Generate Zod schemas and TypeScript types for forms, API routes, and Server Actions with runtime validation. Use this skill when creating API contracts, validating request/response payloads, generating form schemas, adding input validation to Server Actions or route handlers, or ensuring type safety across client-server boundaries. Trigger terms include zod, schema, validation, API contract, form validation, type inference, runtime validation, parse, safeParse, input validation, request validation, Server Action validation.
api-contracts-and-validation
Define and validate API contracts using Zod
api-contract-validation
Detect breaking changes in API contracts (OpenAPI/Swagger specs)
android-playstore-api-validation
Create and run validation script to test Play Store API connection
ai-summary-request
Adds an "AI Summary Request" footer component with clickable AI platform icons (ChatGPT, Claude, Gemini, Grok, Perplexity) that pre-populate prompts for users to get AI summaries of the website. Optionally creates an llms.txt file for enhanced AI discoverability. Use when users want to add AI platform integration buttons or make their website AI-friendly.