install
source · Clone the upstream repo
git clone https://github.com/ComeOnOliver/skillshub
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ComeOnOliver/skillshub "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/TerminalSkills/skills/turborepo" ~/.claude/skills/comeonoliver-skillshub-turborepo-56274a && rm -rf "$T"
manifest:
skills/TerminalSkills/skills/turborepo/SKILL.mdsource content
Turborepo
Overview
Turborepo is a high-performance build system for JavaScript/TypeScript monorepos that intelligently caches task outputs, parallelizes execution across CPU cores, and ensures teams only rebuild what has changed. It integrates with npm, yarn, and pnpm workspaces.
Instructions
- When setting up a monorepo, define tasks in
withturbo.json
for ordering, usedependsOn
prefix for topological dependencies (e.g.,^
), and specify"dependsOn": ["^build"]
for cacheable artifacts.outputs - When configuring caching, define
arrays for each task (outputs
), list all build-affecting environment variables in["dist/**", ".next/**"]
orenv
, and set up Remote Cache for cross-developer sharing.globalEnv - When filtering workspaces, use
to target specific packages,--filter=@app/web
for changed packages, and--filter=...[HEAD~1]
to visualize the dependency graph.turbo run build --graph - When optimizing Docker builds, use
to generate a minimal Docker context containing only the targeted package and its dependencies.turbo prune --scope=@app/web - When setting up CI/CD, enable Remote Cache for cross-PR cache sharing, use
for pipeline analysis, and leverage incremental builds that only rebuild packages affected by PR changes.--dry-run=json - When organizing shared packages, create focused internal packages (
,@repo/ui
,@repo/db
) with shared@repo/auth
and ESLint configs.tsconfig
Examples
Example 1: Set up a new Turborepo monorepo
User request: "Initialize a monorepo with a Next.js app and shared UI library"
Actions:
- Set up pnpm workspace with
andapps/web
directoriespackages/ui - Configure
withturbo.json
,build
,dev
, andlint
taskstypecheck - Define task dependencies and cache outputs for each task
- Create shared
base intsconfigpackages/tsconfig
Output: A monorepo with parallel builds, intelligent caching, and shared configuration.
Example 2: Optimize Docker builds for deployment
User request: "Create a Dockerfile for deploying one service from our Turborepo monorepo"
Actions:
- Run
to generate minimal contextturbo prune --scope=@app/api - Create multi-stage Dockerfile using the pruned output
- Install dependencies and build only the targeted package
- Configure cache mounts for faster rebuilds
Output: A lean Docker image containing only the service and its dependencies, not the full monorepo.
Guidelines
- Always define
for cacheable tasks; use emptyoutputs
for side-effect-only tasks likeoutputs: []
.lint - List all environment variables in
orenv
that affect build output.globalEnv - Use
prefix in^
for tasks that consume dependency outputs (build, typecheck).dependsOn - Keep internal packages small and focused:
,@repo/ui
,@repo/db
.@repo/auth - Use
for Docker builds; never copy the entire monorepo into a container.turbo prune - Set up Remote Cache in CI for cross-developer and cross-PR cache sharing.