monorepo-ops

GitHub

管理 Monorepo 工作区操作,包括使用 pnpm 和 Turbo 运行脚本、添加依赖、修改共享包及跨应用变更。提供过滤器用法、构建验证顺序及架构参考。

.agents/skills/monorepo-ops/SKILL.md YosemiteCrew/Yosemite-Crew

Trigger Scenarios

跨多个应用的变更任务 依赖关系变更 执行 turbo 或 pnpm workspace 命令 修改共享包

Install

npx skills add YosemiteCrew/Yosemite-Crew --skill monorepo-ops -g -y
More Options

Non-standard path

npx skills add https://github.com/YosemiteCrew/Yosemite-Crew/tree/main/.agents/skills/monorepo-ops -g -y

Use without installing

npx skills use YosemiteCrew/Yosemite-Crew@monorepo-ops

指定 Agent (Claude Code)

npx skills add YosemiteCrew/Yosemite-Crew --skill monorepo-ops -a claude-code -g -y

安装 repo 全部 skill

npx skills add YosemiteCrew/Yosemite-Crew --all -g -y

预览 repo 内 skill

npx skills add YosemiteCrew/Yosemite-Crew --list

SKILL.md

Frontmatter
{
    "name": "monorepo-ops",
    "description": "Use for monorepo-level work — running pnpm and turbo scripts, adding dependencies, changing shared packages, or cross-app changes. Covers workspace layout, filters, and build and validation order."
}

Monorepo Operations — Yosemite Crew

Description

Use this skill for any task involving monorepo-level operations: running scripts, adding dependencies, managing shared packages, understanding workspace relationships, or cross-app work.

TRIGGER: tasks spanning multiple apps, dependency changes, turbo commands, pnpm workspace operations, or shared package changes.


Workspace Layout

apps/
  frontend/       frontend
  backend/        backend
  desktop/        @yosemite-crew/desktop
  mobileAppYC/    mobileAppYC
  dev-docs/       dev-docs
packages/
  auth/           @yosemite-crew/auth
  database/       @yosemite-crew/database
  design-tokens/  @yosemite-crew/design-tokens (DEAD - never built, zero consumers; live tokens: apps/frontend/src/app/globals.css)
  fhir/           @yosemite-crew/fhir
  fhirtypes/      @yosemite-crew/fhirtypes
  lib/            @yosemite-crew/lib
  types/          @yosemite-crew/types

Tooling: pnpm workspaces + Turbo. Package manager: pnpm@8.15.6.


Project Architecture Reference

For architecture decisions, technical narratives, or product-engineering context, read .agents/skills/monorepo-ops/project-baseline.md.

Running Commands

Always use --filter to scope to the relevant workspace. Never run commands at root without --filter unless intentionally affecting all packages.

When the touched workspace is apps/frontend, apply Sonar rules from .agents/skills/frontend-sonar/SKILL.md and run the mandatory frontend check order (tsc -> lint -> targeted tests).

# Dev
pnpm --filter frontend dev
pnpm --filter backend dev

# Build
pnpm --filter frontend build
pnpm turbo build --filter=frontend...   # build frontend + its deps

# Lint
pnpm --filter frontend run lint
pnpm --filter backend run lint

# Type check
pnpm --filter frontend run type-check
# or from within the app:
npx tsc --noemit

# Tests (targeted)
pnpm --filter frontend run test -- --testPathPatterns="ComponentName"
pnpm --filter mobileAppYC run test -- --testPathPatterns="ScreenName"

Adding Dependencies

# Add to a specific app
pnpm --filter frontend add <package>
pnpm --filter backend add <package>
pnpm --filter mobileAppYC add <package>

# Add as devDependency
pnpm --filter frontend add -D <package>

# Add to a shared package
pnpm --filter @yosemite-crew/types add <package>

# Add root devDependency (tooling only)
pnpm add -D -w <package>

Shared Packages

Two packages deserve special care: @yosemite-crew/database holds the Prisma schema, migrations, and generated client (the schema source of truth), and @yosemite-crew/auth holds the SuperTokens session helpers used by the backend.

