form-validation-architect
БесплатноЗапускает вложенные скриптыНе проверенEnd-to-end form handling with react-hook-form, Zod schemas, validation patterns, error messaging, field arrays, and multi-step wizards. Use for complex forms…
от curiositech★ 283 звезды на GitHubОб этом скилле
Form Validation Architect
Expert in building production-grade form systems with client-side validation, type safety, and excellent UX.
When to Use
✅ Use for:
- Complex forms with multiple fields and validation rules
- Multi-step wizards with progress tracking
- Dynamic field arrays (add/remove items)
- Form state persistence across sessions
- Async validation (check username availability, validate address)
- Dependent fields (enable B when A is checked)
- File uploads with progress and validation
- Autosave and optimistic updates
❌ NOT for:
- Simple contact forms (HTML + basic JS is fine)
- Backend-only validation (use Joi, Yup on server)
- Non-React frameworks (use Formik alternatives)
- Read-only displays (no form needed)
Quick Decision Tree
Does your form:
├── Have >5 fields? → Use react-hook-form
├── Need type safety? → Add Zod schemas
├── Have dynamic fields? → Use field arrays
├── Span multiple steps? → Use wizard pattern
├── Need async validation? → Use resolver + async rules
└── Just email/message? → Use native HTML validation
Technology Selection (2024+)
React Hook Form (Recommended)
Why RHF over Formik:
- Performance: Uncontrolled inputs → fewer re-renders
- Bundle size: 8KB vs 30KB (Formik)
- DevEx: Better TypeScript support
- Adoption: 40k+ stars, industry standard 2023+
Timeline:
- 2015-2019: Formik dominated
- 2019: React Hook Form released
- 2022+: RHF became standard
- 2024: Formik in maintenance mode
Zod for Schema Validation
Why Zod over Yup:
- TypeScript-first: Infer types from schemas
- Composability: Better schema reuse
- Error messages: More customizable
- Modern: Active development, latest features
Timeline:
- 2017-2020: Yup standard
- 2020: Zod released
- 2023+: Zod preferred for new projects
Common Anti-Patterns
Anti-Pattern 1: Controlled Inputs Everywhere
Novice thinking: "All form inputs should be controlled with useState"
Problem: Causes re-render on every keystroke
Wrong approach:
// ❌ Re-renders entire component on every keystroke
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const [name, setName] = useState('');
// ... 20 more useState calls
<input value={email} onChange={(e) => setEmail(e.target.value)} />
Correct approach:
// ✅ Uncontrolled with react-hook-form (minimal re-renders)
const { register, handleSubmit } = useForm();
<input {...register('email')} />
<input {...register('password')} />
<input {...register('name')} />
Why it matters: Forms with 10+ fields become sluggish with controlled inputs.
Anti-Pattern 2: String-Based Validation
Problem: No type safety, easy to make mistakes
Wrong approach:
// ❌ String validation, no types
const validate = (values) => {
if (!values.email.includes('@')) return 'Invalid email';
if (values.age < 18) return 'Must be 18+';
// Typo in field name? Runtime error!
};
Correct approach:
// ✅ Zod schema with type inference
const schema = z.object({
email: z.string().email('Invalid email'),
age: z.number().min(18, 'Must be 18+'),
username: z.string()
.min(3, 'Too short')
.regex(/^[a-z0-9_]+$/, 'Lowercase, numbers, underscores only')
});
type FormData = z.infer<typeof schema>; // Automatic TypeScript type!
Timeline:
- Pre-2020: String-based validation common
- 2020+: Schema-first validation standard
- 2024: Type inference from schemas expected
Anti-Pattern 3: No Error State Management
Problem: Errors shown before user interacts
Wrong approach:
// ❌ Shows errors immediately on page load
{errors.email && <span>{errors.email}</span>}
Correct approach:
// ✅ Show errors only after field is touched
const { formState: { errors, touchedFields } } = useForm();
{touchedFields.email && errors.email && (
<span className="error">{errors.email.message}</span>
)}
// Or: Use mode="onBlur" to validate on blur
const form = useForm({
mode: 'onBlur' // Validate when user leaves field
});
Why it matters: Better UX → user isn't yelled at before typing
Anti-Pattern 4: No Async Validation
Problem: Can't check username availability, validate addresses, etc.
Correct approach:
// ✅ Async validation with debounce
const schema = z.object({
username: z.string().refine(
async (username) => {
// Debounced API call
const available = await checkUsernameAvailability(username);
return available;
},
{ message: 'Username already taken' }
)
});
// Or: Custom async validation in RHF
register('username', {
validate: {
checkAvailable: async (value) => {
const response = await fetch(`/api/check-username?q=${value}`);
return response.ok || 'Username taken';
}
}
});
Best practice: Debounce async validation to avoi
Установить form-validation-architect в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadWriteEditBash(npm:*)Вложенные файлы
FAQ
Что делает скилл form-validation-architect?
End-to-end form handling with react-hook-form, Zod schemas, validation patterns, error messaging, field arrays, and multi-step wizards. Use for complex forms, validation architecture, autosave, field dependencies. Activate on "form validation", "react-hook-form", "Zod", "form error", "multi-step form", "wizard". NOT for simple HTML forms, backend validation only, or non-React frameworks.
Как установить скилл form-validation-architect?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл form-validation-architect запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic