بنقرة واحدة
zod-schemas
Zod schema validation patterns for API types
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Zod schema validation patterns for API types
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Handle batches of Jira tickets through shared analysis, per-ticket feature-dev, Lumen UI guardrails, changesets, and draft PRs. Use when the user provides multiple Jira tickets or asks to deliver tickets one by one with PRs.
Trigger the on-demand production build workflows on LedgerHQ/ledger-live-build (Desktop, Android APK, iOS) for a ledger-live branch, then post a PR comment. Use when asked to "run builds", "produce a build", "build the app(s)", or "make an APK/iOS/desktop build" for a PR/branch.
Guided feature development with codebase understanding and architecture focus
Rules and layout for coin module packages under libs/coin-modules/. Read when adding or modifying a coin module.
Dead-code / unused-dependency detection is migrating from the legacy `unimported` tool to `knip`, which requires each package to expose an explicit, minimal `package.json#exports` (no `./*` wildcard). Read this when adding a new package or migrating an existing one.
Guidelines that must be followed when creating or updating docs in this repo. Applies to AGENTS.md, README.md, **/docs/**/*.md, skill and sub-agent files.
| name | zod-schemas |
| description | Zod schema validation patterns for API types |
Define types in state-manager/types.ts using Zod schemas for runtime validation.
// ✅ GOOD - state-manager/types.ts
import { z } from "zod";
// 1. Define tag types as enum
export enum MyDataTags {
Items = "Items",
Item = "Item",
}
// 2. Define Zod schemas with validation rules
const ItemSchema = z.object({
id: z.string().uuid(),
name: z.string().min(1),
value: z.number().min(0),
status: z.enum(["active", "inactive"]),
createdAt: z.string().datetime(),
});
const ItemResponseSchema = z.object({
data: ItemSchema,
meta: z.object({
timestamp: z.string(),
version: z.string(),
}),
});
const ItemListResponseSchema = z.object({
items: z.array(ItemSchema),
pagination: z.object({
nextCursor: z.string().optional(),
total: z.number(),
}),
});
// 3. Infer TypeScript types from schemas
export type Item = z.infer<typeof ItemSchema>;
export type ItemResponse = z.infer<typeof ItemResponseSchema>;
export type ItemListResponse = z.infer<typeof ItemListResponseSchema>;
// 4. Define query params as interfaces
export interface GetItemsParams {
search?: string;
limit?: number;
cursor?: string;
}
// 5. Export schemas for runtime validation
export { ItemSchema, ItemResponseSchema, ItemListResponseSchema };
// state-manager/api.ts
import { ItemListResponseSchema, type ItemListResponse } from "./types";
endpoints: (build) => ({
getItems: build.query<ItemListResponse, GetItemsParams>({
query: (params) => ({ url: "items", params }),
transformResponse: (response: unknown) => {
// Runtime validation
return ItemListResponseSchema.parse(response);
},
}),
}),
.min(), .max(), .uuid(), .email() for field validationz.enum() for fixed string valuesz.union() for multiple possible types.optional() for nullable fieldsz.infer<typeof Schema>