nx-workspace-patterns

Configure Nx monorepo workspaces with module boundaries, caching, and affected commands.

Updated May 20, 2026
One-click install
npx skills add https://github.com/TechCorp25/kingdom --skill nx-workspace-patterns-techcorp25
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: nx-workspace-patterns
Source: https://github.com/TechCorp25/kingdom/tree/main/.claude/skills/developer-essentials/skills/nx-workspace-patterns
Command: npx skills add https://github.com/TechCorp25/kingdom --skill nx-workspace-patterns-techcorp25

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Setting up and maintaining an Nx monorepo involves complex configuration decisions around project structure, dependency boundaries, build caching, and CI optimization that are easy to get wrong and costly to fix later. ## Core Features & Use Cases - Workspace Configuration: Provides production-ready nx.json and project.json templates covering caching, target defaults, and generator defaults. - Module Boundary Enforcement: Supplies ESLint rules with tag-based dependency constraints to keep the project graph acyclic and layered. - CI Optimization: Includes GitHub Actions workflows using affected commands and remote caching setups with Nx Cloud or self-hosted S3. - Use Case: When migrating a growing codebase into an Nx monorepo, use these templates to define library types (feature, ui, data-access, util), enforce scope boundaries, and configure CI to only build and test affected projects. ## Quick Start Ask the AI to set up an Nx workspace with module boundary rules and affected-based CI using these patterns.

Frequently Asked Questions about nx-workspace-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up an Nx monorepo workspace?▼

Create the workspace structure with apps/ for deployables and libs/ for shared code, then configure nx.json with cacheable operations, target defaults, and named inputs. Use Nx generators to scaffold applications and libraries with consistent settings.

How to enforce module boundaries in Nx with ESLint?▼

Use the @nx/enforce-module-boundaries ESLint rule with depConstraints based on project tags. Assign tags like type:feature or scope:shared to projects, then define which tag combinations may depend on each other.

How do Nx affected commands speed up CI?▼

Nx affected commands compare the current branch against a base SHA to identify only changed projects, then run lint, test, and build targets solely on those. This avoids rebuilding the entire monorepo on every pull request.

Does Nx support remote build caching?▼

Yes, Nx supports remote caching through Nx Cloud by setting the tasks runner to nx-cloud with an access token, or through self-hosted options like @nx-aws-cache/nx-aws-cache backed by an S3 bucket.

What library types should an Nx monorepo use?▼

Common library types are feature (business logic), ui (presentational components), data-access (API and state), util (pure helpers), and shell (app bootstrapping). Keeping each library focused on one type prevents circular dependencies.

When should I not over-split libraries in Nx?▼

Avoid over-granularizing when libraries become too small to justify their maintenance overhead, since each library adds build graph complexity. Balance library count against team ownership and actual reuse needs.