Claude-prime monorepo
MUST use for ANY query mentioning packages, monorepo, workspace, catalog, turbo, turborepo, or pnpm in a multi-package context. MUST use when sharing config (ESLint, tsconfig, prettier) across packages, fixing build order between packages, adding new packages, scoping CI installs/caching to changed packages, or debugging pnpm catalog version resolution. This skill OWNS all cross-package coordination problems — even when they look like build, CI, config, or dependency issues. If two or more packages interact in the query, this skill applies. Takes priority over other skills when the problem spans package boundaries.
install
source · Clone the upstream repo
git clone https://github.com/avibebuilder/claude-prime
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/avibebuilder/claude-prime "$T" && mkdir -p ~/.claude/skills && cp -r "$T/.claude/starter-skills/monorepo" ~/.claude/skills/avibebuilder-claude-prime-monorepo && rm -rf "$T"
manifest:
.claude/starter-skills/monorepo/SKILL.mdsource content
Monorepo
Project-specific patterns for pnpm workspaces + Turborepo.
Architecture Decisions
Workspace Organization
- Split apps from packages —
for deployables,apps/
for shared libraries.packages/ - Namespace packages — Prefix with
to avoid npm conflicts.@org/ - Single lockfile —
at root only. Never commit multiple lockfiles.pnpm-lock.yaml - No cross-package file access — Never use
to reach into other packages; import via dependencies.../
Dependency Management
- Use
protocol — Always for internal package dependencies.workspace:* - Hoist common devDependencies — Shared tooling (TypeScript, ESLint) in root.
- Peer dependencies for frameworks — React, Vue, etc. as peers to avoid version conflicts.
- Consider Catalogs (pnpm 9.5+) — Centralize versions in
for large repos.pnpm-workspace.yaml
Turborepo Tasks
- Use
for build dependencies —^
for topological order."dependsOn": ["^build"] - Always define
— Without outputs, nothing gets cached.outputs - Mark dev servers as persistent —
."persistent": true, "cache": false - Be explicit about environment — List all build-affecting vars in
orenv
.globalEnv
Gotchas
- Missing
in turbo.json silently disables caching for that task. The task runs every time and you won't get an error — just slow builds. Always verify outputs are configured.outputs
does NOT respectpnpm install
for installation — it always installs the entire workspace. Filtering only works for--filter
andpnpm run
.pnpm exec
resolves to the CURRENT version of the local package, not "latest from npm". If the package hasworkspace:*
, published packages will have"version": "0.0.0"
— set meaningful versions before publishing."dependency": "0.0.0"- Turborepo's
field in turbo.json uses GLOB patterns, not exact matches.env
captures"env": ["API_*"]
,API_KEY
, etc. Forgetting this causes over-invalidation.API_URL
builds app-a AND all its workspace dependencies. If a dependency fails, app-a won't build. Check transitive deps.turbo run build --filter=app-a- Adding a package to
requires runningpackages/
before the workspace recognizes it. The new package also needs a validpnpm install
withpackage.json
matching the workspace pattern.name - TypeScript project references (
in tsconfig.json) must match the workspace dependency graph. Mismatches cause type errors that only appear duringreferences
, not in IDE.tsc --build
'sturbo.json
invalidates ALL tasks when listed files change. Don't put frequently-changed files here — use task-levelglobalDependencies
instead.inputs- Shared Tailwind configs need
directives pointing to consuming packages' source directories, otherwise classes used in shared packages are purged.@source
(for production) copies a single package and its dependencies to a target directory. It does NOT run build scripts — build first, then deploy.pnpm deploy- Remote cache (Vercel or self-hosted) requires
to be correct. If outputs are wrong, cached artifacts will be incomplete and downstream tasks break silently.outputs
tasks preventpersistent: true
from exiting. Don't include persistent tasks in CI pipelines unless they have a timeout.turbo run
References
| When you need... | Read |
|---|---|
| workspace.yaml, workspace: protocol, filtering | pnpm-workspace.md |
| turbo.json schema, tasks, dependsOn | turborepo.md |
| Cache outputs/inputs, remote cache setup | caching.md |
| Directory layout, package naming, tsconfig | structure.md |
| Tailwind v4 shared theme package | tailwind-v4.md |