When changing packages/types or packages/fhirtypes:

  1. Update the type definitions.
  2. Build the package you changed: pnpm --filter @yosemite-crew/types build or pnpm --filter @yosemite-crew/fhirtypes build (both have a build script).
  3. All consumers (frontend, backend, mobile) pick up changes automatically via workspace links.
  4. Run type-check in each affected app.

Build Pipeline (Turbo)

turbo.json defines the task graph. Tasks run in dependency order automatically.

pnpm turbo build           # builds all apps in correct order
pnpm turbo build --filter=frontend...  # builds frontend + its dependencies

Pre-commit Hooks

Husky + commitlint are configured. Pre-commit runs a staged-secret scan + lint-staged (eslint --fix, prettier, secretlint on staged files); the full monorepo lint + type-check run at pre-push. Commit messages must follow conventional commits:

<type>(<scope>): <subject>
Types: feat | fix | chore | refactor | test | docs | style | perf | ci

Scope allowlist is defined centrally in root AGENTS.md and enforced by commitlint.config.cjs.

Never skip hooks with --no-verify.


Secrets Check

secretlint runs on commit. Never commit .env files, API keys, tokens, or private keys.

pnpm run check:secrets   # manual check

Gotchas

  • pnpm install at the root installs all workspaces. Never run npm install or yarn — pnpm only.
  • Hoisting: some packages are hoisted to root node_modules, others are not. If you see resolution errors, check pnpm-workspace.yaml.
  • Lock file: always commit pnpm-lock.yaml changes. Never ignore it.
  • If turbo cache causes stale output: pnpm turbo build --force to bypass cache.

Version History

  • 7f92970 Current 2026-08-29 01:14

    更新代理文档以反映 Jest 30、废弃 design-tokens 包及修正过时声明。

  • 3726483 2026-08-20 13:37

Same Skill Collection

.agents/skills/agent-loop/SKILL.md
.agents/skills/backend-patterns/SKILL.md
.agents/skills/code-review/SKILL.md
.agents/skills/desktop-sonar/SKILL.md
.agents/skills/frontend-design/SKILL.md
.agents/skills/frontend-sonar/SKILL.md
.agents/skills/frontend-testing/SKILL.md
.agents/skills/mobile-patterns/SKILL.md
.agents/skills/react-doctor/SKILL.md
.agents/skills/yosemite-client-communications/SKILL.md
.agents/skills/yosemite-data-migration-audit/SKILL.md
.agents/skills/yosemite-inventory-planning/SKILL.md
.agents/skills/yosemite-practice-workflow-audit/SKILL.md
.agents/skills/yosemite-staff-onboarding/SKILL.md
.agents/skills/yosemite-vet-software-buyer/SKILL.md
.agents/skills/yosemite-vet-visit-prep/SKILL.md
.claude/skills/agent-loop/SKILL.md
.claude/skills/backend-patterns/SKILL.md
.claude/skills/code-review/SKILL.md
.claude/skills/desktop-sonar/SKILL.md
.claude/skills/frontend-design/SKILL.md
.claude/skills/frontend-sonar/SKILL.md
.claude/skills/frontend-testing/SKILL.md
.claude/skills/mobile-patterns/SKILL.md
.claude/skills/monorepo-ops/SKILL.md
.claude/skills/react-doctor/SKILL.md
.claude/skills/yosemite-client-communications/SKILL.md
.claude/skills/yosemite-data-migration-audit/SKILL.md
.claude/skills/yosemite-inventory-planning/SKILL.md
.claude/skills/yosemite-practice-workflow-audit/SKILL.md
.claude/skills/yosemite-staff-onboarding/SKILL.md
.claude/skills/yosemite-vet-software-buyer/SKILL.md
.claude/skills/yosemite-vet-visit-prep/SKILL.md

Metadata

Files
0
Version
6932903
Hash
13bdd1ae
Indexed
2026-08-20 13:37

ホーム - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-28 22:15
浙ICP备14020137号-1