skillfed

turborepo

Master Turborepo monorepo configuration with this Claude Code skill, drawn from battle-tested Cursor rules. Get expert guidance on structuring multi-package projects, optimizing build pipelines, and managing dependencies across your workspace efficiently.

Turborepo enables you to set up a monorepo by initializing a root `turbo.json` configuration file that defines your workspace structure and build tasks. Start by creating a `turbo.json` at your project root with task definitions, then organize your packages in a `packages/` directory. Each package should have its own `package.json`. Turborepo automatically discovers workspaces and manages dependencies between them, allowing you to run tasks across multiple packages efficiently using commands like `turbo run build`.

AI-generated summary based on this skill's SKILL.md

202 30 Apache-2.0 updated by Mindrally

Install

Mindrally/skills/turborepo

CLI (skillfed)coming soon
git clone https://github.com/Mindrally/skills
cp -r skills/turborepo ~/.claude/skills/turborepo

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How do I set up turborepo monorepo from scratch?

Turborepo enables you to set up a monorepo by initializing a root `turbo.json` configuration file that defines your workspace structure and build tasks. Start by creating a `turbo.json` at your project root with task definitions, then organize your packages in a `packages/` directory. Each package should have its own `package.json`. Turborepo automatically discovers workspaces and manages dependencies between them, allowing you to run tasks across multiple packages efficiently using commands like `turbo run build`.

What is the best way to configure turbo.json for my project?

Turborepo's `turbo.json` configuration should define your pipeline tasks with explicit dependencies and caching rules. Specify which tasks depend on others using the `dependsOn` field—for example, `build` might depend on `^build` (caret notation means dependencies in other packages must build first). Set `outputs` to cache build artifacts and `inputs` to define what files trigger cache invalidation. Use `cache: false` for tasks like `dev` that shouldn't be cached. This structure ensures Turborepo can optimize your build graph effectively.

How do I use turborepo task dependencies explained?

Turborepo task dependencies use the `dependsOn` field in `turbo.json` to create execution order constraints. The caret prefix (`^`) means a task depends on the same task in its dependencies—so `build` with `dependsOn: ["^build"]` ensures all package dependencies build before the current package. Without the caret, tasks run in the current package only. You can also use `dependsOn: ["lint"]` to make tasks sequential within a package. This declarative approach lets Turborepo parallelize independent tasks while respecting your build graph.

How can I optimize turborepo builds through caching and performance tuning?

Turborepo optimizes build performance through local and remote caching. Configure `outputs` in your pipeline tasks to specify which files to cache—Turborepo skips tasks when inputs haven't changed. Use `inputs` to define file patterns that trigger cache invalidation, excluding unnecessary files like tests or docs if appropriate. Enable remote caching via `turbo login` and `turbo link` to share cache across CI/CD and team members. For incremental builds, use `turbo run build --filter=...` to build only affected packages, and leverage `turbo prune` to create optimized dependency subsets for deployment.

What is turborepo remote caching setup and how do I integrate it with CI/CD?

Turborepo remote caching setup involves authenticating with Vercel's cache backend or a self-hosted solution. Run `turbo login` locally to authenticate, then `turbo link` to connect your repository. In CI/CD pipelines, set the `TURBO_TOKEN` and `TURBO_TEAM` environment variables so your build can access the remote cache without interactive login. This allows CI/CD jobs to reuse cached artifacts from previous builds and team members' machines, dramatically reducing build times. Configure your pipeline to run `turbo run build --filter=...` with these variables set for optimal cache hit rates.

How do I manage shared configurations and workspace dependencies in turborepo?

Turborepo manages shared configurations by creating a dedicated `packages/config` or `packages/shared` package containing shared TypeScript configs, ESLint rules, or build utilities. Other packages reference this shared package in their `package.json` dependencies. Turborepo's workspace resolution automatically handles these internal dependencies. Use `dependsOn: ["^build"]` in your pipeline to ensure shared packages build first. For TypeScript, use path aliases in a root `tsconfig.json` with `references` to package configs, allowing Turborepo to understand the full dependency graph and optimize builds accordingly.

SKILL.md

rendered from the published skill — quoted content, verbatim

Turborepo Development

You are an expert in Turborepo, the high-performance build system for JavaScript and TypeScript monorepos.

Project Structure

  • Organize workspaces following the standard Turborepo structure:
  • apps/ - Application workspaces (web apps, APIs, mobile apps)
  • packages/ - Shared packages (UI components, utilities, configs)
  • tooling/ - Build tools and configurations (optional)
  • Keep the root package.json minimal with workspace configuration
  • Use consistent naming conventions across all workspaces

Workspace Configuration

  • Define workspaces in the root package.json: json { "workspaces": ["apps/*", "packages/*"] }
  • Each workspace should have its own package.json with proper dependencies
  • Use internal package references with workspace protocol: "@repo/ui": "workspace:*"

turbo.json Configuration

```json { "$schema": "https://turbo.build/schema.json", "tasks": { "build": { "dependsOn": ["^build"], "outputs": ["dist/", ".next/", "!.next/cache/**"] }, "dev": {

(truncated - see the full file via the links below)

Read as markdown · JSON record · Browse the source repository

File tree — 1 file
turborepo/SKILL.md

Related skills

Tags

monorepo-management build-optimization task-orchestration cache-strategy workspace-scaling ci-cd-automation dependency-graph incremental-compilation