원클릭으로
validation
Zod + neverthrow を使った入力バリデーション規約。 バリデーションスキーマ、外部入力のパース、 API/フォーム境界での Zod → Result ブリッジの実装時に適用する。
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Zod + neverthrow を使った入力バリデーション規約。 バリデーションスキーマ、外部入力のパース、 API/フォーム境界での Zod → Result ブリッジの実装時に適用する。
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Git コミットメッセージの規約。Conventional Commits 形式、日本語。 Apply when creating git commits, reviewing commit messages, or when the user asks to commit changes.
React / Next.js の TypeScript 規約。 コンポーネント(.tsx)、hooks、Server Components、Client Components、 Server Actions の実装時に適用する。
コミット前のセルフレビュー。プロジェクトの規約に沿っているかチェックする。 Apply when the user asks to review code, check conventions, or requests a self-review before committing.
スタイリング規約。Tailwind CSS v4 と inline styles の使い分け。 UI コンポーネントやプレビュー領域のスタイリング時に適用する。 Tailwind はアプリ UI に、inline styles はプレビュー領域に使い、混在させない。
TDD(テスト駆動開発)のワークフロー。 新機能やバグ修正の実装時に適用する。 Red → Green → Refactor のサイクルを必ず守る。
Vitest を使った TypeScript テスト規約。 テスト(.test.ts, .test.tsx)の作成・レビュー時に適用する。 純関数テスト、Result 型テスト、React コンポーネントテスト、モックを規定。
| name | validation |
| description | Zod + neverthrow を使った入力バリデーション規約。 バリデーションスキーマ、外部入力のパース、 API/フォーム境界での Zod → Result ブリッジの実装時に適用する。 |
import { z } from "zod"
const UserInputSchema = z.object({
name: z.string().min(1).max(100),
email: z.string().email(),
age: z.number().int().min(0).max(150),
})
type UserInput = z.infer<typeof UserInputSchema>
import { ok, err, Result } from "neverthrow"
type ValidationError = Readonly<{
code: "VALIDATION"
issues: readonly z.ZodIssue[]
}>
const parseWith = <T>(schema: z.ZodType<T>, data: unknown): Result<T, ValidationError> => {
const result = schema.safeParse(data)
return result.success
? ok(result.data)
: err({ code: "VALIDATION", issues: result.error.issues })
}
const handleCreateUser = async (req: Request): Promise<Response> => {
const body = await req.json()
return parseWith(UserInputSchema, body)
.asyncAndThen(createUser)
.match(
(user) => Response.json(user, { status: 201 }),
(error) => Response.json({ error }, { status: 400 }),
)
}
"use server"
const PostSchema = z.object({
title: z.string().min(1).max(200),
body: z.string().min(1),
tags: z.array(z.string()).max(5),
})
const createPost = async (formData: FormData) =>
parseWith(PostSchema, { ...Object.fromEntries(formData), tags: formData.getAll("tags") })
.asyncAndThen(savePost)
const AddressSchema = z.object({
street: z.string(),
city: z.string(),
zip: z.string().regex(/^\d{3}-?\d{4}$/),
})
const OrderSchema = z.object({
items: z.array(z.object({
productId: z.string(),
quantity: z.number().int().positive(),
})).min(1),
shipping: AddressSchema,
billing: AddressSchema.optional(),
})