pnpm-workspace

Guides development of pnpm monorepos with TypeScript project references, OpenAPI codegen, and workspace conventions.

Updated Apr 20, 2026
One-click install
npx skills add https://github.com/AmirEmad11/instabot --skill pnpm-workspace-amiremad11
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pnpm-workspace
Source: https://github.com/AmirEmad11/instabot/tree/main/.local/skills/pnpm-workspace
Command: npx skills add https://github.com/AmirEmad11/instabot --skill pnpm-workspace-amiremad11

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Working in a pnpm monorepo with composite TypeScript libraries, leaf application packages, and contract-first API development involves many conventions that are easy to get wrong, from project reference wiring to dependency placement and proxy routing. This Skill encodes those rules so cross-package changes, new libraries, and API endpoints are built correctly the first time. ## Core Features & Use Cases - Workspace Structure Guidance: Explains the artifacts/lib/scripts layout, composite vs leaf package TypeScript models, and how to add new libs or artifacts with correct tsconfig references. - Contract-First API Development: Defines OpenAPI specs first, then generates Zod schemas and React Query hooks via Orval codegen, with rules for operationIds, nullable fields, and error handling. - Server & Database Conventions: Covers Express 5 routing patterns, pino structured logging, and Drizzle ORM schema definitions with migration commands. - Use Case: When adding a new feature that spans a database table, an API endpoint, and a React frontend, follow this Skill to create the Drizzle schema, extend the OpenAPI spec, run codegen, and implement the route with proper validation and logging. ## Quick Start Ask the assistant to add a new API endpoint with its database table and frontend hook following the pnpm workspace conventions.

Frequently Asked Questions about pnpm-workspace

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

FAQPage Schema
How do I add a new library to a pnpm monorepo with TypeScript project references?

Create the lib package with composite, declarationMap, and emitDeclarationOnly in its tsconfig.json, then add it to the root tsconfig.json references array. If it imports another lib, declare that lib in its own references so tsc --build orders builds correctly.

How do I generate React Query hooks from an OpenAPI spec?

Define endpoints in lib/api-spec/openapi.yaml with an operationId for each, then run pnpm --filter @workspace/api-spec run codegen. Orval generates Zod schemas in @workspace/api-zod and React Query hooks in @workspace/api-client-react.

Should workspace dependencies go in dependencies or devDependencies?

Static client-only artifacts put all packages in devDependencies, while server artifacts place runtime imports like express and drizzle-orm in dependencies and build tools in devDependencies. If a dependency exists in the pnpm-workspace.yaml catalog, use the catalog: protocol.

Why does app.get("*") crash in Express 5?

Express 5 requires named wildcard parameters, so bare asterisks are invalid syntax. Use app.get("/{*splat}", ...) to match all paths including root, or /*splat to match all paths except root.

Can I run pnpm dev at the workspace root to start my app?

No, the root has no dev script by design because artifacts need environment variables like PORT and BASE_PATH wired up by workflow configuration. Use the workflow restart mechanism or preview pane instead of shelling out to pnpm dev.