‹ 首页

monorepo

@avibebuilder · 收录于 1 周前

MUST use for ANY query mentioning packages, monorepo, workspace, catalog, turbo, turborepo, or pnpm in a multi-package context. MUST use when sharing config (ESLint, tsconfig, prettier) across packages, fixing build order between packages, adding new packages, scoping CI installs/caching to changed packages, or debugging pnpm catalog version resolution. This skill OWNS all cross-package coordination problems — even when they look like build, CI, config, or dependency issues. If two or more packages interact in the query, this skill applies. Takes priority over other skills when the problem spans package boundaries.

适合你,如果维护着包含多个相互依赖包的项目

/ 下载安装
monorepo.skill双击,或拖进 Claude 桌面版 / Cowork,即完成安装↓ .skill↓ .zip
用别的 agent?下载 .zip 解压,把文件夹放进它的技能目录
Claude Code~/.claude/skills/(项目级 .claude/skills/)
Codex CLI~/.codex/skills/
Cursor自动读取上面两处目录
其他工具见其文档的「skills」目录;两个下载是同一份文件,只是名字不同
/ 通过 npx 安装 校验哈希
npx oh-my-skill add avibebuilder/claude-prime/monorepo
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- avibebuilder/claude-prime/monorepo
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify avibebuilder/claude-prime/monorepo
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
106GitHub stars
~1K最小装载
~5.4K含声明引用
~5.4K文本包总量
镜像托管

怎么用

技能原文 SKILL.md作者撰写 · MIT · 80bcfa4

Monorepo

Project-specific patterns for pnpm workspaces + Turborepo.

Architecture Decisions
Workspace Organization
  1. Split apps from packagesapps/ for deployables, packages/ for shared libraries.
  2. Namespace packages — Prefix with @org/ to avoid npm conflicts.
  3. Single lockfilepnpm-lock.yaml at root only. Never commit multiple lockfiles.
  4. No cross-package file access — Never use ../ to reach into other packages; import via dependencies.
Dependency Management
  1. Use workspace:* protocol — Always for internal package dependencies.
  2. Hoist common devDependencies — Shared tooling (TypeScript, ESLint) in root.
  3. Peer dependencies for frameworks — React, Vue, etc. as peers to avoid version conflicts.
  4. Consider Catalogs (pnpm 9.5+) — Centralize versions in pnpm-workspace.yaml for large repos.
Turborepo Tasks
  1. Use ^ for build dependencies"dependsOn": ["^build"] for topological order.
  2. Always define outputs — Without outputs, nothing gets cached.
  3. Mark dev servers as persistent"persistent": true, "cache": false.
  4. Be explicit about environment — List all build-affecting vars in env or globalEnv.
Gotchas
  • Missing outputs in turbo.json silently disables caching for that task. The task runs every time and you won't get an error — just slow builds. Always verify outputs are configured.
  • pnpm install does NOT respect --filter for installation — it always installs the entire workspace. Filtering only works for pnpm run and pnpm exec.
  • workspace:* resolves to the CURRENT version of the local package, not "latest from npm". If the package has "version": "0.0.0", published packages will have "dependency": "0.0.0" — set meaningful versions before publishing.
  • Turborepo's env field in turbo.json uses GLOB patterns, not exact matches. "env": ["API_*"] captures API_KEY, API_URL, etc. Forgetting this causes over-invalidation.
  • turbo run build --filter=app-a builds app-a AND all its workspace dependencies. If a dependency fails, app-a won't build. Check transitive deps.
  • Adding a package to packages/ requires running pnpm install before the workspace recognizes it. The new package also needs a valid package.json with name matching the workspace pattern.
  • TypeScript project references (references in tsconfig.json) must match the workspace dependency graph. Mismatches cause type errors that only appear during tsc --build, not in IDE.
  • turbo.json's globalDependencies invalidates ALL tasks when listed files change. Don't put frequently-changed files here — use task-level inputs instead.
  • Shared Tailwind configs need @source directives pointing to consuming packages' source directories, otherwise classes used in shared packages are purged.
  • pnpm deploy (for production) copies a single package and its dependencies to a target directory. It does NOT run build scripts — build first, then deploy.
  • Remote cache (Vercel or self-hosted) requires outputs to be correct. If outputs are wrong, cached artifacts will be incomplete and downstream tasks break silently.
  • persistent: true tasks prevent turbo run from exiting. Don't include persistent tasks in CI pipelines unless they have a timeout.
References

| When you need... | Read | |------------------|------| | workspace.yaml, workspace: protocol, filtering | [pnpm-workspace.md](./references/pnpm-workspace.md) | | turbo.json schema, tasks, dependsOn | [turborepo.md](./references/turborepo.md) | | Cache outputs/inputs, remote cache setup | [caching.md](./references/caching.md) | | Directory layout, package naming, tsconfig | [structure.md](./references/structure.md) | | Tailwind v4 shared theme package | [tailwind-v4.md](./references/tailwind-v4.md) |

External Resources
按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。