File contents Form Validation
Table of Contents
Overview
Implement comprehensive form validation including client-side validation, server-side synchronization, and real-time error feedback with TypeScript type safety.
When to Use
User input validation
Form submission handling
Real-time error feedback
Complex validation rules
Multi-step forms
Quick Start
Minimal working example:
// types/form.ts
export interface LoginFormData {
email: string;
password: string;
rememberMe: boolean;
}
export interface RegisterFormData {
email: string;
password: string;
confirmPassword: string;
name: string;
terms: boolean;
}
// components/LoginForm.tsx
import { useForm, SubmitHandler } from 'react-hook-form';
import { LoginFormData } from '../types/form';
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
export const LoginForm: React.FC = () => {
const {
register,
handleSubmit,
// ... (see reference guides for full implementation)
Reference Guides
Detailed implementations in the references/ directory:
Guide
Contents
React Hook Form with TypeScript
React Hook Form with TypeScript
Formik with Yup Validation
Formik with Yup Validation
Vue Vee-Validate
Vue Vee-Validate
Custom Validator Hook
Custom Validator Hook
Server-Side Validation Integration
Server-Side Validation Integration
Best Practices
✅ DO
Follow established patterns and conventions
Write clean, maintainable code
Add appropriate documentation
Test thoroughly before deploying
❌ DON'T
Skip testing or validation
Ignore error handling
Hard-code configuration values
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1 --- 2 name: aj-geddes-useful-ai-prompts-form-validation 3 description: Form Validation 4 --- 5 6 # Form Validation 7 8 ## Table of Contents 9 10 - [Overview](#overview) 11 - [When to Use](#when-to-use) 12 - [Quick Start](#quick-start) 13 - [Reference Guides](#reference-guides) 14 - [Best Practices](#best-practices) 15 16 ## Overview 17 18 Implement comprehensive form validation including client-side validation, server-side synchronization, and real-time error feedback with TypeScript type safety. 19 20 ## When to Use 21 22 - User input validation 23 - Form submission handling 24 - Real-time error feedback 25 - Complex validation rules 26 - Multi-step forms 27 28 ## Quick Start 29 30 Minimal working example: 31 32 ```typescript 33 // types/form.ts 34 export interface LoginFormData { 35 email: string; 36 password: string; 37 rememberMe: boolean; 38 } 39 40 export interface RegisterFormData { 41 email: string; 42 password: string; 43 confirmPassword: string; 44 name: string; 45 terms: boolean; 46 } 47 48 // components/LoginForm.tsx 49 import { useForm, SubmitHandler } from 'react-hook-form'; 50 import { LoginFormData } from '../types/form'; 51 52 const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; 53 54 export const LoginForm: React.FC = () => { 55 const { 56 register, 57 handleSubmit, 58 // ... (see reference guides for full implementation) 59 ``` 60 61 ## Reference Guides 62 63 Detailed implementations in the `references/` directory: 64 65 | Guide | Contents | 66 |---|---| 67 | [React Hook Form with TypeScript](references/react-hook-form-with-typescript.md) | React Hook Form with TypeScript | 68 | [Formik with Yup Validation](references/formik-with-yup-validation.md) | Formik with Yup Validation | 69 | [Vue Vee-Validate](references/vue-vee-validate.md) | Vue Vee-Validate | 70 | [Custom Validator Hook](references/custom-validator-hook.md) | Custom Validator Hook | 71 | [Server-Side Validation Integration](references/server-side-validation-integration.md) | Server-Side Validation Integration | 72 73 ## Best Practices 74 75 ### ✅ DO 76 77 - Follow established patterns and conventions 78 - Write clean, maintainable code 79 - Add appropriate documentation 80 - Test thoroughly before deploying 81 82 ### ❌ DON'T 83 84 - Skip testing or validation 85 - Ignore error handling 86 - Hard-code configuration values 87 88 --- 89 > Converted and distributed by [TomeVault](https://tomevault.io/claim/aj-geddes) — claim your Tome and manage your conversions. 90 <!-- tomevault:4.0:skill_md:2026-04-11 -->
tomevault-io/skills-registry/tree/main/aj-geddes--useful-ai-prompts--form-validation commit 4f9550e4f7
Frequently asked questions How do I install the Aj Geddes Useful AI Prompts Form Validation skill? Run npx skillmds@latest add tomevault-io/aj-geddes-useful-ai-prompts-form-validation in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
What does the Aj Geddes Useful AI Prompts Form Validation skill do? Form Validation It is listed under Coding & Dev Tools on SkillMD.
Is Aj Geddes Useful AI Prompts Form Validation safe to use? This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
Which AI agents work with Aj Geddes Useful AI Prompts Form Validation? This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Is Aj Geddes Useful AI Prompts Form Validation free to use? Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
Who published Aj Geddes Useful AI Prompts Form Validation? tomevault-io (@tomevault-io) published this skill. Their other Agent Skills are listed on their SkillMD profile.