Generated banner for Monorepo Management
Generated logo for Monorepo Management

Monorepo Management

Seth HobsonCommunityCreated by Seth Hobson

  • Skill
  • Tool integration
  • Software development
  • MIT
  • No issues found

From the author

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.
— the description by Seth Hobson

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a comprehensive framework for managing monorepos, focusing on build optimization, dependency management, and code sharing. It covers the setup and configuration of industry-standard tools like Turborepo, Nx, and pnpm workspaces to ensure scalable development workflows. The guide addresses common challenges such as build performance, circular dependencies, and CI/CD complexity, offering best practices for maintaining consistent standards across multiple packages and applications.

What it does

  • Guides the setup of monorepos using pnpm workspaces, Turborepo, or Nx.
  • Provides configuration patterns for build systems to optimize task execution and caching.
  • Demonstrates how to centralize shared configurations for TypeScript and ESLint.
  • Outlines strategies for managing dependencies and avoiding common pitfalls like phantom dependencies.
  • Explains how to implement CI/CD workflows for monorepo publishing and versioning.
  • Offers techniques for visualizing dependency graphs and running affected project tasks.

When to use it

  • When initiating a new project that requires multiple packages or applications in one repository.
  • When migrating existing multi-repo projects into a unified monorepo structure.
  • When build times or dependency management have become bottlenecks in a large project.
  • When you need to enforce consistent tooling and code-sharing standards across teams.
  • When setting up automated versioning and publishing for multiple packages.

Advantages

  • Enables atomic commits and easier refactoring across the entire codebase.
  • Improves build performance through intelligent caching and task orchestration.
  • Simplifies dependency management by centralizing shared libraries and configurations.
  • Provides better code visibility and consistent standards across projects.
  • Supports scalable development by allowing targeted builds and tests for affected projects.

Usage examples

“How do I set up a new monorepo using Turborepo and pnpm?”
The agent provides the commands to initialize a Turborepo project and explains the necessary pnpm-workspace.yaml configuration for managing packages.
“How can I optimize my build process in a large Nx monorepo?”
The agent explains how to configure targetDefaults in nx.json and use affected commands to run only the necessary builds and tests.
“What is the best way to share TypeScript configurations across my monorepo packages?”
The agent demonstrates how to create a base tsconfig in a shared package and extend it in individual application configurations.
“How do I publish multiple packages in my monorepo using Changesets?”
The agent outlines the workflow for initializing Changesets, creating change records, and configuring the GitHub Action for automated publishing.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/wshobson/monorepo-management/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip monorepo-management.zip -d .agents/skills

Documentation by Seth Hobson

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": "[email protected]"
}

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

Files

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs Node.js

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
Seth Hobson
Publisher
Seth Hobson (Community)
Source
wshobson/agents · plugins/developer-essentials/skills/monorepo-management · commit 4bde316
Licence
MIT License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Seth Hobson or Seth Hobson.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download monorepo-management.zip