Langsung ke konten
Skillpedia
Deploy & cloud (DevOps)12k Β· #11527

turborepo

Fungsinya

Skill ini memandu AI Anda melalui Turborepo, sistem build untuk proyek yang memuat beberapa aplikasi dan paket dalam satu repositori. Skill ini ditujukan untuk developer yang ingin build lebih cepat dan urutan tugas yang jelas.

Kapan dipakai

  • βœ“Saat Anda menyiapkan monorepo dengan beberapa aplikasi atau paket bersama.
  • βœ“Saat Anda mengedit turbo.json atau membutuhkan tugas berjalan dalam urutan yang benar.
  • βœ“Saat build Anda lambat dan Anda ingin memakai caching atau hanya menjalankan bagian yang berubah.

Link skill

https://github.com/trycompai/crm/blob/release/.agents/skills/turborepo/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/trycompai/crm/blob/release/.agents/skills/turborepo/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œSiapkan Turborepo untuk monorepo saya agar tugas build dan test berjalan secara paralel.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Skill menjelaskan bahwa skrip sebaiknya berada di setiap paket, lalu mendaftarkan tugas di turbo.json agar Turborepo dapat menjalankannya secara paralel dan memakai ulang hasil cache.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

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 <task>

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

// DO THIS: Scripts in each package
// apps/web/package.json
{ "scripts": { "build": "next build", "lint": "eslint .", "test": "vitest" } }

// apps/api/package.json
{ "scripts": { "build": "tsc", "lint": "eslint .", "test": "vitest" } }

// packages/ui/package.json
{ "scripts": { "build": "tsc", "lint": "eslint .", "test": "vitest" } }
// turbo.json - register tasks
{
  "tasks": {
    "build": { "dependsOn": ["^build"], "outputs": ["dist/**"] },
    "lint": {},
    "test": { "dependsOn": ["build"] }
  }
}
// Root package.json - ONLY delegates, no task logic
{
  "scripts": {
    "build": "turbo run build",
    "lint": "turbo run lint",
    "test": "turbo run test"
  }
}
// DO NOT DO THIS - defeats parallelization
// Root package.json
{
  "scripts": {
    "build": "cd apps/web && next build && cd ../api && tsc",
    "lint": "eslint apps/ packages/",
    "test": "vitest"
  }
}

Root Tasks (//#taskname) are ONLY for tasks that truly cannot exist in packages, such as Vitest Projects' //#test, repo-wide release scripts, or tooling that does not invoke turbo itself.

Secondary Rule: turbo run vs turbo

Always use turbo run when the command is written into code:

// package.json - ALWAYS "turbo run"
{
  "scripts": {
    "build": "turbo run build"
  }
}
# CI workflows - ALWAYS "turbo run"
- run: turbo run build --affected

The shorthand turbo <tasks> is ONLY for one-off terminal commands typed directly by humans or agents. Never write turbo build into package.json, CI, or scripts.

Quick Decision Trees

"I need to configure a task"

Configure a task?
β”œβ”€ Define task dependencies β†’ references/configuration/tasks.md
β”œβ”€ Lint/check-types (parallel + caching) β†’ Use Transit Nodes pattern (see below)
β”œβ”€ Specify build outputs β†’ references/configuration/tasks.md#outputs
β”œβ”€ Handle environment variables β†’ references/environment/RULE.md
β”œβ”€ Set up dev/watch tasks β†’ references/configuration/tasks.md#persistent
β”œβ”€ Package-specific config β†’ references/configuration/RULE.md#package-configurations
└─ Global settings (cacheDir, daemon) β†’ references/configuration/global-options.md

"My cache isn't working"

Cache problems?
β”œβ”€ Tasks run but outputs not restored β†’ Missing `outputs` key
β”œβ”€ Cache misses unexpectedly β†’ references/caching/gotchas.md
β”œβ”€ Need to debug hash inputs β†’ Use --summarize or --dry
β”œβ”€ Want to skip cache entirely β†’ Use --force or cache: false
β”œβ”€ Remote cache not working β†’ references/caching/remote-cache.md
└─ Environment causing misses β†’ references/environment/gotchas.md

"I want to run only changed packages"

Run only what changed?
β”œβ”€ Changed packages + dependents (RECOMMENDED) β†’ turbo run build --affected
β”œβ”€ Custom base branch β†’ --affected --affected-base=origin/develop
β”œβ”€ Manual git comparison β†’ --filter=...[origin/main]
└─ See all filter options β†’ references/filtering/RULE.md

--affected is the primary way to run only changed packages. It automatically compares against the default branch and includes dependents.

"I want to filter packages"

Filter packages?
β”œβ”€ Only changed packages β†’ --affected (see above)
β”œβ”€ By package name β†’ --filter=web
β”œβ”€ By directory β†’ --filter=./apps/*
β”œβ”€ Package + dependencies β†’ --filter=web...
β”œβ”€ Package + dependents β†’ --filter=...web
└─ Complex combinations β†’ references/filtering/patterns.md

"Environment variables aren't working"

Environment issues?
β”œβ”€ Vars not available at runtime β†’ Strict mode filtering (default)
β”œβ”€ Cache hits with wrong env β†’ Var not in `env` key
β”œβ”€ .env changes not causing rebuilds β†’ .env not in `inputs`
β”œβ”€ CI variables missing β†’ references/environment/gotchas.md
└─ Framework vars (NEXT_PUBLIC_*) β†’ Auto-included via inference

"I need to set up CI"

CI setup?
β”œβ”€ GitHub Actions β†’ references/ci/github-actions.m
Pertanyaan umum

Apakah skrip sebaiknya ditaruh di package.json root?

Skill merekomendasikan menaruh skrip tugas di setiap paket, dan hanya menyimpan perintah turbo di package.json root.

Apa fungsi turbo.json?

Berkas itu mencantumkan tugas, urutannya, keluarannya, dan ketergantungannya, sehingga Turborepo tahu apa yang harus dijalankan dan di-cache.

Apakah skill membahas kecepatan CI?

Ya. Skill menyebut optimasi CI, remote cache, dan hanya menjalankan bagian repositori yang terdampak.

Detail

Deskripsi asli dari pembuat

Turborepo monorepo build system guidance. Triggers on: turbo.json, task pipelines, dependsOn, caching, remote cache, the "turbo" CLI, --filter, --affected, CI optimization, environment variables, internal packages, monorepo structure/best practices, and boundaries. Use when user: configures tasks/workflows/pipelines, creates packages, sets up monorepo, shares code between apps, runs changed/affected packages, debugs cache, or has apps/packages directories.

repo: trycompai/crm

Popularitas

Bintang GitHub
12k
Peringkat
#11527
Lisensi
MIT
Diperbarui
1/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa