fabrico-implementing-forms
Skill2 starsChanged 4 months agoMITView on GitHub
Form architecture, schema-based validation, field composition, error handling, multi-step form flows, and accessible form patterns. Use when building forms, implementing validation, creating multi-step wizards, or integrating form fields with a component library.
In this repository42 other files it gives its agents.
- docs/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- fabrico-architecture-designingSkill
- fabrico-building-admin-dashboardsSkill
- fabrico-building-admin-resourcesSkill
- fabrico-building-lean-applicationsSkill
- fabrico-codebase-analysingSkill
- fabrico-code-reviewingSkill
- fabrico-creating-agentsSkill
- fabrico-creating-instructionsSkill
- fabrico-creating-promptsSkill
- fabrico-creating-skillsSkill
- fabrico-designing-multi-cloud-architectureSkill
- fabrico-e2e-testingSkill
- fabrico-engineering-promptsSkill
- fabrico-ensuring-accessibilitySkill
- fabrico-implementation-gap-analysingSkill
- fabrico-implementing-backendSkill
- fabrico-implementing-ci-cdSkill
- fabrico-implementing-frontendSkill
- fabrico-implementing-kubernetesSkill
- fabrico-implementing-observabilitySkill
- fabrico-implementing-terraform-modulesSkill
- fabrico-improving-codebasesSkill
- fabrico-improving-uiSkill
- fabrico-jira-task-formattingSkill
- fabrico-managing-secretsSkill
- fabrico-optimizing-cloud-costSkill
- fabrico-optimizing-frontendSkill
- fabrico-planning-migrationSkill
- fabrico-preparing-applications-for-aiSkill
- fabrico-preparing-applications-for-saasSkill
- fabrico-reverse-engineering-specSkill
- fabrico-reviewing-frontendSkill
- fabrico-sql-and-database-understandingSkill
- fabrico-task-analysingSkill
- fabrico-task-extractingSkill
- fabrico-task-quality-reviewingSkill
- fabrico-technical-context-discoveringSkill
- fabrico-transcript-processingSkill
- fabrico-ui-verifyingSkill
- fabrico-writing-hooksSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 6 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 28
Use the checklist below and track progress:
- Distinctive: line 44
Document any async validation rules (e.g., "check if username is available") — these run on blur or submit, never on every keystroke.
- Distinctive: line 48
Create composable field wrapper components that connect the form library's state to the component library's inputs.
- Very specific: line 66
Add novalidate attribute to the <form> element when using custom validation — this disables browser-native validation bubbles that conflict …
- Distinctive: line 69
If invalid — display errors and focus the first invalid field.
- Distinctive: line 70
If valid — transform data if needed (trim strings, format dates), then call the submit handler.
- Very specific: line 75
Ensure the form is submittable via the Enter key (native <form> behavior — do not break it with preventDefault on the wrong element).
- Distinctive: line 79
When a form spans multiple steps or pages:
- Very specific: line 90
Use the fabrico-ensuring-accessibility skill for a thorough audit.
- Very specific: line 92
Every <input>, <select>, and <textarea> has an associated <label> element (via for/id pairing or wrapping).
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Implementing Forms
Provides patterns and workflows for building robust, accessible forms with schema-based validation, composable field components, and multi-step form flows.
<principles><schema-first-validation>
Define validation rules as a separate schema, co-located with but decoupled from UI code. The schema is the single source of truth for what constitutes valid data. Infer TypeScript types from schemas to eliminate drift between validation rules and form types. Never duplicate type definitions manually — derive them from the schema.
</schema-first-validation><progressive-disclosure-of-errors>
Show validation errors at the right moment: on field blur or form submission, not on every keystroke. Help users fix errors rather than frustrate them with premature feedback. After the first validation pass, switch to on-change validation so users see errors clear as they correct them.
</progressive-disclosure-of-errors><accessible-by-default>
Every form field must have a visible label. Error messages must be announced to screen readers via `role="alert"` or `aria-live` regions. The form must be fully navigable by keyboard alone — Tab through fields, Enter to submit, Escape to cancel where applicable. Associate error messages with their fields using `aria-describedby`.
</accessible-by-default></principles>Form Implementation Process
Use the checklist below and track progress:
Progress:
- [ ] Step 1: Define the data model
- [ ] Step 2: Build field components
- [ ] Step 3: Compose the form
- [ ] Step 4: Handle multi-step flows (if applicable)
- [ ] Step 5: Verify accessibilityStep 1: Define the data model
- Identify all fields: names, types, required vs. optional, default values.
- Define a validation schema in a co-located file (
*.schema.tsorvalidation/directory). The schema declares every constraint: required fields, min/max lengths, patterns, custom rules, cross-field dependencies. - Infer the form's TypeScript type directly from the schema — do not write a separate interface that duplicates the schema's structure.
- Document any async validation rules (e.g., "check if username is available") — these run on blur or submit, never on every keystroke.
Step 2: Build field components
Create composable field wrapper components that connect the form library's state to the component library's inputs. Each field wrapper:
- Receives the field name (and optionally the form context) as props.
- Renders a visible
<label>, the input element, and an error message container. - Reads touched/dirty/error state from the form library and reflects it in the UI.
- Sets accessibility attributes:
aria-invalid="true"when the field has an error.aria-describedbypointing to the error message element'sid.aria-required="true"for required fields.
- Supports all relevant input types: text, select, checkbox, radio, textarea, date, file upload.
- For file inputs: hide the native
<input type="file">visually and use a styled trigger button witharia-label. Display selected file name(s), size, and a remove action. Validate file type and size in the schema — reject invalid files before upload begins. - Keeps the wrapper generic — the same field component works for different forms by accepting the field name as a parameter.
Step 3: Compose the form
Assemble field components into a form:
- Wrap field components with the form library's provider/context so fields can access form state.
- Add
novalidateattribute to the<form>element when using custom validation — this disables browser-native validation bubbles that conflict with the form library's error display. The schema-based validation from Step 1 replaces the browser's built-in constraints. - Handle submission flow:
- Validate all fields against the schema.
- If invalid — display errors and focus the first invalid field.
- If valid — transform data if needed (trim strings, format dates), then call the submit handler.
- During async submission: disable the submit button and show a loading indicator.
- On success — navigate, show confirmation, or reset form as appropriate.
- On server error — map API error responses to specific form fields where possible. Display unmapped errors as a form-level message.
- Prevent double submission by disabling the submit button while a submission is in flight.
- Ensure the form is submittable via the Enter key (native
<form>behavior — do not break it withpreventDefaulton the wrong element).
Step 4: Handle multi-step flows (if applicable)
When a form spans multiple steps or pages:
- Split the form into discrete steps, each with its own validation schema. Only validate the fields visible in the current step.
- Persist state across steps using form-level state (component state or a store) — not URL parameters. Users must not lose data when navigating between steps.
- Validate the current step before allowing navigation to the next step. Show errors on the current step, do not allow skipping ahead past invalid steps.
- Allow back-navigation without losing previously entered data.
- Show a progress indicator (stepper, progress bar, or step labels) so users know where they are and how many steps remain.
- On the final step, submit all accumulated data from all steps together.
Step 5: Verify accessibility
Use the fabrico-ensuring-accessibility skill for a thorough audit. At minimum, verify:
- Every
<input>,<select>, and<textarea>has an associated<label>element (viafor/idpairing or wrapping). - Error messages use
role="alert"or are in anaria-live="polite"region so screen readers announce them. - Tab order follows the visual layout — no unexpected focus jumps.
- The form can be submitted by pressing Enter in a text field.
- Focus moves to the first invalid field after a failed submission attempt.
- Required fields are indicated both visually (e.g., asterisk) and programmatically (
aria-required).
Validation Timing
| Validation mode | When to use | Behavior |
| On submit | Simple forms, few fields | Validate all fields on submit, show all errors at once |
| On blur | Complex forms, many required fields | Validate each field when the user leaves it |
| On change (with debounce) | Real-time feedback needed (password strength, username availability) | Validate as user types, debounced to avoid excessive checks |
| Mixed | Best UX for most forms | Validate on blur initially; after the first error, switch to on-change so errors clear immediately when corrected |
Error Display Patterns
| Pattern | Description |
| Inline below field | Error message directly under the invalid field — most common, recommended default |
| Summary at top | List of all errors at the top of the form — useful for long forms, aids screen readers |
| Inline + summary | Both inline and summary — best accessibility (screen reader reads summary, sighted users see inline) |
| Toast/notification | Only for server-side submission errors, never for field-level validation |
Form Checklist
Form:
- [ ] Validation schema defined separately from UI
- [ ] TypeScript type inferred from schema (no manual duplication)
- [ ] Every field has a visible label
- [ ] Error messages shown inline below fields
- [ ] Errors announced to screen readers (role="alert" or aria-live)
- [ ] Submit button disabled during submission
- [ ] Server-side errors mapped to specific fields
- [ ] Tab order follows visual layout
- [ ] Form submittable via Enter key
- [ ] Loading state during async submissionAnti-Patterns
| Anti-Pattern | Instead Do |
| Manual validation in event handlers | Use a schema-based validation library |
| Duplicating types between schema and form | Infer types from the schema |
| Showing errors on every keystroke | Use blur or mixed-mode validation |
| Unlabeled inputs (placeholder as label) | Always use visible <label> elements |
| Generic "Form has errors" message | Specific per-field error messages |
| Losing form data on back-navigation | Persist state across steps |
| Ignoring server-side errors | Map API errors to specific form fields |
| Submit button without loading state | Disable button + show spinner during submission |
Connected Skills
fabrico-building-admin-resources— for Laravel admin CRUD resource contracts, shadcn-vue field rendering, TanStack tables, and deciding when JSON schemas belong in MySQLfabrico-implementing-frontend— for component composition patterns and framework-specific references (form library integration, validation library choice)fabrico-ensuring-accessibility— for WCAG compliance in form fields, labels, and error announcementsfabrico-writing-hooks— for custom form-related hooks/composables (useFormField, useMultiStepForm)fabrico-reviewing-frontend— for form-specific review criteria during code review</content>
</invoke>Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

