ronjunevaldoz/kmp-agent-skills/kmp-form-validation
Claude Code and agent skill by ronjunevaldoz/kmp-agent-skills
- community
Checking that the SKILL.md file is still in the repository.
Declarative form validation for Kotlin Multiplatform — field-level validation rules in commonMain, synchronous and async validators, error state integrated into MVI UiState, submit gating, and reusable field components that display inline errors. No third-party validation library required.
Install
npx vskill@latest install ronjunevaldoz/kmp-agent-skills/kmp-form-validationSKILL.md
The same SKILL.md was published earlier as ronjunevaldoz/kmp-agent-skills/kmp-form-validation.
When to Use This Skill
Use when:
- A screen has a form with required fields, format rules, or async checks (username availability)
- Validation errors need to appear inline under each field as the user types or on submit
- Submit button must be disabled until all fields are valid
- Validation logic should be tested independently of the UI
Trigger keywords: form validation, field validation, required field, email validation, inline error, validation rule, form error, submit disabled, async validation, validate form, ValidationResult, FieldState, form state KMP, input validation, field error message, form, validate, validation, form field, form handling, form state, error message, check input, validate input, form submission.
Freshness rule: No external library is required — this pattern uses only kotlinx.coroutines and Compose. If you choose to add a validation library (Valiktor, Konform), verify its KMP support before adding to libs.versions.toml.
Recommendation First
Define validation as pure functions that return ValidationResult — they are trivially testable with no UI setup. Keep validation rules in :domain, field state in the ViewModel's UiState, and error display in :ui composables. Never validate inside a composable directly.
Core types — commonMain
Validation rules — pure functions in commonMain
Field state in UiState
ViewModel — validate on change and on submit
Async validation (username availability)
UI — validated field composable
Testing validators
Common Anti-Patterns
- Validation inside a composable —
if (!email.isValid()) { ... }in@Composableruns on every recomposition and cannot be unit tested; move all validation to the ViewModel - `isFormValid` computed in the ViewModel function — compute it as a property on
UiStateso the submit button binding is declarative and always in sync - Showing errors before the user has touched a field — use
isTouchedto gate error display; showing "Email is required" on an empty field before the user has focused it is jarring - Async validation without debounce — firing a network check on every keystroke hammers the API; always
delay(300-400ms)+ cancel the previous job before issuing a new one - Duplicating validation logic in the backend — the frontend validators are for UX only; always validate server-side as well
Related Skills
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/kmp-form-validation/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ronjunevaldoz/kmp-agent-skills/kmp-form-validation)