From example-skills
Manages monorepos and multi-package repositories using pnpm/npm workspaces, Turborepo for selective builds and change detection, and Python patterns. For setup and workspace management.
How this skill is triggered — by the user, by Claude, or both
Slash command
/example-skills:monorepo-managementThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Organize and build multi-package repositories efficiently.
Organize and build multi-package repositories efficiently.
| Situation | Monorepo | Polyrepo |
|---|---|---|
| Shared libraries across packages | Yes | No |
| Tight coupling between packages | Yes | No |
| Independent release cycles needed | No | Yes |
| Different teams, different cadences | No | Yes |
| Atomic cross-package changes | Yes | No |
| < 20 packages | Yes | Either |
| > 100 packages | Depends | Often better |
# pnpm-workspace.yaml
packages:
- "packages/*"
- "apps/*"
- "tools/*"
// package.json (root)
{
"private": true,
"scripts": {
"build": "turbo build",
"test": "turbo test",
"lint": "turbo lint"
}
}
monorepo/
├── pnpm-workspace.yaml
├── turbo.json
├── package.json
├── packages/
│ ├── ui/ # Shared UI components
│ │ ├── package.json
│ │ └── src/
│ ├── config/ # Shared config (ESLint, TS)
│ │ └── package.json
│ └── utils/ # Shared utilities
│ └── package.json
├── apps/
│ ├── web/ # Next.js app
│ │ └── package.json
│ └── api/ # Express API
│ └── package.json
└── tools/
└── scripts/ # Build/deploy scripts
// apps/web/package.json
{
"dependencies": {
"@myorg/ui": "workspace:*",
"@myorg/utils": "workspace:*"
}
}
// turbo.json
{
"$schema": "https://turbo.build/schema.json",
"tasks": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", ".next/**"]
},
"test": {
"dependsOn": ["build"],
"outputs": []
},
"lint": {
"outputs": []
},
"dev": {
"persistent": true,
"cache": false
}
}
}
# Build only packages affected by changes
turbo build --filter=...[HEAD~1]
# Build a specific package and its dependencies
turbo build --filter=@myorg/web
# Build everything that depends on a package
turbo build --filter=...@myorg/ui
monorepo/
├── pyproject.toml # Root with all optional deps
├── packages/
│ ├── core/
│ │ ├── pyproject.toml
│ │ └── src/core/
│ ├── api/
│ │ ├── pyproject.toml
│ │ └── src/api/
│ └── worker/
│ ├── pyproject.toml
│ └── src/worker/
└── tests/
# Root pyproject.toml
[project]
name = "monorepo"
dependencies = []
[project.optional-dependencies]
core = ["./packages/core"]
api = ["./packages/api"]
worker = ["./packages/worker"]
dev = ["pytest", "ruff", "mypy"]
all = ["monorepo[core,api,worker,dev]"]
pip install -e ".[all]"
packages/core/src/myorg/core/__init__.py
packages/api/src/myorg/api/__init__.py
# Both install into the `myorg` namespace
// .syncpackrc (syncpack)
{
"versionGroups": [
{
"dependencies": ["react", "react-dom"],
"packages": ["**"],
"pinVersion": "^18.3.0"
}
]
}
# Check version consistency
syncpack list-mismatches
# Fix mismatches
syncpack fix-mismatches
# Visualize internal dependencies
turbo ls --graph
# nx
nx graph
#!/usr/bin/env bash
set -euo pipefail
# Detect which packages changed
CHANGED=$(git diff --name-only HEAD~1 | grep '^packages/' | cut -d/ -f2 | sort -u)
for pkg in $CHANGED; do
echo "Building packages/$pkg"
cd "packages/$pkg" && npm run build && cd ../..
done
jobs:
detect-changes:
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.changes.outputs.packages }}
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 2 }
- id: changes
run: |
PKGS=$(git diff --name-only HEAD~1 | grep '^packages/' | cut -d/ -f2 | sort -u | jq -R -s -c 'split("\n") | map(select(. != ""))')
echo "packages=$PKGS" >> $GITHUB_OUTPUT
build:
needs: detect-changes
if: needs.detect-changes.outputs.packages != '[]'
strategy:
matrix:
package: ${{ fromJson(needs.detect-changes.outputs.packages) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cd packages/${{ matrix.package }} && npm ci && npm run build
npx claudepluginhub organvm/a-i--skills --plugin coliseum-from-grainGuides setup and optimization of Turborepo, Nx, or pnpm monorepos including build caching, pipeline config, and code sharing.
Detect and navigate monorepos correctly. Use when working with repos containing multiple packages (pnpm/yarn/npm workspaces, Turborepo, Nx, Lerna). Ensures commands run in correct package scope, dependencies are routed properly, and cross-package changes are coordinated.
Manages monorepo architectures using Lerna, Turborepo, and Nx. Covers workspace configuration, dependency versioning, and cross-package testing.