Request Validation

VerifiedSafe

TypeScript-based input validation for API requests and video data structures. Ensures type safety at API boundaries with type guards and field-specific error messages. Use to validate RenderRequest and RecapBook data in Express handlers.

Sby Skills Guide Bot
DevelopmentIntermediate
3/1/2026
Claude CodeCursorWindsurfCopilotCodex
#typescript#validation#api#type-guards#express

Recommended for

Automated summary

Guides Claude Code in writing server-side TypeScript input validation with type guards for Express request bodies and RenderRequest and RecapBook structures.

Strengths

  • Enforces validation at the API boundary before any processing
  • Gives concrete examples of type guards and field-specific error responses
  • Covers business rules such as month 1-12 and year 2000-2100 bounds
  • Recommends clear error messages that name the offending field

Limitations

  • Focused on Express and TypeScript typing, without external validation libraries like Zod
  • Assumes types live in src/lib/types.ts and the API is server-to-server
  • Does not address query string validation or authentication
When to use it

Use it when setting up or reviewing input validation for TypeScript Express API endpoints.

When not to use it

Skip it if your project already relies on a declarative validator such as Zod or Yup, or if the validation targets a client-side form.

Security analysis

Safe
Quality score82/100

This skill is purely instructional guidance about TypeScript input validation patterns (type guards, request body checks, structured error responses). It declares no tools, contains no executable commands, no network calls, no file operations, and no secrets handling. The examples are standard Express/TypeScript idioms. There is no meaningful execution risk.

No concerns found

How this analysis is made

Examples

Validate render endpoint
Add a type guard and validation to my Express POST /render handler so it rejects invalid month, year, and books fields with a 400 and field-specific errors.
Type guard for RecapBook
Write a TypeScript type guard that checks a RecapBook object for completeness and returns the missing fields in the error response.
Review API validation
Review my Express API handlers and tell me where I'm missing server-side request body validation against my types in src/lib/types.ts.

name: Request Validation description: TypeScript-based input validation for API requests and video data structures. Use this when validating request bodies in Express handlers, implementing type guards, or validating RenderRequest and RecapBook data. Ensures type safety at API boundaries.

Request Validation

This Skill provides Claude Code with specific guidance on how it should handle global validation.

When to use this skill:

  • Validating API request bodies in Express handlers
  • Creating TypeScript type guard functions
  • Checking RenderRequest fields (month, year, books)
  • Validating RecapBook data structure and completeness
  • Implementing field-specific validation logic
  • Returning structured validation error responses

Instructions

  • TypeScript Type Guards: Use TypeScript types and type guards for compile-time and runtime validation
  • Server-Side Validation: All API endpoints must validate request bodies against defined types
  • Fail Early: Validate input at API boundary; reject invalid requests before processing
  • Specific Error Messages: Return clear, field-specific errors: { error: 'Invalid month', field: 'month' }
  • Request Body Validation: Validate RenderRequest fields (month 1-12, year valid, books array structure)
  • Type Safety: Define interfaces in src/lib/types.ts and enforce at API boundaries
  • Business Rule Validation: Validate video constraints (frame counts, durations, book data completeness)
  • No Client-Side Validation: This is a server-to-server API; all validation happens server-side

Examples:

// Good: Type guards, early validation, specific errors
import { RenderRequest, RecapBook } from '@/lib/types';

function isValidRenderRequest(body: any): body is RenderRequest {
  return (
    typeof body.month === 'number' &&
    body.month >= 1 && body.month <= 12 &&
    typeof body.year === 'number' &&
    body.year >= 2000 && body.year <= 2100 &&
    Array.isArray(body.books)
  );
}

app.post('/render', async (req, res) => {
  if (!isValidRenderRequest(req.body)) {
    return res.status(400).json({
      error: 'Invalid request',
      details: 'month (1-12) and year (2000-2100) required'
    });
  }

  const request: RenderRequest = req.body;
  // Now TypeScript knows the shape is correct
});

// Bad: No validation, assumes input is correct
app.post('/render', async (req, res) => {
  const { month, year } = req.body;
  const result = await renderVideo(month, year);
  res.json(result);
});

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/request-validation-mm78no92/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/request-validation-mm78no92' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/request-validation-mm78no92/download' --output '.skill-downloads/request-validation-mm78no92/SKILL.md.part' && mv '.skill-downloads/request-validation-mm78no92/SKILL.md.part' '.skill-downloads/request-validation-mm78no92/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

This file does not provide a usable name/description header for this native procedure. It remains available to download and inspect; use the manual method below.

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/request-validation-mm78no92/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills