Nx Workspace Patterns

作者 wshobson46891e7e60da無授權條款收錄於 2026年10月8日更新於 2026年10月8日

Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.

AI 產生的概覽

指導設定與最佳化 Nx monorepo 工作區,涵蓋專案邊界、快取與 affected 指令。

功能
提供 Nx monorepo 管理的正式環境模式,涵蓋工作區架構、函式庫類型與最佳實務。內容說明如何設定 Nx 工作區、設定專案邊界、以 affected 指令最佳化 CI,以及實作遠端快取。詳細範本與完整範例放在獨立的參考檔案中。
適用情境
適合在設定新的 Nx 工作區、移轉至 Nx,或定義專案邊界與函式庫類型時使用。也適合以 affected 指令與遠端快取最佳化 CI,以及管理專案之間的相依關係。
執行需求
沒有指令碼,僅為說明內容。內容引用配套檔案 references/details.md 以取得範本與完整範例。

Nx Workspace Patterns

Production patterns for Nx monorepo management.

When to Use This Skill

  • Setting up new Nx workspaces
  • Configuring project boundaries
  • Optimizing CI with affected commands
  • Implementing remote caching
  • Managing dependencies between projects
  • Migrating to Nx

Core Concepts

1. Nx Architecture

workspace/├── apps/              # Deployable applications│   ├── web/│   └── api/├── libs/              # Shared libraries│   ├── shared/│   │   ├── ui/│   │   └── utils/│   └── feature/│       ├── auth/│       └── dashboard/├── tools/             # Custom executors/generators├── nx.json            # Nx configuration└── workspace.json     # Project configuration

2. Library Types

TypePurposeExample
featureSmart components, business logicfeature-auth
uiPresentational componentsui-buttons
data-accessAPI calls, state managementdata-access-users
utilPure functions, helpersutil-formatting
shellApp bootstrappingshell-web

Templates and detailed worked examples

Full template library and detailed worked examples live in references/details.md. Read that file when you need the concrete templates.

Best Practices

Do's

  • Use tags consistently - Enforce with module boundaries
  • Enable caching early - Significant CI savings
  • Keep libs focused - Single responsibility
  • Use generators - Ensure consistency
  • Document boundaries - Help new developers

Don'ts

  • Don't create circular deps - Graph should be acyclic
  • Don't skip affected - Test only what changed
  • Don't ignore boundaries - Tech debt accumulates
  • Don't over-granularize - Balance lib count

來源與署名

來源:wshobson/agents位於plugins/developer-essentials/skills/nx-workspace-patterns提交46891e7

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架