forms-and-input

Enforces Flutter form validation, focus management, and input handling patterns with static checks.

Updated Aug 22, 2026
One-click install
npx skills add https://github.com/zakariaf/NearlyStop --skill forms-and-input-zakariaf
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: forms-and-input
Source: https://github.com/zakariaf/NearlyStop/tree/main/.claude/skills/forms-and-input
Command: npx skills add https://github.com/zakariaf/NearlyStop --skill forms-and-input-zakariaf

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Flutter forms commonly leak TextEditingControllers and FocusNodes, return hardcoded un-localized validator strings, misuse async validation inside synchronous validators, and rebuild entire forms on every keystroke. This Skill codifies the correct patterns and ships a shell script that statically guards against the most common violations before a PR. ## Core Features & Use Cases - Validation architecture: Separates pure synchronous validators (localized via AppLocalizations) from async availability checks that live in a debounced Riverpod Notifier surfaced through InputDecoration.errorText. - Focus and keyboard contracts: Covers FocusNode lifecycle and disposal, FocusTraversalGroup ordering, TextInputAction wiring, keyboardType, textCapitalization, autofillHints, and TextInputFormatter usage. - Static guard script: scripts/check_forms.sh fails CI on controllers without dispose(), async validators, and hardcoded validator string literals. - Use Case: When building a signup form with an email field and an async username-availability check, apply this Skill to keep the sync validator pure, debounce the network check in a Notifier, derive submit-button enablement from state, and pass the check_forms.sh gate. ## Quick Start Ask the AI to build a Flutter login form following the forms-and-input rules, with localized validators, a debounced async availability check in a Riverpod Notifier, and proper controller disposal.

Frequently Asked Questions about forms-and-input

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I validate a TextFormField in Flutter?

Use the validator property with a pure synchronous function returning null for valid input or a localized message from AppLocalizations for errors. Set AutovalidateMode.onUserInteraction on the Form so fields stay silent until touched, then give live feedback.

How to check username availability asynchronously in a Flutter form?

Async checks cannot live in the sync validator, which must return String? immediately. Instead, call a Riverpod Notifier from onChanged, debounce with a dart:async Timer, run the repository check, and surface the result through InputDecoration.errorText.

Why does my Flutter form leak memory or lose text on rebuild?

Creating TextEditingController or FocusNode inside build() makes a fresh instance every rebuild, losing text and cursor. Create them in State, dispose them in dispose(), or hold long-lived values in a Notifier instead.

Should the submit button enabled state be stored in a boolean?

No. A stored _isValid flag drifts out of sync with actual field validity. Derive submit enablement from FormState or Notifier state at build time, and disable the button while an async submit is in flight.

What does check_forms.sh detect in Flutter code?

The script fails on three patterns: a TextEditingController or FocusNode created in a file with no dispose() override, an async validator closure, and hardcoded string literals returned from validators instead of AppLocalizations keys.

When should I use AutovalidateMode.always in Flutter forms?

Almost never. AutovalidateMode.always shows errors before the user types anything. Default to onUserInteraction for live feedback after first touch, or disabled for very short forms validated only on submit.