Monorepo Management Skill
TurboRepo Setup
- •Use TurboRepo for all monorepo projects
- •Root-level turbo.json controls orchestration
- •Support both npm and pnpm workspaces based on user preference
Package Manager
- •Use npm or pnpm based on user preference
- •If not specified, use pnpm (recommended for monorepos)
- •Maintain consistent package manager throughout project
Project Structure
code
/ ├── turbo.json # Build orchestration ├── package.json # Root package with workspaces ├── pnpm-workspace.yaml # If using pnpm ├── frontend/ # Frontend application │ ├── package.json │ └── src/ ├── backend/ # Backend services │ ├── package.json │ └── src/ ├── packages/ # Shared packages (optional) │ ├── ui/ # Shared UI components │ ├── utils/ # Shared utilities │ └── config/ # Shared configs └── README.md # Single documentation file
Before Implementation
- •Use context7 to look up TurboRepo docs
- •Check workspace configuration for chosen package manager
- •Review package dependencies
Best Practices
- •Keep frontend and backend at root level
- •Shared code goes in packages/ if needed
- •Use consistent naming conventions
- •Implement proper dependency scoping
- •Use turbo for caching and parallelization
Commands (npm)
- •
npm install- Install all dependencies - •
npm run build- Build all packages (via turbo) - •
npm run dev- Run development servers - •
npm run lint- Lint all packages - •
npm run test- Run all tests
Commands (pnpm)
- •
pnpm install- Install all dependencies - •
pnpm build- Build all packages (via turbo) - •
pnpm dev- Run development servers - •
pnpm lint- Lint all packages - •
pnpm test- Run all tests
Workspace Configuration
- •npm: Use workspaces in package.json
- •pnpm: Use pnpm-workspace.yaml
- •Ensure consistent versions across packages