skillfed

turborepo

turborepo streamlines development workflows across multiple packages by automating task execution with smart dependency resolution. It accelerates builds through incremental computation and caching, letting teams ship faster without managing complex interdependencies manually.

turborepo streamlines setup by using a turbo.json configuration file at your monorepo root. Define tasks with their dependencies using the `dependsOn` field—for example, a build task might depend on lint completing first. turborepo then automatically resolves the correct execution order across all packages. Start with `turbo init` to scaffold your configuration, then specify which tasks should run and their interdependencies. This ensures tasks execute in the right sequence without manual orchestration.

AI-generated summary based on this skill's SKILL.md

951 109 MIT updated by sanity-io

Install

sanity-io/next-sanity/turborepo · repository language: TypeScript

CLI (skillfed)coming soon
git clone https://github.com/sanity-io/next-sanity
cp -r next-sanity/.agents/skills/turborepo ~/.claude/skills/turborepo

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How do I set up turborepo monorepo with proper task configuration and dependencies?

turborepo streamlines setup by using a turbo.json configuration file at your monorepo root. Define tasks with their dependencies using the `dependsOn` field—for example, a build task might depend on lint completing first. turborepo then automatically resolves the correct execution order across all packages. Start with `turbo init` to scaffold your configuration, then specify which tasks should run and their interdependencies. This ensures tasks execute in the right sequence without manual orchestration.

Why is turborepo caching not working and how do I debug it?

turborepo caching failures often stem from missing or incorrect cache output declarations. Verify that your turbo.json specifies the `outputs` array for each task—turborepo only caches what you explicitly declare. Check that environment variables affecting your build aren't changing unexpectedly, as turborepo includes them in cache keys. Use `turbo run <task> --verbose` to see cache hit/miss details. Also ensure your `.gitignore` doesn't exclude cached directories. Remote cache setup requires proper authentication; verify your remote cache credentials if using distributed caching.

How can I filter packages by name and use the --affected flag in turborepo?

turborepo provides two powerful filtering mechanisms. Use `turbo run build --filter=<package-name>` to target specific packages by name pattern. The `--affected` flag runs tasks only on packages that changed since a baseline (typically main branch), which is essential for CI/CD efficiency. Combine them as `turbo run build --filter=@scope/* --affected` to run builds on all affected packages matching a scope. This prevents unnecessary work and accelerates CI pipelines by skipping unchanged packages.

What's the difference between turbo run and the turbo shorthand, and how do I use them?

turborepo supports both `turbo run <task>` and the shorthand `turbo <task>` syntax—they're functionally equivalent. The shorthand is faster to type for common workflows. Both execute your defined tasks across the monorepo with dependency resolution and caching. Use whichever fits your preference; the shorthand is convenient for frequent command-line use, while `turbo run` is more explicit and often preferred in scripts and documentation for clarity.

How do I set up turborepo with CI/CD workflows and GitHub Actions for affected package filtering?

turborepo integrates seamlessly with GitHub Actions using the `--affected` flag to run only changed packages. In your workflow, use `turbo run build --affected` to detect and build only packages modified in the current PR. Combine this with `turbo run lint test --affected` to validate changes efficiently. turborepo's remote cache can store build artifacts across CI runs, reducing redundant work. Configure your turbo.json with proper task definitions and outputs, then reference `--affected` in your Actions workflow to skip unchanged packages and accelerate feedback.

How do I structure internal packages and enforce architectural boundaries in turborepo?

turborepo supports organizing internal packages in a shared directory (commonly `packages/` or `libs/`) within your monorepo. Define each package with its own package.json and source code. Use the `dependsOn` field in turbo.json to enforce dependency direction—prevent circular dependencies by declaring which packages can depend on others. turborepo's task configuration ensures packages build in the correct order. For stricter boundary enforcement, combine turborepo with linting tools that validate import paths, ensuring packages only reference allowed dependencies and maintaining clean architectural layers.

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

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 &lt;task&gt;

DO NOT put task logic in root package.json when it can live in packages. This defeats Turborepo's parallelization.

```json // DO THIS: Scripts in each

(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

Related skills

Tags

monorepo-orchestration task-dependency-graph build-cache-strategy workspace-structure ci-optimization package-isolation parallel-execution environment-hashing filter-patterns dev-workflow