hwc-forms-validation
Installation
SKILL.md
Forms & Validation
Implement form-centric Hotwire workflows with Turbo Frames and Stimulus.
Core Workflow
- Identify the form flow: create/edit, inline edit, typeahead, modal form, or external controls.
- Wrap the form interaction scope in a Turbo Frame when validation errors must rerender in place.
- Return
422for validation failures and303for successful redirects. - Handle post-submit behavior with
turbo:submit-endonly when Turbo defaults are insufficient. - Preserve user context during rerenders (focus/caret/selection).
Guardrails
- Keep one source of truth for input state; avoid duplicate controls across frame and non-frame DOM.
- Use the HTML
formattribute for controls rendered outside the target<form>hierarchy. - Avoid firing submit logic on every keystroke without debounce/throttle.
- Keep post-submit behavior explicit when form responses update only a frame.
Related skills