ui-safe-form-patterns
Skill78 starsChanged 5 months agoApache-2.0View on GitHub
Implement or refactor UI forms with defense-in-depth validation, safe input handling, reliable submission behavior, and privacy-aware error handling. Use when building login, registration, profile, payment, admin, or file-upload forms.
In this repository6 other files it gives its agents.
- .cursor/rules/coding-standards.mdcCursor rule
- ui-resilient-accessibilitySkill
- ui-secure-reviewSkill
- image-prompt-craftSkill
- personal-document-searchSkill
- workflow-agent-kitSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 7 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use this skill to build forms that are both secure and dependable in real user conditions.
- Distinctive: line 17
Treat client validation as UX, not security control.
- Distinctive: line 20
Use clear loading, success, retry, and failure states.
- Distinctive: line 21
Never leak secrets or raw backend traces in UI errors.
- Distinctive: line 27
Add submit lock, timeout handling, and cancel or retry behavior where relevant.
- Distinctive: line 29
Add tests for invalid input, race conditions, and repeated clicks.
- Distinctive: line 49
Avoid stale success state after failed retries.
≈ “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
UI Safe Form Patterns
Use this skill to build forms that are both secure and dependable in real user conditions.
When to use
- Creating new forms or refactoring existing form logic.
- Hardening forms that process credentials, PII, money, or privileged actions.
- Fixing flaky submission flows and duplicate-submit bugs.
Reliability and safety baseline
- Validate on both client and server.
- Treat client validation as UX, not security control.
- Normalize input before validation when format ambiguity is common.
- Prevent duplicate submissions with in-flight state and idempotent APIs.
- Use clear loading, success, retry, and failure states.
- Never leak secrets or raw backend traces in UI errors.
Implementation workflow
- Define schema and constraints per field, including max lengths and allowed character sets.
- Build controlled input handling with immediate low-cost validation and deferred heavy checks.
- Sanitize or encode displayed user-provided content in previews and confirmation screens.
- Add submit lock, timeout handling, and cancel or retry behavior where relevant.
- Map backend errors into safe user-facing messages without exposing internals.
- Add tests for invalid input, race conditions, and repeated clicks.
Sensitive field rules
- Password fields: enforce minimum policy and avoid logging or analytics capture.
- Email and phone: normalize before validation to reduce false negatives.
- File uploads: enforce MIME and size checks client-side and server-side.
- Rich text inputs: sanitize on server and encode on render.
- Numeric money fields: use decimal-safe parsing and range checks.
Suggested checks
rg -n "onSubmit|handleSubmit|Form|formik|react-hook-form|yup|zod" frontend/src
rg -n "localStorage|sessionStorage|console\.log\(|Sentry|analytics" frontend/src
rg -n "type=\"file\"|upload|multipart|FormData" frontend/srcTest minimum
- Reject malformed input with stable messaging.
- Ignore rapid double click while request is in flight.
- Preserve user input when recoverable errors occur.
- Avoid stale success state after failed retries.
- Confirm no sensitive values appear in logs or telemetry payloads.
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.

