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.

16 stars

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

$curl -o ~/.claude/skills/api-request-validation/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/backend/api-request-validation/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/api-request-validation/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How api-request-validation Compares

Feature / Agentapi-request-validationStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/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

16
from diegosouzapw/awesome-omni-skill

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

16
from diegosouzapw/awesome-omni-skill

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

16
from diegosouzapw/awesome-omni-skill

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

16
from diegosouzapw/awesome-omni-skill

Bean Validation (Jakarta Validation) with Spring Boot. Custom validators, validation groups, cross-field validation, and internationalized error messages.

fullstack-validation

16
from diegosouzapw/awesome-omni-skill

Comprehensive validation methodology for multi-component applications including backend, frontend, database, and infrastructure

api-validation

16
from diegosouzapw/awesome-omni-skill

Apply when validating API request inputs: body, query params, path params, and headers. This skill covers Zod v4 patterns.

api-request-builder

16
from diegosouzapw/awesome-omni-skill

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

16
from diegosouzapw/awesome-omni-skill

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

16
from diegosouzapw/awesome-omni-skill

Define and validate API contracts using Zod

api-contract-validation

16
from diegosouzapw/awesome-omni-skill

Detect breaking changes in API contracts (OpenAPI/Swagger specs)

android-playstore-api-validation

16
from diegosouzapw/awesome-omni-skill

Create and run validation script to test Play Store API connection

ai-summary-request

16
from diegosouzapw/awesome-omni-skill

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.