agentsclimarketplace

Request validation

Skill Amey-Thakur/AI-SKILLS/skills/backend/request-validation

Plug-and-play skills and prompts for every AI coding agent

Install
npx -y skills add Amey-Thakur/AI-SKILLS --skill request-validation

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • 21 days oldThe repository was created 21 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
  • 4 stars4 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Validate requests at the boundary with schemas, reject unknown fields, and return errors clients can act on. Use when hardening API input handling or standardizing validation across endpoints.

SKILL.md

2.6 KB, 572 tokens by cl100k_base, as published. Nobody here has run it

Request validation

Validate once, at the edge, into a typed value the rest of the code can trust. Everything past the boundary should be impossible to construct invalid.

Method

  1. Schema-first, one schema per endpoint. Define the request shape declaratively (JSON Schema via OpenAPI, zod, pydantic) and derive both the validator and the documentation from it. Hand-rolled if-chains drift from docs within a sprint.
  2. Parse, don't just check. The validator's output is a typed object (trimmed strings, parsed dates, enum members), not the raw JSON plus a boolean. Downstream code taking dict/any re-validates forever.
  3. Reject unknown fields on writes. A typo'd optional field (descripton) silently accepted is data loss the client discovers weeks later. Strictness on request bodies; tolerance is for what you read from others (be conservative in what you send, but validate what you accept).
  4. Layer the checks. Shape and types (schema), then domain rules (ranges, formats, cross-field: end > start), then stateful rules (uniqueness, existence, permissions) inside the transaction where they are race-free. Shape failures are 400; semantic failures 422; state conflicts 409.
  5. Return all field errors at once, machine-readably. Problem+json with a per-field list: {"errors": [{"field": "email", "code": "format", "message": ...}]}. One-error-at-a-time forces clients into a submit loop; codes let UIs localize (see api-error-responses).
  6. Bound everything. Max body size, max string lengths, max array items, max nesting depth, at the schema and the server config both. Validation that allocates unbounded input first is a DoS vector, not a defense.
  7. Never echo hostile input raw. Error messages include the field name and constraint, not megabytes of the offending value; log the details server-side with the request ID.

Boundaries

  • Validation is not sanitization: reject invalid input rather than mutating it into validity, except for benign normalization (trim, case-fold emails) that is documented.
  • Authorization is not a validation layer concern; a well-formed request for someone else's resource is 404/403 territory decided in the handler (see authz-design).
  • Client-side validation is UX; only the server's validation is a security boundary.

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 326,970. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.