Agent skill
monorepo-scaffold
Convert single-app repos into a Turborepo monorepo using pnpm workspaces. Use when splitting apps into apps/ and shared code into packages/ with cached pipelines.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/monorepo-scaffold
SKILL.md
Monorepo Scaffold
Convert a single-app repository into a Turborepo + pnpm workspace monorepo, without breaking builds or release flow.
Purpose
- Standardize on
pnpmworkspaces +turbo - Split runnable apps into
apps/ - Move shared code and config into
packages/ - Add reliable caching, fast CI, and clear ownership boundaries
Target Structure
Use this shape unless the repo already has stronger constraints.
.
├─ apps/
│ ├─ web/
│ ├─ mobile/
│ └─ api/
├─ packages/
│ ├─ shared/
│ ├─ ui-web/
│ ├─ ui-mobile/
│ └─ config/
├─ pnpm-workspace.yaml
├─ turbo.json
└─ package.json
CLI Commands
Prefer explicit, reproducible commands.
# Workspace baseline
pnpm add -D turbo
pnpm install
# Optional: scaffold common layout quickly
pnpm dlx create-turbo@latest --package-manager pnpm
# Run tasks
pnpm turbo run build
pnpm turbo run dev --filter=web
pnpm turbo run test --continue
Workflow
Follow this order. Keep diffs small and reversible.
- Audit current scripts, build outputs, and deploy entrypoints.
- Create
apps/andpackages/folders. - Move the existing app into
apps/<name>/with minimal edits. - Add
pnpm-workspace.yamland includeapps/*andpackages/*. - Add root
turbo.jsonwith a small, strict pipeline. - Normalize scripts so each app/package exposes
build,dev,lint,test, andtypecheckwhen relevant. - Extract shared code into
packages/sharedand wire via workspace deps. - Extract shared config into
packages/configand reference it explicitly. - Update CI to run
pnpm installthenpnpm turbo run build lint test typecheck. - Verify with targeted filters, then full pipeline.
Verification Checklist
Do not trust the migration until all checks pass.
pnpm installcompletes without hoist hackspnpm turbo run buildsucceeds from repo rootpnpm turbo run dev --filter=<app>starts the expected app- Each app builds from a clean checkout
- Shared packages are consumed via
workspace:*ranges - Outputs are declared in
turbo.jsonfor cache hits - CI runs from root and matches local commands
References
- Setup guide:
skills/monorepo-scaffold/references/turborepo-setup.md - Migration checks:
skills/monorepo-scaffold/references/migration-checklist.md
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?