yup
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "yup" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-d6d9c458df224e766d327e73f43d0985b85001e69a89bc2ef6db40cf2aae3021. Verify the upstream source and version against https://github.com/TerminalSkills/skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Yup: Used for schema validation in JavaScript/TypeScript. Suitable for adding form validation, defining API request schemas, validating configuration, or building type-safe validation pipelines.
Introduction source: third_party · TerminalSkills · 1.0.0 Reference
SkillPi interpretation
- Testing
- Not tested
Browse files
Frontmatter
name: yup
description: >-
Validate data with Yup schemas. Use when adding form validation, defining
API request schemas, validating configuration, or building type-safe
validation pipelines in JavaScript/TypeScript.
license: Apache-2.0
compatibility: 'Any JavaScript runtime'
metadata:
author: terminal-skills
version: 1.0.0
category: development
tags: [yup, validation, schema, forms, typescript]Yup
Overview
Yup is a schema validation library for JavaScript. Define schemas declaratively, validate data, and get detailed error messages. Works with Formik, react-hook-form, and standalone. TypeScript-first with type inference.
Instructions
Step 1: Schemas
import * as yup from 'yup'
const userSchema = yup.object({
name: yup.string().min(2).max(100).required(),
email: yup.string().email().required(),
age: yup.number().positive().integer().min(13).max(120),
role: yup.string().oneOf(['admin', 'member', 'viewer']).default('member'),
tags: yup.array().of(yup.string()).min(1).max(10),
address: yup.object({
street: yup.string().required(),
city: yup.string().required(),
zip: yup.string().matches(/^\d{5}$/, 'Must be 5 digits'),
}),
})
// Validate
const user = await userSchema.validate(data, { abortEarly: false })
// Type inference
type User = yup.InferType<typeof userSchema>
Step 2: Custom Validation
const passwordSchema = yup.string()
.min(8)
.matches(/[A-Z]/, 'Must contain uppercase')
.matches(/[0-9]/, 'Must contain number')
.matches(/[^A-Za-z0-9]/, 'Must contain special character')
const signupSchema = yup.object({
password: passwordSchema.required(),
confirmPassword: yup.string()
.oneOf([yup.ref('password')], 'Passwords must match')
.required(),
})
Step 3: Conditional Validation
const schema = yup.object({
contactMethod: yup.string().oneOf(['email', 'phone']).required(),
email: yup.string().when('contactMethod', {
is: 'email',
then: (s) => s.email().required('Email required when contact method is email'),
}),
phone: yup.string().when('contactMethod', {
is: 'phone',
then: (s) => s.matches(/^\+\d{10,15}$/).required('Phone required'),
}),
})
Guidelines
abortEarly: falsereturns all errors at once — better UX than one-at-a-time.- Use
InferTypeto derive TypeScript types from schemas — single source of truth. - For new projects, consider Zod instead — better TypeScript inference and ecosystem.
- Yup is still the standard for Formik integration.
.when()for conditional validation — fields required only in certain contexts.
Current listing version
1.0.0
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供 Yup 数据验证库的详细使用指南,涵盖表单验证、API 请求模式、配置验证等实际开发场景
- 具有明确的实用价值,受众为 JavaScript/TypeScript 开发者,属于通用工具类别
Highlights
- description 明确描述了使用场景(表单验证、API 请求模式、配置验证、类型安全验证管道)
- 触发词精准,边界清晰
Highlights
- 文档结构清晰,包含 Overview、Instructions(分步骤)、Guidelines
- 有完整代码示例,frontmatter 完整,单文件未超限
Highlights
- 工具来源明确(Yup 库),参数使用正确
- 覆盖了常见验证场景和异常处理(如 abortEarly),无不可逆操作
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.