Skip to content
Skillpedia
Deploy & cloud (DevOps)12k Β· #11527

turborepo

What it does

This skill guides your AI through Turborepo, a build system for projects that hold several apps and packages in one repository. It is for developers who want faster builds and a clear task order.

When to use it

  • βœ“When you set up a monorepo with several apps or shared packages.
  • βœ“When you edit turbo.json or need tasks to run in the right order.
  • βœ“When your builds are slow and you want to use caching or run only the parts that changed.

Skill link

https://github.com/trycompai/crm/blob/release/.agents/skills/turborepo/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/trycompai/crm/blob/release/.agents/skills/turborepo/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œSet up Turborepo for my monorepo so the build and test tasks run in parallel.”

5 new skills a week. 1 minute to read.

How it works

The skill explains that scripts should live in each package, then registers the tasks in turbo.json so Turborepo can run them in parallel and reuse cached results.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

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.

// DO THIS: Scripts in each package
// apps/web/package.json
{ "scripts": { "build": "next build", "lint": "eslint .", "test": "vitest" } }

// apps/api/package.json
{ "scripts": { "build": "tsc", "lint": "eslint .", "test": "vitest" } }

// packages/ui/package.json
{ "scripts": { "build": "tsc", "lint": "eslint .", "test": "vitest" } }
// turbo.json - register tasks
{
  "tasks": {
    "build": { "dependsOn": ["^build"], "outputs": ["dist/**"] },
    "lint": {},
    "test": { "dependsOn": ["build"] }
  }
}
// Root package.json - ONLY delegates, no task logic
{
  "scripts": {
    "build": "turbo run build",
    "lint": "turbo run lint",
    "test": "turbo run test"
  }
}
// DO NOT DO THIS - defeats parallelization
// Root package.json
{
  "scripts": {
    "build": "cd apps/web && next build && cd ../api && tsc",
    "lint": "eslint apps/ packages/",
    "test": "vitest"
  }
}

Root Tasks (//#taskname) are ONLY for tasks that truly cannot exist in packages, such as Vitest Projects' //#test, repo-wide release scripts, or tooling that does not invoke turbo itself.

Secondary Rule: turbo run vs turbo

Always use turbo run when the command is written into code:

// package.json - ALWAYS "turbo run"
{
  "scripts": {
    "build": "turbo run build"
  }
}
# CI workflows - ALWAYS "turbo run"
- run: turbo run build --affected

The shorthand turbo <tasks> is ONLY for one-off terminal commands typed directly by humans or agents. Never write turbo build into package.json, CI, or scripts.

Quick Decision Trees

"I need to configure a task"

Configure a task?
β”œβ”€ Define task dependencies β†’ references/configuration/tasks.md
β”œβ”€ Lint/check-types (parallel + caching) β†’ Use Transit Nodes pattern (see below)
β”œβ”€ Specify build outputs β†’ references/configuration/tasks.md#outputs
β”œβ”€ Handle environment variables β†’ references/environment/RULE.md
β”œβ”€ Set up dev/watch tasks β†’ references/configuration/tasks.md#persistent
β”œβ”€ Package-specific config β†’ references/configuration/RULE.md#package-configurations
└─ Global settings (cacheDir, daemon) β†’ references/configuration/global-options.md

"My cache isn't working"

Cache problems?
β”œβ”€ Tasks run but outputs not restored β†’ Missing `outputs` key
β”œβ”€ Cache misses unexpectedly β†’ references/caching/gotchas.md
β”œβ”€ Need to debug hash inputs β†’ Use --summarize or --dry
β”œβ”€ Want to skip cache entirely β†’ Use --force or cache: false
β”œβ”€ Remote cache not working β†’ references/caching/remote-cache.md
└─ Environment causing misses β†’ references/environment/gotchas.md

"I want to run only changed packages"

Run only what changed?
β”œβ”€ Changed packages + dependents (RECOMMENDED) β†’ turbo run build --affected
β”œβ”€ Custom base branch β†’ --affected --affected-base=origin/develop
β”œβ”€ Manual git comparison β†’ --filter=...[origin/main]
└─ See all filter options β†’ references/filtering/RULE.md

--affected is the primary way to run only changed packages. It automatically compares against the default branch and includes dependents.

"I want to filter packages"

Filter packages?
β”œβ”€ Only changed packages β†’ --affected (see above)
β”œβ”€ By package name β†’ --filter=web
β”œβ”€ By directory β†’ --filter=./apps/*
β”œβ”€ Package + dependencies β†’ --filter=web...
β”œβ”€ Package + dependents β†’ --filter=...web
└─ Complex combinations β†’ references/filtering/patterns.md

"Environment variables aren't working"

Environment issues?
β”œβ”€ Vars not available at runtime β†’ Strict mode filtering (default)
β”œβ”€ Cache hits with wrong env β†’ Var not in `env` key
β”œβ”€ .env changes not causing rebuilds β†’ .env not in `inputs`
β”œβ”€ CI variables missing β†’ references/environment/gotchas.md
└─ Framework vars (NEXT_PUBLIC_*) β†’ Auto-included via inference

"I need to set up CI"

CI setup?
β”œβ”€ GitHub Actions β†’ references/ci/github-actions.m
FAQ

Should scripts go in the root package.json?

The skill recommends putting task scripts in each package and keeping the root package.json only to run turbo commands.

What does turbo.json do?

It lists the tasks, their order, their outputs and their dependencies, so Turborepo knows what to run and cache.

Does it cover CI speed?

Yes. The skill mentions CI optimization, remote cache and running only the affected parts of the repository.

Details

Original description by the author

Turborepo monorepo build system guidance. Triggers on: turbo.json, task pipelines, dependsOn, caching, remote cache, the "turbo" CLI, --filter, --affected, CI optimization, environment variables, internal packages, monorepo structure/best practices, and boundaries. Use when user: configures tasks/workflows/pipelines, creates packages, sets up monorepo, shares code between apps, runs changed/affected packages, debugs cache, or has apps/packages directories.

repo: trycompai/crm

Popularity

GitHub stars
12k
Ranking position
#11527
License
MIT
Updated
11/1/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills