turborepo
High-performance monorepo build system with intelligent caching, task orchestration, and parallel execution for multi-package repositories and microservices.
What this skill does
# Turborepo Skill
## Summary
Turborepo is a high-performance monorepo build system with intelligent caching, task orchestration, and parallel execution. It provides fast incremental builds through content-aware hashing and remote caching, ideal for managing multiple packages, apps, and shared code.
## When to Use
- **Multi-package repositories** with shared dependencies and utilities
- **Microservices architectures** requiring coordinated builds
- **Component libraries** shared across multiple applications
- **Full-stack monorepos** with frontend, backend, and shared packages
- **Teams needing faster CI/CD** through intelligent caching and parallelization
---
## Quick Start
### Installation and Setup
```bash
# Create new Turborepo (recommended)
npx create-turbo@latest
# Or add to existing monorepo
npm install turbo --save-dev
# Initialize Turborepo
npx turbo init
```
### Basic Structure
```
my-turborepo/
├── apps/
│ ├── web/ # Next.js app
│ └── api/ # Express API
├── packages/
│ ├── ui/ # Shared React components
│ ├── config/ # Shared configs (eslint, tsconfig)
│ └── utils/ # Shared utilities
├── turbo.json # Pipeline configuration
└── package.json # Root package.json
```
### Essential turbo.json
```json
{
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", ".next/**"]
},
"test": {
"dependsOn": ["build"],
"outputs": ["coverage/**"]
},
"lint": {
"outputs": []
},
"dev": {
"cache": false,
"persistent": true
}
}
}
```
### Run Tasks
```bash
# Build all packages and apps
turbo run build
# Run tests across workspace
turbo run test
# Run tasks in parallel
turbo run lint test build
# Filter by package
turbo run build --filter=web
turbo run test --filter=@myorg/ui
# Run in specific workspace
turbo run dev --filter=web...
```
---
## Core Concepts
### Monorepo Architecture
Turborepo manages multiple packages in a single repository:
- **apps/**: Application projects (Next.js, Express, etc.)
- **packages/**: Shared libraries and utilities
- **Workspace dependencies**: Internal package references
- **Single version control**: Unified commits and history
### Task Caching
Content-aware hashing for intelligent cache invalidation:
```json
{
"pipeline": {
"build": {
"outputs": ["dist/**", ".next/**"],
"inputs": ["src/**", "package.json"]
}
}
}
```
- **Cache hits**: Instant task completion (0ms)
- **Local cache**: `.turbo/cache` directory
- **Remote cache**: Shared across team (Vercel, custom)
- **Cache invalidation**: Automatic on file changes
### Pipeline Configuration
Define task dependencies and execution order:
```json
{
"pipeline": {
"build": {
"dependsOn": ["^build"], // Dependencies first
"outputs": ["dist/**"]
},
"test": {
"dependsOn": ["build"], // After local build
"outputs": ["coverage/**"]
},
"deploy": {
"dependsOn": ["build", "test"], // Multiple dependencies
"outputs": []
}
}
}
```
**Dependency Operators**:
- `^build`: Run dependencies' build tasks first (topological)
- `build`: Run local build task first
- No prefix: Run in parallel
---
## Project Structure
### Complete Monorepo Example
```
turborepo-example/
├── apps/
│ ├── web/ # Next.js app
│ │ ├── src/
│ │ ├── package.json
│ │ └── tsconfig.json
│ ├── admin/ # Admin dashboard
│ │ ├── src/
│ │ └── package.json
│ └── api/ # Express API
│ ├── src/
│ └── package.json
├── packages/
│ ├── ui/ # Component library
│ │ ├── src/
│ │ │ ├── Button.tsx
│ │ │ ├── Input.tsx
│ │ │ └── index.ts
│ │ ├── package.json
│ │ └── tsconfig.json
│ ├── config/ # Shared configs
│ │ ├── eslint-config/
│ │ ├── tsconfig/
│ │ └── tailwind-config/
│ ├── utils/ # Shared utilities
│ │ ├── src/
│ │ │ ├── format.ts
│ │ │ ├── validators.ts
│ │ │ └── index.ts
│ │ └── package.json
│ └── types/ # Shared TypeScript types
│ ├── src/
│ └── package.json
├── .turbo/ # Cache directory
├── turbo.json # Pipeline config
├── package.json # Root package
├── pnpm-workspace.yaml # Workspace definition
└── tsconfig.json # Root TypeScript config
```
### Workspace Configuration
**Root package.json**:
```json
{
"name": "my-turborepo",
"private": true,
"workspaces": ["apps/*", "packages/*"],
"scripts": {
"build": "turbo run build",
"dev": "turbo run dev",
"test": "turbo run test",
"lint": "turbo run lint",
"clean": "turbo run clean && rm -rf node_modules .turbo"
},
"devDependencies": {
"turbo": "latest"
},
"engines": {
"node": ">=18",
"pnpm": ">=8"
},
"packageManager": "[email protected]"
}
```
**pnpm-workspace.yaml**:
```yaml
packages:
- "apps/*"
- "packages/*"
```
---
## Package Manager Integration
### pnpm (Recommended)
Fast, efficient, and workspace-native:
```bash
# Install dependencies
pnpm install
# Add dependency to specific package
pnpm add react --filter=web
pnpm add @myorg/ui --filter=admin
# Add workspace dependency
cd apps/web
pnpm add @myorg/ui@workspace:*
# Run scripts
pnpm turbo run build
```
**pnpm-workspace.yaml**:
```yaml
packages:
- "apps/*"
- "packages/*"
```
### npm Workspaces
```json
{
"workspaces": ["apps/*", "packages/*"]
}
```
```bash
npm install
npm run build --workspace=web
npm run test --workspaces
```
### Yarn Workspaces
```json
{
"workspaces": {
"packages": ["apps/*", "packages/*"]
}
}
```
```bash
yarn install
yarn workspace web build
yarn workspaces run test
```
---
## turbo.json Configuration
### Complete Configuration
```json
{
"$schema": "https://turbo.build/schema.json",
"globalDependencies": [".env", "tsconfig.json"],
"globalEnv": ["NODE_ENV", "API_URL"],
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", ".next/**", "build/**"],
"env": ["NEXT_PUBLIC_API_URL"],
"outputMode": "new-only"
},
"test": {
"dependsOn": ["build"],
"outputs": ["coverage/**"],
"inputs": ["src/**", "test/**", "__tests__/**"]
},
"test:unit": {
"dependsOn": [],
"outputs": [],
"cache": false
},
"lint": {
"dependsOn": [],
"outputs": []
},
"type-check": {
"dependsOn": [],
"outputs": []
},
"dev": {
"cache": false,
"persistent": true
},
"clean": {
"cache": false
}
}
}
```
### Pipeline Options
**dependsOn**: Task dependencies
```json
{
"build": {
"dependsOn": ["^build"] // Run dependencies' build first
},
"test": {
"dependsOn": ["build"] // Run local build first
},
"deploy": {
"dependsOn": ["build", "test"] // Multiple tasks
}
}
```
**outputs**: Files to cache
```json
{
"build": {
"outputs": [
"dist/**", // Output directory
".next/**", // Next.js build
"!.next/cache/**" // Exclude cache
]
}
}
```
**inputs**: Files that invalidate cache
```json
{
"build": {
"inputs": [
"src/**", // Source files
"package.json", // Dependencies
"tsconfig.json" // Config files
]
}
}
```
**env**: Environment variables affecting cache
```json
{
"build": {
"env": [
"NEXT_PUBLIC_API_URL",
"DATABASE_URL"
]
}
}
```
**outputMode**: Control console output
```json
{
"build": {
"outputMode": "new-only" // Only show new output
// "full" | "hash-only" | "new-only" | "errors-only" | "none"
}
}
```
**cache**: Enable/disable caching
```json
{
Related in Productivity
gitea-workflow
IncludedOrchestrate agile development workflows for Gitea repositories using the tea CLI. Use when working with Gitea-hosted repos and asking to 'run the workflow', 'continue working', 'what's next', 'complete the task cycle', 'start my day', 'end the sprint', 'implement the next task', or wanting guided step-by-step development assistance. Keywords: workflow, orchestrate, agile, task cycle, sprint, daily, implement, review, PR, standup, retrospective, gitea, tea.
microsoft-graph-gateway
IncludedRoute Microsoft Graph work in this workspace. Use when users want to read or write Outlook mail, calendar events, contacts, OneDrive or SharePoint files, Teams, Planner, To Do, users, groups, directory data, or arbitrary Microsoft Graph endpoints from VS Code. Prefer WorkIQ for common read scenarios. Use Microsoft Graph for write actions and gap-read scenarios that need exact Graph properties, filters, permissions, or endpoints.
copilotkit
IncludedUse when building with CopilotKit — setup, development, integrations, debugging, upgrading, or contributing. Routes to the appropriate specialized skill based on the task.
wordly-wisdom
IncludedProvides calibrated decision analysis using Charlie Munger-style multiple mental models, inversion, incentive mapping, circle-of-competence checks, misjudgment audits, second-order effects, and forecast updates. Use when the user asks for an oracle take, a hard call, a decision memo, a premortem, an outside view, a red-team, a sanity-check, what am I missing, think this through, or wants a strategy, hire, investment, plan, product, partnership, or major life choice analysed. Avoid for simple factual lookups or time-sensitive legal, medical, or market questions without fresh evidence.
swain-session
IncludedSession management and project status dashboard. Owns the full session lifecycle (start/work/close/resume), focus lane, bookmarks, worktree detection, and tab naming. Also serves as the project status dashboard — shows active epics, progress, actionable next steps, blocked items, tasks, GitHub issues, and recommendations. Worktree creation is deferred to swain-do task dispatch (SPEC-195). Triggers on: 'session', 'status', 'what's next', 'dashboard', 'overview', 'where are we', 'what should I work on', 'show me priorities', 'bookmark', 'focus on', 'session info'.
gandi
IncludedComprehensive Gandi domain registrar integration for domain and DNS management. Register and manage domains, create/update/delete DNS records (A, AAAA, CNAME, MX, TXT, SRV, and more), configure email forwarding and aliases, check SSL certificate status, create DNS snapshots for safe rollback, bulk update zone files, and monitor domain expiration. Supports multi-domain management, zone file import/export, and automated DNS backups. Includes both read-only and destructive operations with safety controls.