Monorepo Management skill for Claude

Master monorepo management with Turborepo, Nx, and pnpm workspaces to build efficient, scalable multi-package repositories with optimized builds and dependency management.

When Claude uses it

Use when setting up monorepos, optimizing builds, or managing shared dependencies.

Monorepo Management SKILL.md

The full skill file from wshobson/agents (MIT).

Monorepo Management

Build efficient, scalable monorepos that enable code sharing, consistent tooling, and atomic changes across multiple packages and applications.

When to Use This Skill

  • Setting up new monorepo projects
  • Migrating from multi-repo to monorepo
  • Optimizing build and test performance
  • Managing shared dependencies
  • Implementing code sharing strategies
  • Setting up CI/CD for monorepos
  • Versioning and publishing packages
  • Debugging monorepo-specific issues

Core Concepts

1. Why Monorepos?

Advantages:

  • Shared code and dependencies
  • Atomic commits across projects
  • Consistent tooling and standards
  • Easier refactoring
  • Simplified dependency management
  • Better code visibility

Challenges:

  • Build performance at scale
  • CI/CD complexity
  • Access control
  • Large Git repository

2. Monorepo Tools

Package Managers:

  • pnpm workspaces (recommended)
  • npm workspaces
  • Yarn workspaces

Build Systems:

  • Turborepo (recommended for most)
  • Nx (feature-rich, complex)
  • Lerna (older, maintenance mode)

Turborepo Setup

Initial Setup

# 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

Configuration

// turbo.json
{
  "$schema": "https://turbo.build/schema.json",
  "globalDependencies": ["**/.env.*local"],
  "tasks": {
    "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": []
    }
  }
}
// package.json (root)
{
  "name": "my-monorepo",
  "private": true,
  "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": "^2.0.0",
    "prettier": "^3.0.0",
    "typescript": "^5.0.0"
  },
  "packageManager": "pnpm@8.0.0"
}

pnpm reads workspace packages only from pnpm-workspace.yaml, so declare them there (see references/details.md). Turborepo 2 renamed pipeline to tasks and rejects a turbo.json that still uses pipeline; run npx @turbo/codemod migrate to upgrade a 1.x config.

Package Structure

// 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"
  }
}

Detailed patterns and worked examples

Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.

Best Practices

  1. Consistent Versioning: Lock dependency versions across workspace
  2. Shared Configs: Centralize ESLint, TypeScript, Prettier configs
  3. Dependency Graph: Keep it acyclic, avoid circular dependencies
  4. Cache Effectively: Configure inputs/outputs correctly
  5. Type Safety: Share types between frontend/backend
  6. Testing Strategy: Unit tests in packages, E2E in apps
  7. Documentation: README in each package
  8. Release Strategy: Use changesets for versioning

Common Pitfalls

  • Circular Dependencies: A depends on B, B depends on A
  • Phantom Dependencies: Using deps not in package.json
  • Incorrect Cache Inputs: Missing files in Turborepo inputs
  • Over-Sharing: Sharing code that should be separate
  • Under-Sharing: Duplicating code across packages
  • Large Monorepos: Without proper tooling, builds slow down

Publishing Packages

# Using Changesets
pnpm add -Dw @changesets/cli
pnpm changeset init

# Create changeset
pnpm changeset

# Version packages
pnpm changeset version

# Publish
pnpm changeset publish
# .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 }}

How to install Monorepo Management

Claude Code

Copy the skill into your personal skills folder (or into .claude/skills/ inside a project):

npx degit wshobson/agents/plugins/developer-essentials/skills/monorepo-management#main ~/.claude/skills/monorepo-management

Codex

npx degit wshobson/agents/plugins/developer-essentials/skills/monorepo-management#main ~/.codex/skills/monorepo-management

Claude.ai and Claude Desktop

Download the skill folder from GitHub, zip it, and upload it under Settings → Capabilities → Skills.

Frequently asked questions

+What does the Monorepo Management skill do?

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.

+How do I install Monorepo Management in Claude Code?

Copy the skill folder into ~/.claude/skills/monorepo-management, for example with "npx degit wshobson/agents/plugins/developer-essentials/skills/monorepo-management#main ~/.claude/skills/monorepo-management". Claude Code loads it automatically and uses it when a task matches.

+Does Monorepo Management work with ChatGPT or Codex?

Yes. Monorepo Management uses the open SKILL.md format. In Codex, put the folder in ~/.codex/skills/monorepo-management. In Claude.ai, zip the folder and upload it under Settings → Capabilities → Skills.

+Is Monorepo Management free?

Monorepo Management is published on GitHub by wshobson under the MIT license, which allows free use.

Related business & strategy skills

  1. Pm Skills

    Router for project-management skills: sprints, portfolio health, Jira, Confluence, stakeholder comms, plus a delivery loop.

    alirezarezvani/claude-skills★ 30k
  2. Ceo Advisor

    Advice for a CEO or founder on running the company: board and investor trouble, raise or cut, strategy bets, org and culture.

    alirezarezvani/claude-skills★ 30k
  3. Content Strategy

    When the user wants to plan content, or asks which topic or piece to prioritize, what to write about, or why posts bring no customers:…

    coreyhaines31/marketingskills★ 61k
  4. Secrets Management

    Implement secure secrets management for CI/CD pipelines using Vault, AWS Secrets Manager, or native platform solutions.

    wshobson/agents★ 43k
  5. Startup Metrics Framework

    Track, calculate, and optimize key performance metrics for SaaS, marketplace, consumer, and B2B startups from seed through Series A,…

    wshobson/agents★ 43k
  6. Team Composition Analysis

    Design optimal team structures, hiring plans, compensation strategies, and equity allocation for early-stage startups from pre-seed through…

    wshobson/agents★ 43k
  7. Track Management

    Use this skill when creating, managing, or working with Conductor tracks - the logical work units for features, bugs, and refactors.

    wshobson/agents★ 43k
  8. Agent Protocol

    Use when C-suite advisor agents need to call each other or run a multi-role meeting.

    alirezarezvani/claude-skills★ 30k
  9. Arquiteto De Empresa

    Use when a founder wants to document or design a whole company as version-controlled markdown (company as code, a company wiki agents can…

    alirezarezvani/claude-skills★ 30k

See all business & strategy skills →

More skills from wshobson

  1. Mtls Configuration

    Configure mutual TLS (mTLS) for zero-trust service-to-service communication.

    wshobson/agents★ 43k
  2. Multi Cloud Architecture

    Design multi-cloud architectures using a decision framework to select and integrate services across AWS, Azure, GCP, and OCI.

    wshobson/agents★ 43k
  3. Multi Reviewer Patterns

    Coordinate parallel code reviews across multiple quality dimensions with finding deduplication, severity calibration, and consolidated…

    wshobson/agents★ 43k

All skills by wshobson →

Give your whole team an AI agent with skills

Cody runs managed AI agents your team can message in Slack, Teams, WhatsApp and the web, with 50+ business integrations, scheduled tasks and memory. No terminal required.