一键导入
js-monorepo
JS/TS monorepo with pnpm workspaces and Turborepo. Use when setting up a monorepo, adding packages, or auditing config.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
JS/TS monorepo with pnpm workspaces and Turborepo. Use when setting up a monorepo, adding packages, or auditing config.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Multi-phase audit pipeline with independent review agents. Use when finishing tickets, validating work against acceptance criteria, checking architecture compliance, or reviewing code against skill standards. Use /audit to run the full pipeline, /audit ac for acceptance criteria only, /audit arch for architecture only, /audit skill for skill compliance only.
Prepare code for commit by checking for bugs, ensuring consistency, removing debug code, and running checks until green. Use when finishing a feature, before committing, or when asked to "make it green" or "prep for commit".
Next.js App Router data layer: SSR hydration, React Query, auth patterns. Use when creating pages, adding tabs, or auditing data fetching.
Manage project changelog. Use /project log after completing work, /project release when ready to ship.
React component development with shadcn/ui, React Hook Form, and Zod. Use when creating, extracting, or auditing React UI components.
Extract learnings from conversations and update project knowledge. Use when you've learned something valuable, solved a tricky problem, or notice patterns emerging. Sub-commands: capture (save observations before compaction), finalize (process into skill updates), migrate (move legacy principles into skills).
| name | js-monorepo |
| description | JS/TS monorepo with pnpm workspaces and Turborepo. Use when setting up a monorepo, adding packages, or auditing config. |
Set up and maintain JavaScript/TypeScript monorepos with pnpm workspaces, Turborepo, and shared packages.
contracts and ui packages.workspace:* protocol - Apps reference internal packages via "@your-org/contracts": "workspace:*".pnpm-workspace.yaml, reference via catalog: protocol.tsconfig.base.json from root.| Command | Purpose |
|---|---|
/js-monorepo init | Set up a new monorepo from scratch |
/js-monorepo add-package | Add a shared package to an existing monorepo |
/js-monorepo review | Audit existing monorepo for issues |
your-project/
├── apps/ # Deployable applications
│ ├── web-app/ # Next.js frontend
│ └── api/ # NestJS/Express backend
├── packages/ # Shared packages
│ ├── contracts/ # NON-NEGOTIABLE: Types, Zod schemas, interfaces
│ └── ui/ # NON-NEGOTIABLE: React components, hooks, patterns
├── scripts/ # Monorepo scripts (bootstrap, pre-commit, etc.)
├── turbo.json # Turborepo pipeline
├── pnpm-workspace.yaml # Workspace definition + dependency catalogs
├── tsconfig.base.json # Shared TypeScript config
├── eslint.config.mjs # ESLint 9 flat config (root)
├── prettier.config.mjs # Prettier config (root)
├── .prettierignore # Prettier ignore patterns
├── .gitignore # Git ignore patterns
├── .editorconfig # Editor settings
├── .husky/pre-commit # Pre-commit hook
└── package.json # Root: engines, scripts, devDependencies
/js-monorepo initWhen: Setting up a new monorepo from scratch or converting an existing project.
Steps:
Scaffold directory structure:
mkdir -p apps packages/contracts/src packages/ui/src scripts .husky
Create root config files (use templates from references/config-templates.md):
pnpm-workspace.yaml - Workspace packages + dependency catalogsturbo.json - Task pipeline with env vars and caching configtsconfig.base.json - Shared TypeScript base (strict, verbatimModuleSyntax)eslint.config.mjs - ESLint 9 flat config with projectServiceprettier.config.mjs - Prettier with import sorting + Tailwind.prettierignore - Ignore build artifacts, lockfiles, cache.gitignore - Comprehensive monorepo ignores.editorconfig - Editor consistencyCreate scripts and runtime configs (use templates from references/scripts-templates.md):
package.json - Root with engines, scripts, devDependencies.husky/pre-commit - Smart pre-commit hookscripts/pre-commit-checks.sh - Pre-commit validation script (capture → fix → restage → validate)scripts/bootstrap.sh - One-command developer setupCreate non-negotiable packages (use templates from references/package-patterns.md):
packages/contracts/ - Types, Zod schemas, shared interfacespackages/ui/ - React components, hooks, utilitiesUpdate CLAUDE.md (Read CLAUDE.md Guidance for the template)
Verify structure:
pnpm install succeedspnpm build succeeds (turbo)pnpm check succeeds (format + lint + typecheck + build)/js-monorepo add-package <name> [type]When: Adding a new shared package to an existing monorepo.
Arguments:
<name> - Package name (e.g., config-eslint, config-tailwind, email)[type] - Optional: source (no build, consume as TypeScript) or compiled (builds to dist). Default: source.Steps:
Create package directory:
mkdir -p packages/<name>/src
Determine package type:
| Type | Build | Main | Types | Use Case |
|---|---|---|---|---|
source | noEmit: true | ./src/index.ts | ./src/index.ts | UI components, hooks, config |
compiled | tsc --build | ./dist/index.js | ./src/index.ts | Contracts, utilities shared with backend |
Create package files (use templates from references/package-patterns.md):
package.json - Name, exports, standardized scripts, dependencies (use catalog: for external deps)tsconfig.json - Extends root tsconfig.base.jsonsrc/index.ts - Barrel exportWire into monorepo:
"@your-org/<name>": "workspace:*" to dependenciespnpm install to linkVerify:
pnpm build passes with new package in the graph/js-monorepo reviewWhen: Auditing an existing monorepo for issues, after setup, or during troubleshooting.
Steps:
Scan root config files:
pnpm-workspace.yaml exists with apps/* + packages/* and catalogsturbo.json exists with correct task dependencies, env vars, and outputLogstsconfig.base.json exists with strict mode and verbatimModuleSyntaxeslint.config.mjs exists with TypeScript projectService + allowDefaultProjectprettier.config.mjs exists with import sorting.prettierignore exists (not formatting build artifacts).gitignore exists with monorepo patterns (.turbo, dist, .next, *.tsbuildinfo).editorconfig exists.husky/pre-commit exists and calls pre-commit scriptScan non-negotiable packages:
packages/contracts/ exists with proper exportspackages/ui/ exists with fine-grained exportstsconfig.json extending rootScan standardized scripts across all packages:
lint, typecheck, validate scriptsbuild and dev (watch) scriptsdev (watch --noEmit) scriptScan task pipeline in turbo.json:
format task exists (no cache)lint depends on ^format, has inputs and outputLogs: "errors-only"typecheck depends on ^typecheckbuild depends on ^build, validate, typecheck, has env for framework varsdev is persistent, no cache, interruptible: trueglobalEnv includes CI and NODE_ENVScan dependency management:
workspace:* protocol for internal packagescatalog: protocol where possiblepnpm-workspace.yaml@your-org/* import paths resolveScan bootstrap and pre-commit:
scripts/bootstrap.sh exists and is executablepackage.json has "bootstrap" scriptScan CLAUDE.md (if exists):
@your-org/* paths)Report findings with severity:
When /js-monorepo init runs or when this skill is used on an existing repo, update the project's CLAUDE.md with monorepo-specific context. Add or update these sections:
## Project Overview
- **Stack**: [describe apps - e.g., Next.js frontend + NestJS API]
- **Package Manager**: pnpm (workspace monorepo)
- **Build System**: Turborepo
## Repository Structure
[Include the actual monorepo structure with apps/ and packages/]
## Key Conventions
### Scripts
Standard scripts at root level (run via `pnpm <script>`):
| Script | Purpose |
|--------|---------|
| `pnpm dev` | Start all apps in dev mode |
| `pnpm build` | Build all packages (respects dependency graph) |
| `pnpm lint` | Lint all packages |
| `pnpm typecheck` | Type-check all packages |
| `pnpm check` | Full validation (format + lint + typecheck + build) |
| `pnpm fix` | Auto-fix formatting and lint issues |
| `pnpm test` | Run all tests |
| `pnpm bootstrap` | One-command setup for new developers |
### Imports
- Use `@your-org/contracts` for shared types and Zod schemas
- Use `@your-org/ui/components/ui/*` for shadcn primitives
- Use `@your-org/ui/components/patterns/*` for composed patterns
- Use `@your-org/ui/hooks/*` for shared hooks
- Use `@/` for app-internal absolute imports
### Packages
| Package | Purpose |
|---------|---------|
| `@your-org/contracts` | Shared types, Zod schemas, interfaces (domain-organized) |
| `@your-org/ui` | React components, hooks, patterns (fine-grained exports) |
### Adding Dependencies
- Internal packages: `"@your-org/contracts": "workspace:*"` in package.json
- External packages: Use `catalog:` protocol (versions defined in pnpm-workspace.yaml)
/js-monorepo initcontracts and ui packages created with standardized scriptspnpm install succeedspnpm check passes/js-monorepo add-packagecatalog: for external deps/js-monorepo review/react-ui - React component creation, extraction, patterns, review. Use for UI concerns (shadcn primitives, forms, themes)./nextjs-data - Next.js App Router data layer. Use for page creation, query layers, and SSR hydration.