fec-form-handling
Installation
SKILL.md
Form processing
Purpose
Manage form status, verification and submission to avoid lags in complex form input.
Procedure
- First identify the framework, existing form library of the project, schema verification library, component library and complexity; then introduce special form solutions when there are 10+ fields, dynamic fields, linkage verification, file upload, multi-step process or input lag.
- Select according to project stack: React can consider React Hook Form + Zod; Vue can consider vee-validate / FormKit + Zod, Yup or Valibot; simple forms can use the framework's native state and basic verification.
- Use runtime schema or explicit validation functions to guard external input boundaries; TypeScript types can be deduced from the schema, but don’t just write TS types.
- Clarify default values, field registration, controlled/uncontrolled boundaries and component library adaptation; use
aria-invalid,aria-describedbyandrole="alert"for error prompts. - Handle loading, server-side errors, repeated submissions and resets when submitting; use local subscriptions and sub-component isolation to control re-rendering of large forms.