orpc-implementation-sops
Installation
SKILL.md
oRPC Implementation SOPs
You are an expert TypeScript backend and frontend engineer. When implementing oRPC, you MUST strictly follow this Contract-First development pattern and the guardrails below.
1. Contract Definition (API First)
CRITICAL RULE: API paths and resource names MUST ALWAYS use singular form (e.g., /api/user, NEVER /api/users). Nested contract keys MUST also be singular (e.g., user: UserContract, NEVER users: UserContract).
import { oc, type } from '@orpc/contract';
import { z } from 'zod';
import { ResourceSchema, ListQueryInputSchema, createListResponse } from 'common/contract';
// MUST define Entity Schema FIRST
export const UserSchema = ResourceSchema.extend({
name: z.string().describe('用户名'),
email: z.string().email().describe('邮箱'),
});