nx-workspace-patterns

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

1|Updated Aug 17, 2025
One-click install
npx skills add https://github.com/ratnesh-maurya/mdconverter --skill nx-workspace-patterns-ratnesh-maurya
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nx-workspace-patterns
Source: https://github.com/ratnesh-maurya/mdconverter/tree/main/.claude/skills/nx-workspace-patterns
Command: npx skills add https://github.com/ratnesh-maurya/mdconverter --skill nx-workspace-patterns-ratnesh-maurya

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Setting up and maintaining an Nx monorepo involves complex decisions around project structure, dependency boundaries, build caching, and CI optimization, and misconfiguration leads to slow builds and tangled dependencies. ## Core Features & Use Cases - Workspace Configuration: Provides production-ready nx.json and project.json templates covering cacheable operations, target defaults, and named inputs. - Module Boundary Enforcement: Supplies ESLint rules with tag-based dependency constraints to keep apps, features, UI, data-access, and util libraries properly 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 an existing repo to Nx, apply the templates to define library types, enforce scope boundaries between web and api projects, and cut CI time by running only affected tests and builds. ## Quick Start Set up an Nx workspace with module boundary rules and affected-based CI for my web and api projects.

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 with the standard apps and libs directory structure, then configure nx.json with your npm scope, cacheable operations, and target defaults. Use Nx generators like @nx/react:lib 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:web to each project, then define which tag combinations may depend on each other to prevent invalid imports.

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. Combined with caching, this avoids redundant work and significantly reduces CI duration.

Does Nx support remote caching without Nx Cloud?

Yes, Nx supports self-hosted remote caching through custom task runners such as @nx-aws-cache/nx-aws-cache, which stores build artifacts in an S3 bucket. Configure it in nx.json under tasksRunnerOptions with your AWS region and bucket.

When should I not use Nx for a project?

Nx adds overhead that is not justified for single small applications or repos with no shared code. It is designed for monorepos with multiple apps and libraries where dependency graphs, caching, and boundary enforcement provide real value.