parse-dont-validate
Preserve invariants in types when changing domain models, input boundaries, or state transitions.
Unsigned, install at your own risk
UnverifiedThis skill has no cryptographic signature attached. We can't verify the contents match what the publisher intended.
Install this skill
No account required. Pick your tool, or use the command that detects it for you.
Run in your terminal. It detects your AI tool.
npx @skills-hub-ai/cli install fsharp-skills-parse-dont-validateManual setup by platform
Claude Code
~/.claude/skills/fsharp-skills-parse-dont-validate/SKILL.md
Instructions
Parse, Don't Validate
Parse raw input into domain values before effects depend on valid input.
Make downstream functions consume those values instead of repeating checks on primitives.
Model the invariant
- Identify the invariant that the consumer requires.
- Choose a representation that preserves the invariant.
- Trace callers to the input boundary.
- Refine a value when a constraint applies only to one branch.
- Introduce a type only when it prevents a concrete error or expresses a domain distinction.
- Name each type for the guarantee that it establishes.
In F#, use records for values that must exist together. Use discriminated unions for alternatives or state-specific data.
Use distinct types when exchanging two primitive values would cause an error. Reuse suitable domain types.
Use constrained types for range or format guarantees. Enforce smart constructors through private representations or .fsi signatures.
Return Result<DomainValue, ParseError> when callers need failure details. Make ParseError a union with one case for each failure, or an IWSAM leaf when errors compose across functions (fsharp-iwsam-errors). Do not use string as the error type, because a caller cannot match on it. Use option when absence gives sufficient information.
Represent a non-empty collection with a required head and a tail. Use units of measure for dimensions, not range constraints.
Preserve the guarantee
- Keep domain values intact through domain operations.
- Extract primitives only for serialization, display, or operations that require them.
- Check construction, update, deserialization, persistence-loading, and conversion paths.
- Make each operation preserve the invariant or return an explicit failure.
- Separate raw transport data from domain values when serializers bypass constructors.
- Preserve existing storage and wire contracts unless the user requests changes.
Reject invalid input according to the domain rules. Normalize, truncate, deduplicate, or substitute defaults only when the contract permits it.
Handle each state explicitly when a handler accepts all states. Consider accepting a state-specific type when an operation requires one state.
Keep runtime checks for permissions, concurrency, availability, and other changing external facts. A parsed value cannot permanently prove these facts.
A formatted email address does not prove ownership or deliverability.
Verify the result
- Verify that invalid input produces the required failure.
- Verify that successful parsing produces the type required by consumers.
- Check that supported APIs cannot bypass construction.
- Check that updates preserve the invariant.
- Remove repeated checks only when the type guarantees the checked property.
- Report remaining runtime checks and construction paths that bypass the guarantee.
Sources: Parse, Don't Validate
and Designing with Types.
Security
Reviews (0)
Related skills
Browse all βMore from F# Skills
View source βMore Build skills
Browse category βFrequently asked questions about parse-dont-validate
What does the parse-dont-validate skill do?
Preserve invariants in types when changing domain models, input boundaries, or state transitions. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.
How do I install the parse-dont-validate skill?
Run `npx @skills-hub-ai/cli install fsharp-skills-parse-dont-validate` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/fsharp-skills-parse-dont-validate/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.
Which AI tools does parse-dont-validate work with?
parse-dont-validate runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.
Is the parse-dont-validate skill free?
Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.
How do I use parse-dont-validate after installing it?
In Claude Code, type `/fsharp-skills-parse-dont-validate` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.
Can I share the parse-dont-validate skill with my team?
Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.