基于 SOC 职业分类
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/mikailustuner/OmniRule --skill forms-patterns命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
Bun runtime: HTTP server, file I/O, SQLite, test runner, package manager, bundler — all-in-one JS toolchain.
Clerk: Drop-in auth UI, Organizations, User management, JWT templates, webhooks, Next.js middleware integration.
Gelişmiş masaüstü, tarayıcı ve işletim sistemi kontrol yeteneği. Görsel (koordinat tabanlı) fare/klavye otomasyonu, DOM manipülasyonu, pencere yönetimi, gelişmiş dosya, ağ ve süreç yönetimini kapsar.
| name | forms-patterns |
| description | Form architecture, validation patterns, state handling |
| triggers | {"extensions":[".tsx",".jsx"],"keywords":["form","input","validation","react-hook-form","formik","zod","submit","field"]} |
| auto_load_when | Building or editing forms |
| agent | frontend-ops |
| tools | ["Read","Write","Bash"] |
Focus: Architecture, validation, state management
When to use controlled input:
├── Framework (React/Vue) → yes
├── Real-time validation → yes
├── Conditional fields → yes
└── Simple form → uncontrolled
When to use uncontrolled:
├── No JS required → yes
├── Large form → performance
├── Framework not needed → yes
└── File upload → yes
When to nest forms:
├── Related fields → yes
├── Multi-step → yes
└── Separate forms → no nesting
When to validate on blur:
├── Required fields → yes
├── Format validation → yes
├── Custom rules → yes
└── Debounce needed → add delay
When to validate on submit:
├── Performance → yes
├── User preference → yes
├── All fields → yes
└── Heavy validation → yes
When to use HTML5 validation:
├── Simple rules → yes
├── Browser support → yes
├── Custom messages → overrides
└── Disabled for style → avoid
When to use custom validation:
├── Complex rules → yes
├── Cross-field validation → yes
├── Async validation → yes
└── Different error UI → yes
When to show error inline:
├── Field-specific → yes
├── Clear which field → yes
├── Multiple errors → yes
└── Summary also shown → yes
When to show error summary:
├── Many errors → yes
├── Form above fold → yes
├── Mobile → position carefully
└── Single error → inline only
When to use aria-invalid:
├── Validation error → yes
├── Conditional required → yes
├── Pre-validated → no
└── Initial state → no
When to use form state:
├── Many fields → yes
├── Cross-field logic → yes
├── Submission handling → yes
└── Simple form → local state
When to use field-level state:
├── Independent validation → yes
├── Many fields → yes
├── Shared state → lift up
└── Simple → local state
When to reset form:
├── Clear button → yes
├── Successful submit → yes
├── Navigation away → confirm
└── Same form, different data → yes
When to use aria-describedby:
├── Help text → yes
├── Error message → yes
├── Character count → yes
└── Instructions → yes
When to group fields:
├── Fieldset → yes (radio/checkbox group)
├── Related fields → yes
├── Conditional section → yes
└── Single field → no
When to use legend:
├── Fieldset → always
├── Descriptive label → yes
├── Group explanation → yes
└── Empty → not allowed
When to use single file:
├── One document → yes
├── Clear format → accept attribute
├── Validation needed → custom
When to use multiple files:
├── Multiple documents → yes
├── Drag and drop → yes
├── Progress indicator → yes
└── File list → yes
When to use preview:
├── Images → yes
├── Documents → icon
└── Not needed → skip
❌ Validating only on submit — user waits for errors
✅ Validate on blur for each field; show inline errors immediately
❌ Disabling submit button until valid (accessibility issue)
✅ Keep submit enabled; validate on submit, show all errors at once
❌ Resetting the form on validation error
✅ Preserve user input on error — never lose filled data
❌ Generic "Invalid" error message
✅ Specific messages: "Password must be at least 8 characters"
❌ No loading state after submit
✅ Disable submit + show spinner during submission
| Library | Use case | Key feature |
|---|---|---|
| react-hook-form | Performance-first | Uncontrolled inputs |
| Zod | Schema validation | Type inference |
| Formik | Complex forms | Built-in state |
| Server Actions | Next.js 15 | No JS bundle cost |
| HTML5 validation | Simple forms | Zero dependencies |
| UX Pattern | When | Note |
|---|---|---|
| Inline error | On blur | Don't show on pristine |
| Summary error | On submit | Anchor to first error |
| Success feedback | After submit | Toast or redirect |