← Back to list

validation-architecture
by hajimism
⭐ 0🍴 0📅 Jan 17, 2026
SKILL.md
name: validation-architecture description: Validation design rationale. Use when asking why validation works this way, understanding the layered validation strategy, or making architectural decisions about validation.
Validation Architecture
Layer Responsibilities
core/ → SSOT: constraints + schemas (ArkType, Standard Schema)
api/ → Gatekeeper: reject invalid requests (sValidator)
front/ → UX: phase-based feedback (withValidationErrorMessages)
Design Decisions
Why constraints separate from schemas?
- Constraints are plain values (reusable in messages, tests, etc.)
- Schemas are validation logic (may change libraries)
- Types derived from constraints (SSOT)
Why Standard Schema?
- Library-agnostic interface (
@standard-schema/spec) - ArkType today, can swap to Zod/Valibot later
- Both api (sValidator) and front use same interface
Why phase-based validation in front?
onChange: lenient (no required checks) → no red during typingonDraftSubmit: intermediateonConfirmedSubmit: strict (all rules) → block invalid submit
Core schema is for "final correctness". Front needs UX timing control.
Why validate twice (front + api)?
- Front validation: UX improvement (optional, can fail)
- API validation: security boundary (required, never trust client)
Key Files
core/src/model/*/constraints.ts- constraint valuescore/src/model/*/schema.ts- ArkType schemasapi/src/model/*/index.ts- sValidator usagefront/src/model/common/lib/validation.ts- phase-based utilitiesfront/src/model/*/detail/form/inputs/*/validation.ts- field validation
Score
Total Score
50/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
Reviews
💬
Reviews coming soon