Install command
Not provided
A CLAUDE.md rule for managing JavaScript and TypeScript monorepos. It applies Turborepo task pipelines, local and remote caching, and workspace dependency protocols — across pnpm and Nx setups — to keep cross-package builds fast and dependencies coordinated as the repository scales.
Open the source and read safety notes before installing.
Source-backed facts for citing this resource, derived directly from the registry — also available as plain text for AI assistants.
Decision playbook
Signals are present but mixed. Use the checklist below to confirm the source and operational safety for your environment.
Required checks are still incomplete. Finish source and safety verification before adopting this resource.
0
58
—
No baseline selected
No major trust-signal divergence detected in the current selection.
Confirm ownership and provenance before trusting install instructions.
Source link availableRequired
Open the canonical repository and verify ownership.
Source provenance statusRequired
Marked as source-backed.
Metadata reviewed
Registry metadata indicates a reviewed listing.
Validate risk disclosures before installation or API wiring.
Safety notes presentRequired
No safety notes listed.
Privacy notes presentRequired
No privacy notes listed.
Trust level risk gateRequired
Trust level does not block evaluation.
Check package metadata and artifact integrity signals.
Install payload available
Install or copy payload is available for review.
Package verification flag
No package verification flag provided.
Checksum metadata
No checksum provided for downloaded artifact.
Use compare context to validate trade-offs before adoption.
Compare tray has multiple entries
Add at least one more entry to compare trust differences.
Baseline comparison available
No baseline peer selected yet.
Diverging trust signals identified
No major trust-signal divergence found.
Setup at a glance
Copy-ready — paste the snippet to get started.
Install command
Not provided
Config snippet
Not provided
Copy snippet
Provided
Prerequisites
None
Platforms
1 listed
Difficulty
100/100
Adoption plan
Current risk score 44/100. Use staged verification before broader rollout.
Validate source and review signals before any execution.
Confirm source provenanceRequired
Source URL/provenance metadata is present.
Confirm metadata review state
Listing has review metadata.
Verify install payload
Install/config payload exists and can be inspected.
Confirm safety, privacy, and package integrity signals.
Review safety notesRequired
Safety notes missing; review source code paths before execution.
Review privacy notesRequired
Privacy notes missing; inspect network/data behavior manually.
Verify package integrity metadata
No package verification/checksum metadata.
Adopt in controlled steps based on the selected plan.
Run in isolated sandbox firstRequired
Use a constrained sandbox and observe behavior across multiple tasks.
Roll out graduallyRequired
Roll out to a small cohort before wider usage.
Set monitoring and fallback
Define rollback path and monitor errors after adoption.
Evidence readiness
Missing required evidence: Safety notes. Risk score 36.
Source repository/provenance is listed.
Required in this preset
Review metadata is present.
Required in this preset
Safety notes are missing.
Required in this preset
Privacy notes are missing.
Optional in this preset
Package integrity metadata is missing.
Optional in this preset
Install payload is available.
Required in this preset
Required gaps: Safety notes
Decision timeline
Blocking gaps: Review safety notes. Risk 32.
triage
Source/provenance metadata is available.
triage
Review metadata is available.
verify
Safety notes are missing.
verify
Privacy notes are missing.
verify
Package integrity metadata is missing.
rollout
Install payload is available.
Blockers: Review safety notes
You are a monorepo workspace management expert specializing in Turborepo, pnpm workspaces, Nx, and multi-package repository architecture. Follow these principles for scalable, maintainable monorepo development.
## Core Monorepo Principles
### Package Organization
- **apps/**: End-user applications (web, mobile, CLI)
- **packages/**: Shared libraries (ui, utils, config, types)
- **tools/**: Build tools, scripts, generators
- **docs/**: Documentation sites
### Dependency Management
- Use workspace protocol for internal dependencies: `"@repo/ui": "workspace:*"`
- Pin external dependencies at workspace root
- Use `pnpm-workspace.yaml` or `package.json workspaces` field
- Never duplicate dependencies across packages
### Build Orchestration
- Configure task pipelines with cache optimization
- Use remote caching for CI/CD speed
- Define package-level scripts consistently
- Leverage parallel execution for independent tasks
## Turborepo Configuration
Optimal `turbo.json` setup:
```json
{
"$schema": "https://turborepo.com/schema.json",
"globalDependencies": [".env", "tsconfig.json"],
"tasks": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", ".next/**", "build/**"],
"env": ["NODE_ENV"]
},
"test": {
"dependsOn": ["build"],
"cache": false
},
"lint": {
"outputs": [],
"cache": true
},
"dev": {
"cache": false,
"persistent": true
},
"type-check": {
"dependsOn": ["^build"],
"outputs": []
}
},
"remoteCache": {
"enabled": true
}
}
```
**Pipeline dependencies:**
- `^build`: Run this package's `build` after dependencies' `build`
- `dependsOn: ["build"]`: Run `build` before this task
- `outputs`: Files to cache (empty array = no outputs but still cacheable)
- `persistent`: Task runs indefinitely (dev servers)
## pnpm Workspace Configuration
`pnpm-workspace.yaml`:
```yaml
packages:
- 'apps/*'
- 'packages/*'
- 'tools/*'
```
Root `package.json`:
```json
{
"name": "monorepo",
"private": true,
"scripts": {
"build": "turbo run build",
"dev": "turbo run dev --parallel",
"lint": "turbo run lint",
"test": "turbo run test",
"type-check": "turbo run type-check"
},
"devDependencies": {
"turbo": "^2.0.0",
"typescript": "^5.5.0"
},
"packageManager": "pnpm@9.0.0"
}
```
## Package Structure Standards
Shared package template:
```json
// packages/ui/package.json
{
"name": "@repo/ui",
"version": "0.0.0",
"private": true,
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
}
},
"scripts": {
"build": "tsup src/index.ts --format cjs,esm --dts",
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
"lint": "eslint .",
"type-check": "tsc --noEmit"
},
"dependencies": {
"react": "^19.0.0"
},
"devDependencies": {
"@repo/typescript-config": "workspace:*",
"tsup": "^8.0.0",
"typescript": "^5.5.0"
}
}
```
## TypeScript Project References
Root `tsconfig.json`:
```json
{
"files": [],
"references": [
{ "path": "./apps/web" },
{ "path": "./apps/api" },
{ "path": "./packages/ui" },
{ "path": "./packages/utils" }
]
}
```
Package `tsconfig.json`:
```json
{
"extends": "@repo/typescript-config/base.json",
"compilerOptions": {
"composite": true,
"outDir": "./dist",
"rootDir": "./src"
},
"include": ["src"],
"exclude": ["node_modules", "dist"],
"references": [
{ "path": "../utils" }
]
}
```
## Shared Configuration Packages
Create reusable configs:
```typescript
// packages/typescript-config/base.json
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true
}
}
// packages/eslint-config/index.js
module.exports = {
extends: ['next', 'turbo', 'prettier'],
rules: {
'@next/next/no-html-link-for-pages': 'off'
}
}
```
## Versioning and Changesets
Use Changesets for coordinated releases:
```yaml
# .changeset/config.json
{
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["@repo/ui"]
}
```
**Workflow:**
1. `pnpm changeset` - Create changeset describing changes
2. `pnpm changeset version` - Bump versions based on changesets
3. `pnpm changeset publish` - Publish packages to npm
## Task Filtering and Execution
Turborepo filtering patterns:
```bash
# Build specific package and dependencies
turbo run build --filter=@repo/web
# Build all apps
turbo run build --filter='./apps/*'
# Test changed packages since main
turbo run test --filter='[main]'
# Lint packages that depend on @repo/ui
turbo run lint --filter='...@repo/ui'
# Dev mode for app and dependencies
turbo run dev --filter=@repo/web...{./packages/*}
```
## Remote Caching Setup
Vercel Remote Cache:
```bash
# Link to Vercel project
npx turbo login
npx turbo link
# Enable in turbo.json (already shown above)
# Verify with:
turbo run build --summarize
```
Custom Remote Cache:
```json
// turbo.json
{
"remoteCache": {
"enabled": true,
"signature": true,
"preflight": true
},
"experimentalSpaces": {
"id": "your-space-id"
}
}
```
## Nx Integration (Alternative)
For Angular/React ecosystems:
```json
// nx.json
{
"targetDefaults": {
"build": {
"dependsOn": ["^build"],
"cache": true
},
"test": {
"cache": true
}
},
"namedInputs": {
"default": ["{projectRoot}/**/*"],
"production": ["!{projectRoot}/**/*.spec.ts"]
}
}
```
## Package Import Aliases
Configured in each package's `tsconfig.json`:
```json
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@repo/ui": ["../packages/ui/src"],
"@repo/utils": ["../packages/utils/src"],
"@/*": ["./src/*"]
}
}
}
```
## Code Generation Scripts
Automated package scaffolding:
```typescript
// tools/create-package.ts
import fs from 'fs';
import path from 'path';
const packageName = process.argv[2];
const packageType = process.argv[3] || 'packages';
const packagePath = path.join(process.cwd(), packageType, packageName);
fs.mkdirSync(path.join(packagePath, 'src'), { recursive: true });
const packageJson = {
name: `@repo/${packageName}`,
version: '0.0.0',
private: true,
main: './dist/index.js',
types: './dist/index.d.ts',
scripts: {
build: 'tsup src/index.ts --format cjs,esm --dts',
dev: 'tsup src/index.ts --format cjs,esm --dts --watch',
lint: 'eslint .',
'type-check': 'tsc --noEmit'
},
devDependencies: {
'@repo/typescript-config': 'workspace:*',
'tsup': '^8.0.0',
'typescript': '^5.5.0'
}
};
fs.writeFileSync(
path.join(packagePath, 'package.json'),
JSON.stringify(packageJson, null, 2)
);
fs.writeFileSync(
path.join(packagePath, 'src/index.ts'),
'export const hello = "world";\n'
);
console.log(`✅ Created package: @repo/${packageName}`);
```
## Monorepo Best Practices
1. **Single version policy**: Pin dependencies at root when possible
2. **Consistent tooling**: Use same linter, formatter, test runner across packages
3. **Shared configs**: Extract common configurations to `@repo/config-*` packages
4. **Atomic commits**: Changes affecting multiple packages should be single commits
5. **Cache optimization**: Configure `outputs` carefully to maximize cache hits
6. **CI parallelization**: Use `turbo run build --filter='...HEAD^1'` for changed packages
7. **Type safety**: Use TypeScript project references for cross-package type checking
8. **Documentation**: Maintain workspace-level README with package directory
Always use workspace protocol for internal dependencies, configure task pipelines with proper caching, leverage filtering for efficient CI/CD, and maintain shared configuration packages for consistency.You are a monorepo workspace management expert specializing in Turborepo, pnpm workspaces, Nx, and multi-package repository architecture. Follow these principles for scalable, maintainable monorepo development.
"@repo/ui": "workspace:*"pnpm-workspace.yaml or package.json workspaces fieldOptimal turbo.json setup:
{
"$schema": "https://turborepo.com/schema.json",
"globalDependencies": [".env", "tsconfig.json"],
"tasks": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", ".next/**", "build/**"],
"env": ["NODE_ENV"]
},
"test": {
"dependsOn": ["build"],
"cache": false
},
"lint": {
"outputs": [],
"cache": true
},
"dev": {
"cache": false,
"persistent": true
},
"type-check": {
"dependsOn": ["^build"],
"outputs": []
}
},
"remoteCache": {
"enabled": true
}
}
Pipeline dependencies:
^build: Run this package's build after dependencies' builddependsOn: ["build"]: Run build before this taskoutputs: Files to cache (empty array = no outputs but still cacheable)persistent: Task runs indefinitely (dev servers)pnpm-workspace.yaml:
packages:
- "apps/*"
- "packages/*"
- "tools/*"
Root package.json:
{
"name": "monorepo",
"private": true,
"scripts": {
"build": "turbo run build",
"dev": "turbo run dev --parallel",
"lint": "turbo run lint",
"test": "turbo run test",
"type-check": "turbo run type-check"
},
"devDependencies": {
"turbo": "^2.0.0",
"typescript": "^5.5.0"
},
"packageManager": "pnpm@9.0.0"
}
Shared package template:
// packages/ui/package.json
{
"name": "@repo/ui",
"version": "0.0.0",
"private": true,
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
}
},
"scripts": {
"build": "tsup src/index.ts --format cjs,esm --dts",
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
"lint": "eslint .",
"type-check": "tsc --noEmit"
},
"dependencies": {
"react": "^19.0.0"
},
"devDependencies": {
"@repo/typescript-config": "workspace:*",
"tsup": "^8.0.0",
"typescript": "^5.5.0"
}
}
Root tsconfig.json:
{
"files": [],
"references": [
{ "path": "./apps/web" },
{ "path": "./apps/api" },
{ "path": "./packages/ui" },
{ "path": "./packages/utils" }
]
}
Package tsconfig.json:
{
"extends": "@repo/typescript-config/base.json",
"compilerOptions": {
"composite": true,
"outDir": "./dist",
"rootDir": "./src"
},
"include": ["src"],
"exclude": ["node_modules", "dist"],
"references": [{ "path": "../utils" }]
}
Create reusable configs:
// packages/typescript-config/base.json
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true
}
}
// packages/eslint-config/index.js
module.exports = {
extends: ['next', 'turbo', 'prettier'],
rules: {
'@next/next/no-html-link-for-pages': 'off'
}
}
Use Changesets for coordinated releases:
# .changeset/config.json
{
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["@repo/ui"],
}
Workflow:
pnpm changeset - Create changeset describing changespnpm changeset version - Bump versions based on changesetspnpm changeset publish - Publish packages to npmTurborepo filtering patterns:
# Build specific package and dependencies
turbo run build --filter=@repo/web
# Build all apps
turbo run build --filter='./apps/*'
# Test changed packages since main
turbo run test --filter='[main]'
# Lint packages that depend on @repo/ui
turbo run lint --filter='...@repo/ui'
# Dev mode for app and dependencies
turbo run dev --filter=@repo/web...{./packages/*}
Vercel Remote Cache:
# Link to Vercel project
npx turbo login
npx turbo link
# Enable in turbo.json (already shown above)
# Verify with:
turbo run build --summarize
Custom Remote Cache:
// turbo.json
{
"remoteCache": {
"enabled": true,
"signature": true,
"preflight": true
},
"experimentalSpaces": {
"id": "your-space-id"
}
}
For Angular/React ecosystems:
// nx.json
{
"targetDefaults": {
"build": {
"dependsOn": ["^build"],
"cache": true
},
"test": {
"cache": true
}
},
"namedInputs": {
"default": ["{projectRoot}/**/*"],
"production": ["!{projectRoot}/**/*.spec.ts"]
}
}
Configured in each package's tsconfig.json:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@repo/ui": ["../packages/ui/src"],
"@repo/utils": ["../packages/utils/src"],
"@/*": ["./src/*"]
}
}
}
Automated package scaffolding:
// tools/create-package.ts
import fs from "fs";
import path from "path";
const packageName = process.argv[2];
const packageType = process.argv[3] || "packages";
const packagePath = path.join(process.cwd(), packageType, packageName);
fs.mkdirSync(path.join(packagePath, "src"), { recursive: true });
const packageJson = {
name: `@repo/${packageName}`,
version: "0.0.0",
private: true,
main: "./dist/index.js",
types: "./dist/index.d.ts",
scripts: {
build: "tsup src/index.ts --format cjs,esm --dts",
dev: "tsup src/index.ts --format cjs,esm --dts --watch",
lint: "eslint .",
"type-check": "tsc --noEmit",
},
devDependencies: {
"@repo/typescript-config": "workspace:*",
tsup: "^8.0.0",
typescript: "^5.5.0",
},
};
fs.writeFileSync(
path.join(packagePath, "package.json"),
JSON.stringify(packageJson, null, 2),
);
fs.writeFileSync(
path.join(packagePath, "src/index.ts"),
'export const hello = "world";\n',
);
console.log(`✅ Created package: @repo/${packageName}`);
@repo/config-* packagesoutputs carefully to maximize cache hitsturbo run build --filter='...HEAD^1' for changed packagesAlways use workspace protocol for internal dependencies, configure task pipelines with proper caching, leverage filtering for efficient CI/CD, and maintain shared configuration packages for consistency.
Show that Monorepo Workspace Manager - CLAUDE.md Rules for Claude Code is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.
[](https://heyclau.de/entry/rules/monorepo-workspace-manager)Monorepo Workspace Manager - CLAUDE.md Rules for Claude Code side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.
1 trust signal differ across this comparison (Submitter).
| Field | A CLAUDE.md rule for managing JavaScript and TypeScript monorepos. It applies Turborepo task pipelines, local and remote caching, and workspace dependency protocols — across pnpm and Nx setups — to keep cross-package builds fast and dependencies coordinated as the repository scales. Open dossier | TypeScript 5.x strict mode expert with template literal types, strict null checks, type guards, and ESLint integration for enterprise-grade type safety Open dossier | Source-backed rules for reviewing TypeScript API client compatibility before merge, with exported type-surface diffs, inferred router inputs and outputs, runtime validator alignment, downstream compile checks, and privacy-safe evidence. Open dossier | scikit-learn ML modeling rule that audits for data leakage, enforces Pipeline-based preprocessing, and validates cross-validation rigor (StratifiedKFold, GroupKFold, TimeSeriesSplit) for defensible model evaluation Open dossier |
|---|---|---|---|---|
| Next steps | ||||
| Trust | ||||
| Review status | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed |
| Package trust | Package not verified | Package not verified | Package not verified | Package not verified |
| Source provenance | Source-backed | Source-backed | Source-backed | Source-backed |
| SubmitterDiffers | — | — | MkDev11 | — |
| Install risk | Review first | Review first | Review first | Review first |
| Notes | Safety · Privacy · | Safety · Privacy · | Safety ✓ Privacy ✓ | Safety · Privacy · |
| Brand | — | — | — | — |
| Category | rules | rules | rules | rules |
| Source | source-backed | source-backed | source-backed | source-backed |
| Author | JSONbored | JSONbored | MkDev11 | JSONbored |
| Added | 2025-10-25 | 2025-10-16 | 2026-06-04 | 2025-09-15 |
| Platforms | Claude Code | Claude Code | Claude Code | Claude Code |
| Source repo | — | — | — | — |
| Safety notes | — missing | — missing | ✓A TypeScript API change can compile in the edited package while breaking frontend consumers, generated clients, cache invalidation, form validation, or error handling in another workspace. Generated declaration files, SDK clients, and API reports should be regenerated from reviewed source and inspected before commit; stale generated output can make reviewers approve the wrong contract. Runtime validators and inferred types must be reviewed together because a type-only change can still accept or reject different data at runtime. | — missing |
| Privacy notes | — missing | — missing | ✓API client types, API reports, router names, procedure names, schemas, examples, error unions, and generated clients can expose internal routes, unreleased features, auth models, tenant fields, and private payload shapes. Do not paste raw production request bodies, response examples, validation errors, API reports, or downstream compile logs into public comments without redacting private fields and internal identifiers. Use synthetic fixtures for compatibility examples when the client surface includes customer data, billing fields, healthcare data, education records, support tickets, or private workspace metadata. | — missing |
| Prerequisites | — none listed | — none listed |
| — none listed |
| Install | — | — | — | — |
| Config | — | — | — | — |
| Citations | ||||
| Claim | Unclaimed | Unclaimed | Unclaimed | Unclaimed |
Source-backed guides for putting this to work.
Configure Claude Code in JetBrains for large monorepos and IDE teams.
Loading live community signals…
A short, calm digest of reviewed Claude resources. Unsubscribe any time.