moai-lang-typescript

Implements TypeScript 5.9, React 19, and Next.js 16 applications with type-safe tRPC APIs and Zod validation.

Updated Jun 18, 2026
One-click install
npx skills add https://github.com/h102-log/pdfrag --skill moai-lang-typescript-h102-log
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: moai-lang-typescript
Source: https://github.com/h102-log/pdfrag/tree/main/.claude/skills/moai-lang-typescript
Command: npx skills add https://github.com/h102-log/pdfrag --skill moai-lang-typescript-h102-log

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Building modern full-stack TypeScript applications requires coordinating many moving parts—React 19 Server Components, Next.js 16 App Router conventions, end-to-end type safety, and schema validation—which is error-prone without consistent, up-to-date patterns. ## Core Features & Use Cases - Modern TypeScript Patterns: Covers TypeScript 5.9 features including the satisfies operator, deferred module evaluation, Stage 3 decorators, and advanced type utilities like conditional and template literal types. - React 19 & Next.js 16 Guidance: Provides patterns for Server Components, the use hook, Server Actions, useActionState, metadata APIs, middleware, and rendering strategies (SSR/SSG/ISR/PPR). - Type-Safe API Layer: Includes complete tRPC 11 router setups with protected procedures, Zod 3.23 schema validation, React Query client integration, and testing templates with Vitest and Playwright. - Use Case: When scaffolding a Next.js 16 dashboard with a tRPC backend, use this Skill to generate the router definitions, Zod input schemas, and client-side query hooks with full end-to-end type inference. ## Quick Start Ask the assistant to create a type-safe tRPC router with Zod validation for a Next.js 16 App Router project.

Frequently Asked Questions about moai-lang-typescript

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up tRPC with Next.js App Router?▼

Initialize tRPC with initTRPC.context using a Context type, define routers with publicProcedure and protectedProcedure, and expose them via an app/api/trpc/[trpc]/route.ts handler. On the client, wrap your app with trpc.Provider and QueryClientProvider in a providers.tsx client component.

How do React 19 Server Components work in Next.js 16?▼

Server Components are the default in the App Router and can directly await data fetching without useEffect. Client interactivity requires the "use client" directive, and the use hook lets client components unwrap promises passed from server components.

What is the satisfies operator in TypeScript?▼

The satisfies operator checks that a value conforms to a type without widening its inferred type. For example, an object satisfying Record<Colors, string | number[]> keeps each property's literal inferred type, so array methods remain available on array-valued properties.

Zod vs TypeScript interfaces for API validation?▼

TypeScript interfaces only check types at compile time and disappear at runtime, while Zod schemas validate actual runtime data from forms or API requests. Use z.infer to derive the TypeScript type from a Zod schema so both stay in sync.

Does Next.js 16 support Server Actions for forms?▼

Yes, Server Actions are defined in files marked with the "use server" directive and can be passed directly to a form's action prop. Combine them with useActionState for pending states and Zod safeParse for server-side validation before database writes.

Why does my tRPC query fail with UNAUTHORIZED errors?▼

The protectedProcedure middleware throws UNAUTHORIZED when ctx.session.user is missing, meaning the request lacks a valid session. Verify that getServerSession is called in your context creation and that the client sends authentication cookies.