Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Master monorepo management with Turborepo, Nx, and pnpm workspaces to build efficient, scalable multi-package repositories with optimized builds and dependency management. Use when setting up monorepos, optimizing builds, or managing shared dependencies.
.claude/skills/dicklesworthstone-monorepo-management/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-10 | ✗→✓ | ▲ Improved | 148% | 0% |
| case-13 | ✗→✓ | ▲ Improved | 140% | 0% |
| case-16 | ✗→✓ | ▲ Improved | 172% | 0% |
| case-18 | ✗→✓ | ▲ Improved | 174% | 0% |
| case-17 | ✓→✓ | = Same ✓ | 177% | 0% |
Build efficient, scalable monorepos that enable code sharing, consistent tooling, and atomic changes across multiple packages and applications.
Advantages:
Challenges:
Package Managers:
Build Systems:
bash# Create new monorepo npx create-turbo@latest my-monorepo cd my-monorepo # Structure: # apps/ # web/ - Next.js app # docs/ - Documentation site # packages/ # ui/ - Shared UI components # config/ - Shared configurations # tsconfig/ - Shared TypeScript configs # turbo.json - Turborepo configuration # package.json - Root package.json
json// turbo.json { "$schema": "https://turbo.build/schema.json", "globalDependencies": ["**/.env.*local"], "pipeline": { "build": { "dependsOn": ["^build"], "outputs": ["dist/**", ".next/**", "!.next/cache/**"] }, "test": { "dependsOn": ["build"], "outputs": ["coverage/**"] }, "lint": { "outputs": [] }, "dev": { "cache": false, "persistent": true }, "type-check": { "dependsOn": ["^build"], "outputs": [] } } }
json// package.json (root) { "name": "my-monorepo", "private": true, "workspaces": ["apps/*", "packages/*"], "scripts": { "build": "turbo run build", "dev": "turbo run dev", "test": "turbo run test", "lint": "turbo run lint", "format": "prettier --write \"**/*.{ts,tsx,md}\"", "clean": "turbo run clean && rm -rf node_modules" }, "devDependencies": { "turbo": "^1.10.0", "prettier": "^3.0.0", "typescript": "^5.0.0" }, "packageManager": "pnpm@8.0.0" }
json// packages/ui/package.json { "name": "@repo/ui", "version": "0.0.0", "private": true, "main": "./dist/index.js", "types": "./dist/index.d.ts", "exports": { ".": { "import": "./dist/index.js", "types": "./dist/index.d.ts" }, "./button": { "import": "./dist/button.js", "types": "./dist/button.d.ts" } }, "scripts": { "build": "tsup src/index.ts --format esm,cjs --dts", "dev": "tsup src/index.ts --format esm,cjs --dts --watch", "lint": "eslint src/", "type-check": "tsc --noEmit" }, "devDependencies": { "@repo/tsconfig": "workspace:*", "tsup": "^7.0.0", "typescript": "^5.0.0" }, "dependencies": { "react": "^18.2.0" } }
yaml# pnpm-workspace.yaml packages: - "apps/*" - "packages/*" - "tools/*"
json// .npmrc # Hoist shared dependencies shamefully-hoist=true # Strict peer dependencies auto-install-peers=true strict-peer-dependencies=true # Performance store-dir=~/.pnpm-store
bash# Install dependency in specific package pnpm add react --filter @repo/ui pnpm add -D typescript --filter @repo/ui # Install workspace dependency pnpm add @repo/ui --filter web # Install in all packages pnpm add -D eslint -w # Update all dependencies pnpm update -r # Remove dependency pnpm remove react --filter @repo/ui
bash# Run script in specific package pnpm --filter web dev pnpm --filter @repo/ui build # Run in all packages pnpm -r build pnpm -r test # Run in parallel pnpm -r --parallel dev # Filter by pattern pnpm --filter "@repo/*" build pnpm --filter "...web" build # Build web and dependencies
bash# Create Nx monorepo npx create-nx-workspace@latest my-org # Generate applications nx generate @nx/react:app my-app nx generate @nx/next:app my-next-app # Generate libraries nx generate @nx/react:lib ui-components nx generate @nx/js:lib utils
json// nx.json { "extends": "nx/presets/npm.json", "$schema": "./node_modules/nx/schemas/nx-schema.json", "targetDefaults": { "build": { "dependsOn": ["^build"], "inputs": ["production", "^production"], "cache": true }, "test": { "inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"], "cache": true }, "lint": { "inputs": ["default", "{workspaceRoot}/.eslintrc.json"], "cache": true } }, "namedInputs": { "default": ["{projectRoot}/**/*", "sharedGlobals"], "production": [ "default", "!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)", "!{projectRoot}/tsconfig.spec.json" ], "sharedGlobals": [] } }
bash# Run task for specific project nx build my-app nx test ui-components nx lint utils # Run for affected projects nx affected:build nx affected:test --base=main # Visualize dependencies nx graph # Run in parallel nx run-many --target=build --all --parallel=3
json// packages/tsconfig/base.json { "compilerOptions": { "strict": true, "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, "module": "ESNext", "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, "incremental": true, "declaration": true }, "exclude": ["node_modules"] } // packages/tsconfig/react.json { "extends": "./base.json", "compilerOptions": { "jsx": "react-jsx", "lib": ["ES2022", "DOM", "DOM.Iterable"] } } // apps/web/tsconfig.json { "extends": "@repo/tsconfig/react.json", "compilerOptions": { "outDir": "dist", "rootDir": "src" }, "include": ["src"], "exclude": ["node_modules", "dist"] }
javascript// packages/config/eslint-preset.js module.exports = { extends: [ "eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:react/recommended", "plugin:react-hooks/recommended", "prettier", ], plugins: ["@typescript-eslint", "react", "react-hooks"], parser: "@typescript-eslint/parser", parserOptions: { ecmaVersion: 2022, sourceType: "module", ecmaFeatures: { jsx: true, }, }, settings: { react: { version: "detect", }, }, rules: { "@typescript-eslint/no-unused-vars": "error", "react/react-in-jsx-scope": "off", }, }; // apps/web/.eslintrc.js module.exports = { extends: ["@repo/config/eslint-preset"], rules: { // App-specific rules }, };
typescript// packages/ui/src/button.tsx import * as React from 'react'; export interface ButtonProps { variant?: 'primary' | 'secondary'; children: React.ReactNode; onClick?: () => void; } export function Button({ variant = 'primary', children, onClick }: ButtonProps) { return ( <button className={`btn btn-${variant}`} onClick={onClick} > {children} </button> ); } // packages/ui/src/index.ts export { Button, type ButtonProps } from './button'; export { Input, type InputProps } from './input'; // apps/web/src/app.tsx import { Button } from '@repo/ui'; export function App() { return <Button variant="primary">Click me</Button>; }
typescript// packages/utils/src/string.ts export function capitalize(str: string): string { return str.charAt(0).toUpperCase() + str.slice(1); } export function truncate(str: string, length: number): string { return str.length > length ? str.slice(0, length) + "..." : str; } // packages/utils/src/index.ts export * from "./string"; export * from "./array"; export * from "./date"; // Usage in apps import { capitalize, truncate } from "@repo/utils";
typescript// packages/types/src/user.ts export interface User { id: string; email: string; name: string; role: "admin" | "user"; } export interface CreateUserInput { email: string; name: string; password: string; } // Used in both frontend and backend import type { User, CreateUserInput } from "@repo/types";
json// turbo.json { "pipeline": { "build": { // Build depends on dependencies being built first "dependsOn": ["^build"], // Cache these outputs "outputs": ["dist/**", ".next/**"], // Cache based on these inputs (default: all files) "inputs": ["src/**/*.tsx", "src/**/*.ts", "package.json"] }, "test": { // Run tests in parallel, don't depend on build "cache": true, "outputs": ["coverage/**"] } } }
bash# Turborepo Remote Cache (Vercel) npx turbo login npx turbo link # Custom remote cache # turbo.json { "remoteCache": { "signature": true, "enabled": true } }
yaml# .github/workflows/ci.yml name: CI on: push: branches: [main] pull_request: branches: [main] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: fetch-depth: 0 # For Nx affected commands - uses: pnpm/action-setup@v2 with: version: 8 - uses: actions/setup-node@v3 with: node-version: 18 cache: "pnpm" - name: Install dependencies run: pnpm install --frozen-lockfile - name: Build run: pnpm turbo run build - name: Test run: pnpm turbo run test - name: Lint run: pnpm turbo run lint - name: Type check run: pnpm turbo run type-check
yaml# Deploy only changed apps - name: Deploy affected apps run: | if pnpm nx affected:apps --base=origin/main --head=HEAD | grep -q "web"; then echo "Deploying web app" pnpm --filter web deploy fi
bash# Using Changesets pnpm add -Dw @changesets/cli pnpm changeset init # Create changeset pnpm changeset # Version packages pnpm changeset version # Publish pnpm changeset publish
yaml# .github/workflows/release.yml - name: Create Release Pull Request or Publish uses: changesets/action@v1 with: publish: pnpm release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-17 | pass→pass | 10,350 | 8,632 | -17% | 1 | 1 | 0% | 1,951 | 5,408 | +177% | 0 | 0 | — |
case-01 | fail→fail | 15,909 | 23,880 | +50% | 1 | 1 | 0% | 2,888 | 6,211 | +115% | 0 | 0 | — |
case-02 | pass→pass | 10,485 | 8,262 | -21% | 1 | 1 | 0% | 1,720 | 4,997 | +191% | 0 | 0 | — |
case-03 | fail→fail | 18,867 | 16,673 | -12% | 1 | 1 | 0% | 3,737 | 6,866 | +84% | 0 | 0 | — |
case-04 | pass→pass | 11,123 | 8,677 | -22% | 1 | 1 | 0% | 2,031 | 5,444 | +168% | 0 | 0 | — |
case-05 | fail→fail | 12,754 | 9,625 | -25% | 1 | 1 | 0% | 2,478 | 5,671 | +129% | 0 | 0 | — |
case-06 | pass→pass | 10,701 | 8,441 | -21% | 1 | 1 | 0% | 1,815 | 5,126 | +182% | 0 | 0 | — |
case-07 | pass→pass | 6,096 | 4,121 | -32% | 1 | 1 | 0% | 1,153 | 4,525 | +292% | 0 | 0 | — |
case-08 | pass→pass | 6,708 | 5,345 | -20% | 1 | 1 | 0% | 1,388 | 4,838 | +249% | 0 | 0 | — |
case-09 | pass→pass | 11,022 | 9,648 | -12% | 1 | 1 | 0% | 2,103 | 5,709 | +171% | 0 | 0 | — |
case-10 | fail→pass | 13,710 | 14,078 | +3% | 1 | 1 | 0% | 2,640 | 6,540 | +148% | 0 | 0 | — |
case-11 | pass→pass | 8,766 | 8,867 | +1% | 1 | 1 | 0% | 1,876 | 5,662 | +202% | 0 | 0 | — |
case-12 | pass→pass | 8,961 | 8,231 | -8% | 1 | 1 | 0% | 1,964 | 5,679 | +189% | 0 | 0 | — |
case-13 | fail→pass | 12,337 | 11,513 | -7% | 1 | 1 | 0% | 2,472 | 5,930 | +140% | 0 | 0 | — |
case-14 | pass→pass | 11,926 | 7,464 | -37% | 1 | 1 | 0% | 2,004 | 4,974 | +148% | 0 | 0 | — |
case-15 | pass→pass | 10,088 | 10,069 | -0% | 1 | 1 | 0% | 1,950 | 5,282 | +171% | 0 | 0 | — |
case-16 | fail→pass | 12,935 | 6,397 | -51% | 1 | 1 | 0% | 1,778 | 4,840 | +172% | 0 | 0 | — |
case-18 | fail→pass | 11,048 | 8,856 | -20% | 1 | 1 | 0% | 1,928 | 5,291 | +174% | 0 | 0 | — |
case-19 | pass→pass | 15,257 | 14,321 | -6% | 1 | 1 | 0% | 2,501 | 6,488 | +159% | 0 | 0 | — |
case-20 | pass→pass | 13,592 | 14,277 | +5% | 1 | 1 | 0% | 2,207 | 5,876 | +166% | 0 | 0 | — |
case-21 | pass→pass | 10,144 | 9,008 | -11% | 1 | 1 | 0% | 2,044 | 5,745 | +181% | 0 | 0 | — |
case-22 | pass→pass | 13,399 | 8,752 | -35% | 1 | 1 | 0% | 2,110 | 5,527 | +162% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +18 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.