skillfed

turborepo

This skill enables you to set up and manage complex task execution flows across monorepo workspaces, handling interdependencies and parallel processing efficiently. Leverage Anthony Fu's vetted approach to orchestrating build systems, tests, and deployments in large-scale projects.

Turborepo enables you to establish a JavaScript/TypeScript monorepo by creating a root `turbo.json` configuration file that defines your task pipeline. Start by installing turborepo as a dev dependency, then structure your workspace with multiple packages under a common directory (typically `packages/`). Each package maintains its own `package.json`, and turborepo orchestrates tasks across all of them using the `turbo run` command. The root `turbo.json` specifies which tasks exist, their dependencies, and caching rules—allowing turborepo to understand your entire build graph and execute tasks in the correct order.

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

5,665 313 MIT updated by antfu

Install

antfu/skills/turborepo · repository language: TypeScript

CLI (skillfed)coming soon
git clone https://github.com/antfu/skills
cp -r skills/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 establish a JavaScript/TypeScript monorepo by creating a root `turbo.json` configuration file that defines your task pipeline. Start by installing turborepo as a dev dependency, then structure your workspace with multiple packages under a common directory (typically `packages/`). Each package maintains its own `package.json`, and turborepo orchestrates tasks across all of them using the `turbo run` command. The root `turbo.json` specifies which tasks exist, their dependencies, and caching rules—allowing turborepo to understand your entire build graph and execute tasks in the correct order.

What does the turborepo --affected flag do and when should I use it?

Turborepo's --affected flag (used as `turbo run build --affected`) runs tasks only on packages that have changed since a specified baseline, plus any packages that depend on them. This is invaluable in CI/CD pipelines where you want to skip unnecessary work: if you modify a utility package, turborepo detects which downstream packages depend on it and runs their tasks too. This dramatically reduces build time in large monorepos by avoiding redundant task execution on unrelated packages.

How do I configure task dependencies and the dependsOn field in turbo.json?

Turborepo's `turbo.json` configuration uses the `dependsOn` field to declare task relationships. For example, you can specify that a `build` task depends on `^build` (meaning the same task must complete in all dependencies first) or on other tasks like `lint`. The `dependsOn` configuration tells turborepo how to order task execution across your monorepo, ensuring that if package A depends on package B, B's build completes before A's build starts. This prevents race conditions and enforces the correct execution sequence.

Why is turborepo caching not working and how do I debug it?

Turborepo caching relies on consistent task outputs and proper `outputs` configuration in `turbo.json`. If caching isn't working, verify that: your `outputs` array correctly specifies where task artifacts are written (e.g., `dist/`, `build/`), your tasks are deterministic (same inputs always produce same outputs), and you haven't disabled caching with environment variables. Use `turbo run build --verbose` to see cache hit/miss details. Remote cache setup via `turborepo remote cache` can also improve cache effectiveness across CI environments.

How can I run only changed packages and their affected dependents in a monorepo?

Turborepo enables efficient incremental builds by combining the `--affected` flag with `--filter` options. Use `turbo run build --affected` to run tasks only on packages with changes plus their dependents, or use `turbo run build --filter='./packages/my-package'` to target specific packages. This approach leverages turborepo's dependency graph understanding to skip unaffected work, making development cycles faster and CI pipelines more efficient in large JavaScript/TypeScript monorepos.

How do I integrate turborepo with CI/CD pipelines like GitHub Actions?

Turborepo integrates with CI/CD by using the `--affected` flag to run only changed packages, combined with remote caching for faster builds across workflow runs. In GitHub Actions, configure turborepo to connect to a remote cache (via `TURBO_TOKEN` and `TURBO_TEAM` environment variables), then use `turbo run build --affected` in your workflow. This ensures each CI run benefits from cached outputs from previous runs, significantly reducing build time. Turborepo's MIT license and monorepo-focused design make it ideal for orchestrating complex deployment pipelines.

SKILL.md

rendered from the published skill — quoted content, verbatim

Turborepo Skill

Build system for JavaScript/TypeScript monorepos. Turborepo caches task outputs and runs tasks in parallel based on dependency graph.

IMPORTANT: Package Tasks, Not Root Tasks

Prefer package tasks over Root Tasks.

When creating tasks/scripts/pipelines, you MUST default to package tasks:

  1. Add the script to each relevant package's package.json
  2. Register the task in root turbo.json
  3. Root package.json only delegates via turbo run <task>

DO NOT put task logic in root package.json when it can live in packages. This defeats Turborepo's parallelization.

```json // DO THIS: Scripts in each

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

Read as markdown · JSON record · Browse the source repository

File tree — 15 files
skills/turborepo/LICENSE.md
skills/turborepo/SKILL.md
skills/turborepo/SYNC.md
skills/turborepo/command/turborepo.md
skills/turborepo/references/best-practices/RULE.md
skills/turborepo/references/best-practices/dependencies.md
skills/turborepo/references/best-practices/packages.md
skills/turborepo/references/best-practices/structure.md
skills/turborepo/references/boundaries/RULE.md
skills/turborepo/references/caching/RULE.md
skills/turborepo/references/caching/gotchas.md
skills/turborepo/references/caching/remote-cache.md
skills/turborepo/references/ci/RULE.md
skills/turborepo/references/ci/github-actions.md
skills/turborepo/references/ci/patterns.md

Related skills

Tags

build-orchestration workspace-management task-parallelization dependency-graph cache-invalidation monorepo-structure ci-optimization package-isolation incremental-builds artifact-caching