-PAT TE R N CO MPARIS ON TYPE // type S = | {k:'a'} | {k:'b'}; // type PropertyId = Brand<string, 'PropertyId'>; // type Out = z.infer< typeof schema>; // → type BuyerView = Pick<Tx, 'id'|'price'>; PROMPT
R P C schema.graphql G r a p h Q L openapi.yaml O p e n A P I schema.prisma D B S C H E M A tokens.json D E S I G N T O K E N S type / interface T S D E S T I N AT I O N
S D E F I N E TS is the definer · 01 · INTERACTION UI 04 · MARKETPLACE R E C E I V E TS is the receiver · AI 02 · DATA DB Schema 03 · API .proto / OpenAPI
ORK FL OW S T E P 0 1 · 01 D E FI NE T HE O R IG IN type FormState = | { status: 'editing' } | { status: 'submitting' } | { status: 'done' }; S T E P 0 2 · 02 PA SS A S CONT E XT + prompt: S T E P 0 3 · A I 03 GE NER AT E function Form(...) { switch (s.status) { case 'editing': ... } } S T E P 0 4 · Ty p e S c r i p t 04 GU AR D AT C O MPI LE // // //
RO M PT DE PT H L E V E L 01 > — O U T P U T L E V E L 02 > type FormState = { ... } + — O U T P U T L E V E L 03 > schema.prisma / .proto — O U T P U T
OM P ON EN T TRE E 01 02 03 04 Pick infer type interface B A C K E N D F R O N T E N D A P I API B L 1 Page L 2 Domain Component L 4 · D O M A I N - F R E E Input L 4 · D O M A I N - F R E E Button L 3 Composite UI A P I · API A
a a S · 01 invite-member.ts P R O M P T I N P U T type InviteMemberFormState = | { status: 'editing'; email: string; role: Role; errors: ValidationError[] } | { status: 'confirming'; email: string; role: Role } | { status: 'submitting'; email: string; role: Role } | { status: 'succeeded'; invitedEmail: string } | { status: 'failed'; email: string; role: Role; error: SubmitError }; type SubmitError = | { code: 'already_invited'; existingMemberEmail: string } | { code: 'quota_exceeded'; currentCount: number; limit: number } | { code: 'network_error' }; type Role = 'admin' | 'editor' | 'viewer'; Y O U InviteMemberFormState
a a S · 02 FailedView.tsx C L A U D E O U T P U T function FailedView({ error, onRetry, onCancel }: FailedViewProps) { switch (error.code) { case 'already_invited': return <p> {error.existingMemberEmail} </p>; case 'quota_exceeded': return <p> ( {error.limit} ) ( {error.currentCount} )</p>; case 'network_error': return <p> </p>; } // ↑ 'code' } O B S E R V E existingMemberEmail limit currentCount
0 1 transaction.ts P R O M P T I N P U T // type Transaction = { id: TransactionId; sellerId: UserId; // buyerId: UserId; // price: number; platformFee: number; // shippingAddress: Address; // trackingNumber: string | null; status: TransactionStatus; // Discriminated Union ( ) // ... }; Y O U SellerTransactionView BuyerTransactionView