ThinkWithPrompt by SynotticThinkWithPrompt

Design input validation rules for my app

Consistent validation rules for every input across client, server, and database, with security checks, error messages, and tests.

Software DevelopmentRTFStandardCodingCodeFill-in Template

The prompt

Help me design input validation for my application. Tech stack: [frontend, backend language/framework, database] Where data comes in: [forms, API endpoints, file uploads, webhooks, imports] Data model or fields: [PASTE schema, types, or the form/endpoint definitions] Business rules: [e.g. "end date after start date", "quantity 1-100", "unique email per account"] Current validation code (optional): [PASTE] Design validation in layers: 1. Rules table - columns: field, type, required, format/pattern, length or range, allowed values, cross-field rules, normalization (trim, case, Unicode), error message for users. 2. Where each rule lives - client (for fast feedback only), server (the source of truth), database (constraints: NOT NULL, CHECK, UNIQUE, foreign keys). Show how to share one schema between layers where the stack allows. 3. Security checks - allow-lists over block-lists, parameterized queries (never string-built SQL), output encoding against XSS, file upload checks (type by content, size, name), limits on payload size and array lengths, mass-assignment protection. 4. Error handling - consistent error response format, field-level messages, no leaking of internal details. 5. Edge cases to test - empty, whitespace, very long, Unicode and emoji, negative and zero, boundaries, wrong types, duplicates, concurrent submissions. 6. Example code in my stack for one form or endpoint, plus unit tests for its rules. Flag any business rule that is ambiguous instead of guessing.

Highlighted [brackets] are blanks to replace with your own details.

Fill in the blanks and use this promptMore Software Development prompts

What to fill in

  • frontend, backend language/framework, database
  • forms, API endpoints, file uploads, webhooks, imports
  • PASTE schema, types, or the form/endpoint definitions
  • PASTE

How this prompt is built

This prompt follows the RTF structure (Role, Task, Format). RTF tells the model who to be, what to do and what shape the answer should take. It is the quickest structure that still gives noticeably better results than a bare request.

Related prompts

Find more prompts like this