turborepo

Configure and optimize Turborepo task pipelines, caching, and monorepo build orchestration.

Updated Sep 5, 2023
One-click install
npx skills add https://github.com/eyenalxai/dotfiles --skill turborepo-eyenalxai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: turborepo
Source: https://github.com/eyenalxai/dotfiles/tree/main/.agents/skills/turborepo
Command: npx skills add https://github.com/eyenalxai/dotfiles --skill turborepo-eyenalxai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Setting up and maintaining a JavaScript/TypeScript monorepo build system involves tricky decisions about task dependencies, cache invalidation, environment variables, and CI configuration. This Skill provides expert guidance on Turborepo so tasks run in parallel, caches hit reliably, and only changed packages get rebuilt. ## Core Features & Use Cases - Task Pipeline Configuration: Define tasks in turbo.json with correct dependsOn, outputs, inputs, and env keys, following the package-tasks-over-root-tasks principle. - Caching & Filtering: Debug cache misses, set up remote caching, and use --affected or --filter to run only changed packages and their dependents. - CI/CD & Best Practices: Configure GitHub Actions or Vercel deployments, enforce package boundaries, structure internal packages, and manage environment variables in strict mode. - Use Case: When a user asks to "set up a build pipeline for my monorepo" or "why is my turbo cache missing in CI", the Skill walks through decision trees and reference docs to produce correct turbo.json and workflow configurations. ## Quick Start Ask the assistant to configure a build and test pipeline with caching for your Turborepo 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 pipeline in turbo.json?

Define tasks in the root turbo.json tasks object with dependsOn and outputs, for example "build": { "dependsOn": ["^build"], "outputs": ["dist/**"] }. Add the actual scripts to each package's package.json and have the root package.json delegate with "turbo run build".

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

Use the --affected flag, for example "turbo run build --affected", which compares against main and includes dependents of changed packages. Set TURBO_SCM_BASE to compare against a different base branch such as origin/develop.

Why is my Turborepo cache missing or not restoring outputs?

Cache misses usually come from a missing outputs key on file-producing tasks, environment variables not listed in the env key, or .env files absent from 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.

What is the difference between dependsOn ^build and build in Turborepo?

The caret form ^build runs the build task in dependency packages first, while plain build runs it in the same package first. A specific package's task can be targeted with the pkg#task syntax such as web#build.

Does Turborepo support environment variables in CI?

Yes, but strict mode filters variables to only those declared in env or globalEnv. Add CI variables like GITHUB_TOKEN to globalPassThroughEnv so they are available at runtime without affecting cache hashes.