Awesome-omni-skill joi
Use when building joi schemas, validating input data, defining custom types, conditional validation with .when(), cross-field references, custom error messages, or writing joi extensions. Standalone package that integrates with the @hapi ecosystem.
install
source · Clone the upstream repo
git clone https://github.com/diegosouzapw/awesome-omni-skill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/diegosouzapw/awesome-omni-skill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/tools/joi" ~/.claude/skills/diegosouzapw-awesome-omni-skill-joi && rm -rf "$T"
manifest:
skills/tools/joi/SKILL.mdsource content
Joi
Quick Start
const Joi = require('@hapi/joi'); const schema = Joi.object({ name: Joi.string().min(1).max(100).required(), age: Joi.number().integer().min(0), email: Joi.string().email() }); const { error, value } = schema.validate(input);
Critical Rules
- Schemas are immutable - Every method returns a new schema instance; never mutate
- Validate at boundaries - Use
orvalidate()
at input boundaries; see validationattempt() - Types extend base - All types inherit from
; see types overviewany() - Refs for cross-field - Use
for dynamic values across fields; see referencesJoi.ref() - Extend for custom types - Use
to create custom types; see extensionsJoi.extend()
Workflow
- Choose a type - types overview for all built-in types
- Add constraints - Chain rules like
,.min()
,.max()
,.pattern().valid() - Compose schemas - Nest
,Joi.object()
,Joi.array()Joi.alternatives() - Add conditionals - Use
for dynamic schemas; see conditionals.when() - Customize errors - Override messages via
or.messages()
; see errors.error()
Key Patterns
| Topic | Reference |
|---|---|
| All built-in types | types |
| Validation & options | validation |
| References & templates | references |
| Conditional schemas | conditionals |
| Error handling | errors |
| Custom extensions | extensions |
| Metadata & introspection | metadata |
| Common methods (any) | any |
| Testing patterns | testing |