Skip to content
Development
Skill

/shared-monorepo-turborepo

Turborepo, workspaces, package architecture, @repo/* naming, exports, tree-shaking

From plugin
skills
26200 skills

Claude Code

$ npx -y skills add agents-inc/skills --skill shared-monorepo-turborepo --agent claude-code

SKILL.md

shared-monorepo-turborepo.SKILL.md
name: shared-monorepo-turborepo
description: Turborepo, workspaces, package architecture, @repo/* naming, exports, tree-shaking

Monorepo Orchestration with Turborepo

> **Quick Guide:** Turborepo 2.x for monorepo orchestration. Task pipelines with dependency ordering. Local + remote caching for massive speed gains. Workspaces for package linking. Syncpack for dependency version consistency. Internal packages use `@repo/*` naming, explicit `exports` fields, and `workspace:*` protocol.

---

<critical_requirements>

CRITICAL: Before Using This Skill

**(You MUST define task dependencies using `dependsOn: ["^build"]` in turbo.json to ensure topological ordering)**

**(You MUST declare all environment variables in the `env` array of turbo.json tasks for proper cache invalidation)**

**(You MUST set `cache: false` for tasks with side effects like dev servers and code generation)**

**(You MUST use `workspace:*` protocol for internal package dependencies)**

**(You MUST use `@repo/*` naming convention for ALL internal packages)**

**(You MUST define explicit `exports` field in package.json - never allow importing internal paths)**

**(You MUST mark React as `peerDependencies` NOT `dependencies` in component packages)**

</critical_requirements>

---

**Auto-detection:** Turborepo configuration, turbo.json, monorepo setup, workspaces, Bun workspaces, syncpack, task pipelines, @repo/\* packages, package.json exports, workspace dependencies, shared configurations

**When to use:**

  • Configuring Turborepo task pipeline and caching strategies
  • Setting up workspaces for monorepo package linking
  • Enabling remote caching for team/CI cache sharing
  • Synchronizing dependency versions across workspace packages
  • Creating new internal packages in `packages/`
  • Configuring package.json exports for tree-shaking
  • Setting up shared configuration packages (@repo/eslint-config, @repo/typescript-config)

**When NOT to use:**

  • Single application projects (use standard build tools directly)
  • Projects without shared packages (no monorepo benefits)
  • Very small projects where setup overhead exceeds caching benefits
  • Polyrepo architecture is preferred over monorepo
  • Projects already using Nx or Lerna (don't mix monorepo tools)
  • App-specific code that won't be shared (keep in app directory)

**Key patterns covered:**

  • Turborepo 2.x task pipeline (dependsOn, outputs, inputs, cache)
  • Local and remote caching strategies
  • Workspaces for package linking
  • Syncpack for dependency version consistency
  • Environment variable handling in turbo.json
  • Package structure and @repo/\* naming conventions
  • package.json exports for tree-shaking
  • Named exports and barrel file patterns
  • Internal dependencies with workspace protocol

**Detailed Resources:**

  • For code examples, see [examples/core.md](examples/core.md) (always start here)
  • [examples/caching.md](examples/caching.md) - Remote caching, CI/CD integration
  • [examples/workspaces.md](examples/workspaces.md) - Workspace protocol, syncpack, dependency boundaries
  • [examples/packages.md](examples/packages.md) - Internal package conventions, exports, creating packages
  • For decision frameworks and anti-patterns, see [reference.md](reference.md)

---

<philosophy>

Philosophy

Turborepo is a high-performance build system designed for JavaScript/TypeScript monorepos. It provides intelligent task scheduling, caching, and remote cache sharing to dramatically reduce build times. Combined with workspaces, it enables efficient package management with automatic dependency linking.

</philosophy>

---

<patterns>

Core Patterns

Pattern 1: Turborepo Task Pipeline with Dependency Ordering

Define task dependencies and caching behavior in turbo.json to enable intelligent build orchestration and caching.

Key Concepts

  • `dependsOn: ["^build"]` - Run dependency tasks first (topological order)
  • `outputs` - Define what files to cache
  • `inputs` - Specify which files trigger cache invalidation
  • `cache: false` - Disable caching for tasks with side effects
  • `persistent: true` - Keep dev servers running

Minimal Example

{
  "tasks": {
    "build": {
      "dependsOn": ["^build"],
      "env": ["DATABASE_URL", "NODE_ENV"],
      "outputs": ["dist/**", ".next/**", "!.next/cache/**"]
    },
    "dev": { "cache": false, "persistent": true }
  }
}

**Key:** `dependsOn: ["^build"]` ensures topological execution, `env` declares variables for cache invalidation, `cache: false` for side-effect tasks.

See [examples/core.md](examples/core.md) for full good/bad comparison examples.

---

Pattern 2: Caching Strategies

Turborepo's caching system dramatically speeds up builds by reusing previous task outputs when inputs haven't changed.

What Gets Cached

  • Build outputs (`dist/`, `.next/`, framework-specific directories)
  • Test results (when `cache: true`)
  • Lint results

What Doesn't Get Cached

  • Dev servers (`cache: false`)
  • Code generation (`cache: false` - generates files)
  • Tasks with side effects

Cache Invalidation Triggers

  • Source file changes
  • Dependency changes
  • Environment variable changes (when in `env` array)
  • Global dependencies changes (`.env`, `tsconfig.json`)

**Setup:** Link a Vercel account (or self-hosted cache), then set `TURBO_TOKEN` and `TURBO_TEAM` environment variables to enable remote cache sharing.

See [examples/caching.md](examples/caching.md) for remote caching configuration and CI integration examples.

---

Pattern 3: Workspaces for Package Management

Configure workspaces to enable package linking and dependency sharing across monorepo packages.

Key Concepts

  • Root `package.json` declares `"workspaces": ["apps/*", "packages/*"]`
  • Internal deps use `"@repo/ui": "workspace:*"` protocol for automatic linking
  • Standard structure: `apps/` for deployable apps, `packages/` for shared code

See [examples/workspaces.md](examples/workspaces.md) for full good/bad comparison exam

Read more
@agents-inc
Ships withskills

The official skills marketplace for Agents Inc. 230+ skills covering everything from React and Prisma to Redis, ElevenLabs, and infrastructure tooling. Pick the skills that match your stack and install them via Claude Code. Need more control?

Stars on GitHub

Momentum

stars in total
26
Star history of agents-inc/skills on GitHub, a chart by star-history.com

Other skills on skills.

ai-infrastructure-litellm

ai-infrastructure-lite…

LiteLLM proxy server setup, TypeScript client patterns via OpenAI SDK, model routing, fallbacks, load balancing, spend tracking,…

@agents-inc@agents-incInstall Skill
ai-infrastructure-modal

ai-infrastructure-moda…

Serverless GPU compute platform for AI model deployment — web endpoints, GPU functions, model serving, and TypeScript client…

@agents-inc@agents-incInstall Skill
ai-infrastructure-ollama

ai-infrastructure-olla…

Local LLM inference with the Ollama JavaScript client -- chat, streaming, tool calling, vision, embeddings, structured output,…

@agents-inc@agents-incInstall Skill

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills10d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc12d293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react1d252k
@facebook@facebookInstall Skill

Questions about shared-monorepo-turborepo.

Which coding agents can use shared-monorepo-turborepo?
shared-monorepo-turborepo installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.