feat: Complete fleet — 94 skills across 10+ domains
Pulled ALL skills from 15 source repositories: - anthropics/skills: 16 (docs, design, MCP, testing) - obra/superpowers: 14 (TDD, debugging, agents, planning) - coreyhaines31/marketingskills: 25 (marketing, CRO, SEO, growth) - better-auth/skills: 5 (auth patterns) - vercel-labs/agent-skills: 5 (React, design, Vercel) - antfu/skills: 16 (Vue, Vite, Vitest, pnpm, Turborepo) - Plus 13 individual skills from various repos Mosaic Stack is not limited to coding — the Orchestrator and subagents serve coding, business, design, marketing, writing, logistics, analysis, and more. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
107
skills/turborepo/references/caching/RULE.md
Normal file
107
skills/turborepo/references/caching/RULE.md
Normal file
@@ -0,0 +1,107 @@
|
||||
# How Turborepo Caching Works
|
||||
|
||||
Turborepo's core principle: **never do the same work twice**.
|
||||
|
||||
## The Cache Equation
|
||||
|
||||
```
|
||||
fingerprint(inputs) → stored outputs
|
||||
```
|
||||
|
||||
If inputs haven't changed, restore outputs from cache instead of re-running the task.
|
||||
|
||||
## What Determines the Cache Key
|
||||
|
||||
### Global Hash Inputs
|
||||
|
||||
These affect ALL tasks in the repo:
|
||||
|
||||
- `package-lock.json` / `yarn.lock` / `pnpm-lock.yaml`
|
||||
- Files listed in `globalDependencies`
|
||||
- Environment variables in `globalEnv`
|
||||
- `turbo.json` configuration
|
||||
|
||||
```json
|
||||
{
|
||||
"globalDependencies": [".env", "tsconfig.base.json"],
|
||||
"globalEnv": ["CI", "NODE_ENV"]
|
||||
}
|
||||
```
|
||||
|
||||
### Task Hash Inputs
|
||||
|
||||
These affect specific tasks:
|
||||
|
||||
- All files in the package (unless filtered by `inputs`)
|
||||
- `package.json` contents
|
||||
- Environment variables in task's `env` key
|
||||
- Task configuration (command, outputs, dependencies)
|
||||
- Hashes of dependent tasks (`dependsOn`)
|
||||
|
||||
```json
|
||||
{
|
||||
"tasks": {
|
||||
"build": {
|
||||
"dependsOn": ["^build"],
|
||||
"inputs": ["src/**", "package.json", "tsconfig.json"],
|
||||
"env": ["API_URL"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## What Gets Cached
|
||||
|
||||
1. **File outputs** - files/directories specified in `outputs`
|
||||
2. **Task logs** - stdout/stderr for replay on cache hit
|
||||
|
||||
```json
|
||||
{
|
||||
"tasks": {
|
||||
"build": {
|
||||
"outputs": ["dist/**", ".next/**"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Local Cache Location
|
||||
|
||||
```
|
||||
.turbo/cache/
|
||||
├── <hash1>.tar.zst # compressed outputs
|
||||
├── <hash2>.tar.zst
|
||||
└── ...
|
||||
```
|
||||
|
||||
Add `.turbo` to `.gitignore`.
|
||||
|
||||
## Cache Restoration
|
||||
|
||||
On cache hit, Turborepo:
|
||||
|
||||
1. Extracts archived outputs to their original locations
|
||||
2. Replays the logged stdout/stderr
|
||||
3. Reports the task as cached (shows `FULL TURBO` in output)
|
||||
|
||||
## Example Flow
|
||||
|
||||
```bash
|
||||
# First run - executes build, caches result
|
||||
turbo build
|
||||
# → packages/ui: cache miss, executing...
|
||||
# → packages/web: cache miss, executing...
|
||||
|
||||
# Second run - same inputs, restores from cache
|
||||
turbo build
|
||||
# → packages/ui: cache hit, replaying output
|
||||
# → packages/web: cache hit, replaying output
|
||||
# → FULL TURBO
|
||||
```
|
||||
|
||||
## Key Points
|
||||
|
||||
- Cache is content-addressed (based on input hash, not timestamps)
|
||||
- Empty `outputs` array means task runs but nothing is cached
|
||||
- Tasks without `outputs` key cache nothing (use `"outputs": []` to be explicit)
|
||||
- Cache is invalidated when ANY input changes
|
||||
Reference in New Issue
Block a user