turborepo
turborepo streamlines development workflows by orchestrating tasks and managing dependencies across monorepo projects. Configure build pipelines, cache strategies, and parallel execution to accelerate your development cycle and reduce redundant work.
turborepo streamlines monorepo setup by providing a structured approach to organizing packages and configuring shared build logic. Start by creating a root turbo.json file that defines your task pipeline, then organize your packages in a packages/ directory. turborepo uses this configuration to understand task dependencies, enable caching, and coordinate execution across your workspace. The MIT-licensed tool handles the orchestration so you can focus on your actual project code rather than build infrastructure.
AI-generated summary based on this skill's SKILL.md
Install
saffron-health/libretto/turborepo · repository language: TypeScript
git clone https://github.com/saffron-health/libretto
cp -r libretto/.agents/skills/turborepo ~/.claude/skills/turborepoFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How do I set up turborepo monorepo?
turborepo streamlines monorepo setup by providing a structured approach to organizing packages and configuring shared build logic. Start by creating a root turbo.json file that defines your task pipeline, then organize your packages in a packages/ directory. turborepo uses this configuration to understand task dependencies, enable caching, and coordinate execution across your workspace. The MIT-licensed tool handles the orchestration so you can focus on your actual project code rather than build infrastructure.
What is the difference between turbo run and turbo shorthand command?
turborepo supports both explicit and shorthand syntax for executing tasks. The full turbo run command (e.g., turbo run build) explicitly invokes the task runner, while turborepo also accepts shorthand (e.g., turbo build) that accomplishes the same result with less typing. Both approaches trigger turborepo's task orchestration, dependency resolution, and caching mechanisms identically—the shorthand is simply a convenience wrapper that reduces verbosity when running common tasks in your monorepo.
How does turborepo's --affected flag work for changed packages?
turborepo's --affected flag enables efficient execution by running tasks only on packages that have actually changed since a specified reference point (typically the main branch). This capability directly supports the intent to run only changed or affected packages efficiently, reducing unnecessary builds in your monorepo. When you use turbo run build --affected, turborepo analyzes your dependency graph, detects which packages were modified, and executes tasks only for those packages and their dependents—accelerating your development cycle and CI/CD pipelines.
Why is turborepo caching not working and how do I debug it?
turborepo caching relies on properly configured inputs, outputs, and task dependencies in your turbo.json file. If caching isn't working, first verify that your task outputs are correctly specified so turborepo knows what artifacts to cache. Check that your inputs are defined to capture all files that affect the task—missing inputs cause cache misses because turborepo can't detect when something has changed. Enable verbose logging with turbo run <task> --verbose to see cache hit/miss decisions, and review your remote cache setup if you're using distributed caching. Common issues include incorrect output paths, incomplete input specifications, or environment variables that aren't properly declared.
How do I integrate turborepo into CI/CD pipelines like GitHub Actions?
turborepo integrates seamlessly into CI/CD by leveraging its caching and affected-package detection to accelerate pipeline runs. In GitHub Actions, configure turborepo to use remote caching (via Vercel or self-hosted solutions) so that build artifacts persist across workflow runs. Use the --affected flag to run only tasks for changed packages, reducing execution time. Set up your turbo.json with proper task dependencies and outputs, then invoke turborepo in your workflow with turbo run build --affected to orchestrate your monorepo builds efficiently. This approach reduces redundant work and accelerates your entire CI/CD process.
What are monorepo structure best practices when using turborepo?
turborepo works best with a clear monorepo structure that separates concerns and enforces package boundaries. Organize your workspace with a root turbo.json that defines shared task pipelines, then place individual packages in a packages/ directory with their own package.json files. Use turborepo's dependency graph to establish clear relationships between packages and prevent circular dependencies. Define root tasks for workspace-wide operations and package tasks for individual package builds. Enforce boundaries by configuring turborepo to validate that packages only depend on explicitly declared dependencies, preventing hidden coupling. This structure allows turborepo to orchestrate tasks across your monorepo while maintaining clarity and preventing anti-patterns.
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
DO NOT create Root Tasks. ALWAYS create package tasks.
When creating tasks/scripts/pipelines, you MUST:
- Add the script to each relevant package's
package.json - Register the task in root
turbo.json - Root
package.jsononly delegates viaturbo run <task>
DO NOT put task logic in root package.json. This defeats Turborepo's parallelization.
```json // DO THIS: Scripts in each package // apps/web/package.json { "scripts":
(truncated - see the full file via the links below)
Read as markdown · JSON record · Browse the source repository
File tree — 15 files
.agents/skills/turborepo/SKILL.md
.agents/skills/turborepo/command/turborepo.md
.agents/skills/turborepo/references/best-practices/RULE.md
.agents/skills/turborepo/references/best-practices/dependencies.md
.agents/skills/turborepo/references/best-practices/packages.md
.agents/skills/turborepo/references/best-practices/structure.md
.agents/skills/turborepo/references/boundaries/RULE.md
.agents/skills/turborepo/references/caching/RULE.md
.agents/skills/turborepo/references/caching/gotchas.md
.agents/skills/turborepo/references/caching/remote-cache.md
.agents/skills/turborepo/references/ci/RULE.md
.agents/skills/turborepo/references/ci/github-actions.md
.agents/skills/turborepo/references/ci/patterns.md
.agents/skills/turborepo/references/ci/vercel.md
.agents/skills/turborepo/references/cli/RULE.md