Monorepo Management
Unverified●24/40Claude Code◐PartialHas SKILL.md but declares no allowed-tools — Claude Code will ask for permission each time
Cursor·UnknownWe have not crawled the repo tree, so we will not guess
Codex·UnknownWe have not crawled the repo tree, so we will not guess
Gemini CLI·UnknownThe spec defines no detection rule for Gemini
Copilot·UnknownWe have not crawled the repo tree, so we will not guess
npx agentalley add monorepo-managementWho is stuck, and on what
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 whole source
Frontmatter — 2 properties
| name | monorepo-management |
|---|---|
| description | 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. |
| 1 | --- |
| 2 | name: monorepo-management |
| 3 | description: 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. |
| 4 | ---A5 — No allowed-tools declared — no way to tell what this skill may touch |
| 5 | |
| 6 | # Monorepo Management |
| 7 | |
| 8 | Build efficient, scalable monorepos that enable code sharing, consistent tooling, and atomic changes across multiple packages and applications. |
| 9 | |
| 10 | ## When to Use This Skill |
| 11 | |
| 12 | - Setting up new monorepo projects |
| 13 | - Migrating from multi-repo to monorepo |
| 14 | - Optimizing build and test performance |
| 15 | - Managing shared dependencies |
| 16 | - Implementing code sharing strategies |
| 17 | - Setting up CI/CD for monorepos |
| 18 | - Versioning and publishing packages |
| 19 | - Debugging monorepo-specific issues |
| 20 | |
| 21 | ## Core Concepts |
| 22 | |
| 23 | ### 1. Why Monorepos? |
| 24 | |
| 25 | **Advantages:** |
| 26 | |
| 27 | - Shared code and dependencies |
| 28 | - Atomic commits across projects |
| 29 | - Consistent tooling and standards |
| 30 | - Easier refactoring |
| 31 | - Simplified dependency management |
| 32 | - Better code visibility |
| 33 | |
| 34 | **Challenges:** |
| 35 | |
| 36 | - Build performance at scale |
| 37 | - CI/CD complexity |
| 38 | - Access control |
| 39 | - Large Git repository |
| 40 | |
| 41 | ### 2. Monorepo Tools |
| 42 | |
| 43 | **Package Managers:** |
| 44 | |
| 45 | - pnpm workspaces (recommended) |
| 46 | - npm workspaces |
| 47 | - Yarn workspaces |
| 48 | |
| 49 | **Build Systems:** |
| 50 | |
| 51 | - Turborepo (recommended for most) |
| 52 | - Nx (feature-rich, complex) |
| 53 | - Lerna (older, maintenance mode) |
| 54 | |
| 55 | ## Turborepo Setup |
| 56 | |
| 57 | ### Initial Setup |
| 58 | |
| 59 | ```bash |
| 60 | # Create new monorepo |
| 61 | npx create-turbo@latest my-monorepo |
| 62 | cd my-monorepo |
| 63 | |
| 64 | # Structure: |
| 65 | # apps/ |
| 66 | # web/ - Next.js app |
| 67 | # docs/ - Documentation site |
| 68 | # packages/ |
| 69 | # ui/ - Shared UI components |
| 70 | # config/ - Shared configurations |
| 71 | # tsconfig/ - Shared TypeScript configs |
| 72 | # turbo.json - Turborepo configuration |
| 73 | # package.json - Root package.json |
| 74 | ``` |
| 75 | |
| 76 | ### Configuration |
| 77 | |
| 78 | ```json |
| 79 | // turbo.json |
| 80 | { |
| 81 | "$schema": "https://turbo.build/schema.json",A2 — Sends to turbo.build — outside the allowlist, and this file also reads environment variables or keys |
| 82 | "globalDependencies": ["**/.env.*local"], |
| 83 | "pipeline": { |
| 84 | "build": { |
| 85 | "dependsOn": ["^build"], |
| 86 | "outputs": ["dist/**", ".next/**", "!.next/cache/**"] |
| 87 | }, |
| 88 | "test": { |
| 89 | "dependsOn": ["build"], |
| 90 | "outputs": ["coverage/**"] |
| 91 | }, |
| 92 | "lint": { |
| 93 | "outputs": [] |
| 94 | }, |
| 95 | "dev": { |
| 96 | "cache": false, |
| 97 | "persistent": true |
| 98 | }, |
| 99 | "type-check": { |
| 100 | "dependsOn": ["^build"], |
| 101 | "outputs": [] |
| 102 | } |
| 103 | } |
| 104 | } |
| 105 | ``` |
| 106 | |
| 107 | ```json |
| 108 | // package.json (root) |
| 109 | { |
| 110 | "name": "my-monorepo", |
| 111 | "private": true, |
| 112 | "workspaces": ["apps/*", "packages/*"], |
| 113 | "scripts": { |
| 114 | "build": "turbo run build", |
| 115 | "dev": "turbo run dev", |
| 116 | "test": "turbo run test", |
| 117 | "lint": "turbo run lint", |
| 118 | "format": "prettier --write \"**/*.{ts,tsx,md}\"", |
| 119 | "clean": "turbo run clean && rm -rf node_modules" |
| 120 | }, |
| 121 | "devDependencies": { |
| 122 | "turbo": "^1.10.0", |
| 123 | "prettier": "^3.0.0", |
| 124 | "typescript": "^5.0.0" |
| 125 | }, |
| 126 | "packageManager": "[email protected]" |
| 127 | } |
| 128 | ``` |
| 129 | |
| 130 | ### Package Structure |
| 131 | |
| 132 | ```json |
| 133 | // packages/ui/package.json |
| 134 | { |
| 135 | "name": "@repo/ui", |
| 136 | "version": "0.0.0", |
| 137 | "private": true, |
| 138 | "main": "./dist/index.js", |
| 139 | "types": "./dist/index.d.ts", |
| 140 | "exports": { |
| 141 | ".": { |
| 142 | "import": "./dist/index.js", |
| 143 | "types": "./dist/index.d.ts" |
| 144 | }, |
| 145 | "./button": { |
| 146 | "import": "./dist/button.js", |
| 147 | "types": "./dist/button.d.ts" |
| 148 | } |
| 149 | }, |
| 150 | "scripts": { |
| 151 | "build": "tsup src/index.ts --format esm,cjs --dts", |
| 152 | "dev": "tsup src/index.ts --format esm,cjs --dts --watch", |
| 153 | "lint": "eslint src/", |
| 154 | "type-check": "tsc --noEmit" |
| 155 | }, |
| 156 | "devDependencies": { |
| 157 | "@repo/tsconfig": "workspace:*", |
| 158 | "tsup": "^7.0.0", |
| 159 | "typescript": "^5.0.0" |
| 160 | }, |
| 161 | "dependencies": { |
| 162 | "react": "^18.2.0" |
| 163 | } |
| 164 | } |
| 165 | ``` |
| 166 | |
| 167 | ## Detailed patterns and worked examples |
| 168 | |
| 169 | Detailed pattern documentation lives in `references/details.md`. Read that file when the navigation tier above is insufficient. |
| 170 | |
| 171 | ## Best Practices |
| 172 | |
| 173 | 1. **Consistent Versioning**: Lock dependency versions across workspace |
| 174 | 2. **Shared Configs**: Centralize ESLint, TypeScript, Prettier configs |
| 175 | 3. **Dependency Graph**: Keep it acyclic, avoid circular dependencies |
| 176 | 4. **Cache Effectively**: Configure inputs/outputs correctly |
| 177 | 5. **Type Safety**: Share types between frontend/backend |
| 178 | 6. **Testing Strategy**: Unit tests in packages, E2E in apps |
| 179 | 7. **Documentation**: README in each package |
| 180 | 8. **Release Strategy**: Use changesets for versioning |
| 181 | |
| 182 | ## Common Pitfalls |
| 183 | |
| 184 | - **Circular Dependencies**: A depends on B, B depends on A |
| 185 | - **Phantom Dependencies**: Using deps not in package.json |
| 186 | - **Incorrect Cache Inputs**: Missing files in Turborepo inputs |
| 187 | - **Over-Sharing**: Sharing code that should be separate |
| 188 | - **Under-Sharing**: Duplicating code across packages |
| 189 | - **Large Monorepos**: Without proper tooling, builds slow down |
| 190 | |
| 191 | ## Publishing Packages |
| 192 | |
| 193 | ```bash |
| 194 | # Using Changesets |
| 195 | pnpm add -Dw @changesets/cli |
| 196 | pnpm changeset init |
| 197 | |
| 198 | # Create changeset |
| 199 | pnpm changeset |
| 200 | |
| 201 | # Version packages |
| 202 | pnpm changeset version |
| 203 | |
| 204 | # Publish |
| 205 | pnpm changeset publish |
| 206 | ``` |
| 207 | |
| 208 | ```yaml |
| 209 | # .github/workflows/release.yml |
| 210 | - name: Create Release Pull Request or Publish |
| 211 | uses: changesets/action@v1 |
| 212 | with: |
| 213 | publish: pnpm release |
| 214 | env: |
| 215 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 216 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 217 | ``` |
| 218 |
Reviews
Installed this one?Write the first review and take the Trailblazer badge.
Alternatives
Subagent Driven DevelopmentUse when executing implementation plans with independent tasks in the current session◐◐◐◐◐●36/40Python Code Style & DocumentationPython code style, linting, formatting, naming conventions, and documentation standards. Use when writing new code, reviewing style, configuring linters, writing docstrings, or establishing project standards.◐····●35/40Competitor Price Analysis 💲Competitor pricing strategy analysis and market positioning. Price mapping, pricing gaps identification, elasticity signals evaluation, and strategic pricing optimization. Use when the user asks about competitor pricing, price analysis, pricing strategy, or co◐····●34/40Competitor Price Tracker 📊Set up competitor price tracking and monitoring workflows. Track price changes, detect promotions, analyze pricing patterns, and get alerts for competitive price movements.◐····●34/40