turborepo

Cache task outputs and orchestrate dependencies in monorepos.

11|2|Updated Oct 26, 2024
One-click install
npx skills add https://github.com/quanphm/hoalu --skill turborepo-quanphm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: turborepo
Source: https://github.com/quanphm/hoalu/tree/main/.agents/skills/turborepo
Command: npx skills add https://github.com/quanphm/hoalu --skill turborepo-quanphm

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Turborepo provides a scalable solution for managing and building large monorepos by caching task outputs and orchestrating execution order to avoid repeated work.

Core Features & Use Cases

  • Efficient caching of task results across packages to speed up builds.
  • Parallel execution of independent tasks with correct cache invalidation.
  • Package-scoped tasks and per-package turbo.json overrides to tailor behavior.
  • CI integration and affected builds for selective workflow optimization.
  • Transit nodes and complex dependency graphs to maintain correctness without sacrificing parallelism.

Quick Start

Load the turborepo skill and define a basic workflow:

  • Add per-package scripts for build/test/lint in apps/* and packages/*
  • Create a root turbo.json with a base task graph and outputs
  • Use turbo run <task> (e.g., turbo run build --affected) to validate changes

Frequently Asked Questions about turborepo

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

FAQPage Schema
How do I speed up monorepo builds by caching task outputs?

To speed up monorepo builds, you can cache task outputs by defining per-package scripts and configuring a root turbo.json to orchestrate dependencies and store results. This avoids repeated work by retrieving cached outputs for unchanged tasks.

How does build orchestration handle parallel execution in a monorepo?

Build orchestration handles parallel execution by mapping complex dependency graphs and running independent tasks simultaneously. It ensures correct cache invalidation and maintains execution correctness without sacrificing parallelism across packages.

How do I configure selective CI workflows for affected builds?

You can configure selective CI workflows by using the turbo run command with the --affected flag. This targets only the packages impacted by recent changes, optimizing CI integration and skipping unaffected tasks across your apps and libraries.

Do I need a turbo.json file for every package to define monorepo tasks?

You need a root turbo.json to define the base task graph and outputs, while individual packages require per-package scripts for tasks like build, test, and lint. You can also apply per-package turbo.json overrides to tailor specific behavior.

What is the best way to ensure deterministic caching for monorepo tasks?

The best way to ensure deterministic caching is to define precise inputs and outputs with environment variable handling in your turbo.json configuration. This strict task definition guarantees that cache hits remain reliable across execution environments.

Why are my monorepo tasks not running in parallel correctly?

Monorepo tasks fail to run in parallel correctly when dependency graphs are not properly mapped or when cache invalidation triggers unnecessarily. Ensure your turbo.json accurately defines task dependencies to allow independent tasks to execute simultaneously.