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 从公开仓库中收录这些内容。

举报或申请下架