turborepo

Configure and optimize Turborepo monorepo task pipelines, caching, and filtering.

2|1|Updated Apr 17, 2025
One-click install
npx skills add https://github.com/abraham-yusuf/pernikahan-web --skill turborepo-abraham-yusuf
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: turborepo
Source: https://github.com/abraham-yusuf/pernikahan-web/tree/main/.agents/skills/turborepo
Command: npx skills add https://github.com/abraham-yusuf/pernikahan-web --skill turborepo-abraham-yusuf

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Setting up and maintaining a JavaScript/TypeScript monorepo build system is error-prone: misconfigured task pipelines, broken caching, incorrect environment variable handling, and slow CI runs are common. This Skill provides structured guidance for configuring Turborepo correctly, avoiding anti-patterns, and debugging cache or filtering issues. ## Core Features & Use Cases - Task Pipeline Configuration: Guides creation of package-level tasks in turbo.json with correct dependsOn, outputs, inputs, and env declarations, enforcing the package-tasks-over-root-tasks rule. - Caching & Debugging: Explains local and remote cache setup, hash inputs, and how to diagnose cache misses using --summarize and --dry flags. - Filtering & CI Optimization: Covers --affected and --filter syntax for running only changed packages, plus GitHub Actions and Vercel deployment patterns. - Use Case: A developer adds a new lint task across apps and packages. The Skill instructs them to add the script to each package.json, register it in root turbo.json, and delegate via turbo run lint in the root package.json. ## Quick Start Ask the assistant to set up a Turborepo build pipeline with caching and affected-package filtering for your monorepo.

Frequently Asked Questions about turborepo

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure a build task in Turborepo?

Add the build script to each package's package.json, then register the task in root turbo.json with dependsOn set to ["^build"] and outputs like ["dist/**"]. The root package.json should only delegate via "turbo run build".

How do I run tasks only in changed packages with Turborepo?

Use the --affected flag, for example "turbo run build --affected". It compares your branch against the default branch and runs tasks in changed packages plus their dependents. Use --affected-base to customize the comparison branch.

Why is my Turborepo cache not working?

Common causes are missing outputs keys for file-producing tasks, environment variables not declared in the env key, or .env files not listed in inputs. Debug with --summarize or --dry to inspect hash inputs.

Should I use turbo or turbo run in package.json scripts?

Always use "turbo run" in package.json scripts, CI workflows, and any committed code. The shorthand "turbo <task>" is intended only for one-off commands typed directly in a terminal.

Does Turborepo support remote caching in CI?

Yes, remote caching works via Vercel Remote Cache by setting TURBO_TOKEN and TURBO_TEAM environment variables in CI. Self-hosted remote caches are also supported through the remoteCache configuration in turbo.json.

When should I use Root Tasks in Turborepo?

Root Tasks (//#taskname) should be avoided in almost all cases because they defeat parallelization and per-package caching. Only use them for tasks that genuinely cannot exist inside any package, such as repo-wide code generation.