nx-monorepo▌
giuseppe-trisciuoglio/developer-kit · updated Apr 8, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
Provides guidance for Nx monorepo management in TypeScript/JavaScript projects. Covers workspace creation, project generation, task execution, caching strategies, Module Federation, and CI/CD integration.
Nx Monorepo
Overview
Provides guidance for Nx monorepo management in TypeScript/JavaScript projects. Covers workspace creation, project generation, task execution, caching strategies, Module Federation, and CI/CD integration.
When to Use
Use this skill when:
- Creating a new Nx workspace or initializing Nx in an existing project
- Generating applications, libraries, or components with Nx generators
- Running affected commands or executing tasks across multiple projects
- Setting up CI/CD pipelines for Nx projects (GitHub Actions, CircleCI, etc.)
- Configuring Module Federation with React or Next.js
- Implementing NestJS backend applications within Nx
- Managing TypeScript package libraries with buildable and publishable libs
- Setting up remote caching or Nx Cloud
- Optimizing monorepo build times and caching strategies
- Debugging dependency graph issues or circular dependencies
Trigger phrases: "create Nx workspace", "Nx monorepo", "generate Nx app", "Nx affected", "Nx CI/CD", "Module Federation Nx", "Nx Cloud"
Instructions
Workspace Creation
-
Create a new workspace with interactive setup:
npx create-nx-workspace@latestFollow prompts to select preset (Integrated, Standalone, Package-based) and framework stack.
-
Initialize Nx in an existing project:
nx@latest init -
Create with specific preset (non-interactive):
npx create-nx-workspace@latest my-workspace --preset=reactVerify:
nx show projectslists the new workspace projects
Project Generation
-
Generate a React application:
nx g @nx/react:app my-app -
Generate a library:
# React library nx g @nx/react:lib my-lib # TypeScript library nx g @nx/js:lib my-utilVerify:
nx show projectslists the new lib -
Generate a component in lib:
nx g @nx/react:component my-comp --project=my-lib -
Generate NestJS backend:
nx g @nx/nest:app my-apiVerify:
nx show projectslistsmy-apiandnx run my-api:buildsucceeds
Task Execution
-
Run tasks for affected projects only:
nx affected -t lint test build -
Run tasks across all projects:
# Build all projects nx run-many -t build # Test specific projects nx run-many -t test -p=my-app,my-lib # Test by pattern nx run-many -t test --projects=*-app -
Run specific target on single project:
nx run my-app:build -
Visualize dependency graph:
nx graph
Project Configuration
Each project has a project.json defining targets, executor, and configurations:
{
"name": "my-app",
"projectType": "application",
"sourceRoot": "apps/my-app/src",
"targets": {
"build": {
"executor": "@nx/react:webpack",
"outputs": ["{workspaceRoot}/dist/apps/my-app"],
"configurations": {
"production": {
"optimization": true
}
}
},
"test": {
"executor": "@nx/vite:test"
}
},
"tags": ["type:app", "scope:frontend"]
}
Dependency Management
-
Set up project dependencies:
{ "targets": { "build": { "dependsOn": [ { "projects": ["shared-ui"], "target": "build" } ] } } } -
Use tags for organization:
{ "tags": ["type:ui", "scope:frontend", "platform:web"] }
Module Federation (Nx 17+)
-
Generate a remote (micro-frontend):
nx g @nx/react:remote checkout --host=dashboard -
Generate a host:
nx g @nx/react:host dashboard
CI/CD Setup
Use affected commands in CI to only build/test changed projects:
# .github/workflows/ci.yml
- run: npx nx affected -t lint --parallel
- run: npx nx affected -t test --parallel
- run: npx nx affected -t build --parallel
Examples
Example 1: Create New React Workspace
Input: "Create a new Nx workspace with React and TypeScript"
Steps:
npx create-nx-workspace@latest my-workspace
# Select: Integrated Monorepo → React → Integrated monorepo (Nx Cloud)
Verify: cd my-workspace && nx show projects lists the created app
Expected Result: Workspace created with:
apps/directory with React applibs/directory for shared librariesnx.jsonwith cache configuration- CI/CD workflow files ready
Example 2: Run Tests for Changed Projects
Input: "Run tests only for projects affected by recent changes"
Command:
nx affected -t test --base=main~1 --head=main
Expected Result: Only tests for projects affected by changes between commits are executed, leveraging cached results from previous runs.
Example 3: Generate and Build a Shared Library
Input: "Create a shared UI library and use it in the app"
Steps:
# Generate library
nx g @nx/react:lib shared-ui
# Generate component in library
nx g @nx/react:component button --project=shared-ui
# Import in app (tsconfig paths auto-configured)
import { Button } from '@my-workspace/shared-ui'
Verify: nx run shared-ui:build completes successfully and nx graph shows the dependency link to your app
Expected Result: Buildable library at libs/shared-ui with proper TypeScript path mapping configured.
Example 4: Set Up Module Federation
Input: "Configure Module Federation for micro-frontends"
Steps:
# Create host app
nx g @nx/react:host dashboard
# Add remote to host
nx g @nx/react:remote product-catalog --host=dashboard
# Start dev servers
nx run dashboard:serve
nx run product-catalog:serve
Verify: Both servers start without errors and nx graph shows dashboard → product-catalog remote connection
Expected Result: Two separate applications running where product-catalog loads dynamically into dashboard at runtime.
Example 5: Debug Build Dependencies
Input: "Why is my app rebuilding when unrelated lib changes?"
Diagnosis:
# Show project graph
nx graph --focused=my-app
# Check implicit dependencies
nx show project my-app --json | grep implicitDependencies
Solution: Add explicit dependency configuration or use namedInputs in nx.json to exclude certain files from triggering builds.
Verify Fix Worked: Make a change to the unrelated lib, run nx affected -t build — my-app should not appear in the affected projects list.
Best Practices
- Always use
nx affectedin CI to only test/build changed projects - Organize libs by domain/business capability, not by technical layer
- Use tags consistently (
type:app|lib,scope:frontend|backend|shared) - Prevent circular dependencies by configuring
workspaceLayoutboundaries innx.json - Enable remote caching with Nx Cloud for team productivity
- Keep project.json simple - use defaults from
nx.jsonwhen possible - Leverage generators instead of manual file creation for consistency
- Configure
namedInputsto exclude test files from production cache keys - Use Module Federation for independent deployment of micro-frontends
- Keep workspace generators in
tools/for project-specific scaffolding
Constraints and Warnings
- Node.js 18.10+ is required for Nx 17+
- Windows users: Use WSL or Git Bash for best experience
- First-time setup may take longer due to package installation
- Large monorepos (50+ projects) should use distributed task execution
- Module Federation requires webpack 5+ and specific Nx configuration
- Some generators require additional plugins to be installed first
- Cache location: Default
~/.nx/cachecan grow large; configurecacheDirectoryinnx.jsonif needed - Circular dependencies will cause build failures; use
nx graphto visualize - Preset migration: Converting between Integrated/Standalone/Package-based requires manual effort
Reference Files
For detailed guidance on specific topics, consult:
| Topic | Reference File |
|---|---|
| Workspace setup, basic commands | references/basics.md |
| Generators (app, lib, component) | references/generators.md |
| React, Next.js, Expo patterns | references/react.md |
| NestJS backend patterns | references/nestjs.md |
| TypeScript packages | references/typescript.md |
| CI/CD (GitHub, CircleCI, etc.) | references/ci-cd.md |
| Caching, affected, advanced | references/advanced.md |
How to use nx-monorepo on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add nx-monorepo
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches nx-monorepo from GitHub repository giuseppe-trisciuoglio/developer-kit and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate nx-monorepo. Access the skill through slash commands (e.g., /nx-monorepo) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
User Story & Requirements Generation
Create detailed user stories, acceptance criteria, and feature specs
Example
Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios
Reduce spec writing time by 50%, ensure comprehensive coverage
Competitive Analysis
Research competitors, compare features, identify gaps
Example
Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities
Complete competitive research in 2 hours instead of 2 days
Roadmap Prioritization
Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs
Example
Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale
Make data-driven prioritization decisions faster
Stakeholder Communication
Draft PRDs, status updates, and stakeholder presentations
Example
Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement
Save 3-5 hours/week on communication overhead
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client
- ›Access to product documentation and roadmap tools (Jira, Notion, etc.)
- ›Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
- ›Stakeholder contact information and communication channels
Time Estimate
30-60 minutes to see productivity improvements
Installation Steps
- 1.Install product management skill
- 2.Start with user story generation for known feature
- 3.Progress to competitive analysis: research 2-3 competitors
- 4.Use for roadmap prioritization: apply RICE/ICE scoring
- 5.Draft stakeholder communications and refine based on feedback
- 6.Build template library for recurring PM tasks
- 7.Share effective prompts with product team
Common Pitfalls
- ⚠Not validating competitive research—verify facts before sharing
- ⚠Accepting user stories without involving engineering team
- ⚠Over-relying on frameworks without qualitative judgment
- ⚠Not customizing outputs to company culture and communication style
- ⚠Skipping stakeholder validation of generated requirements
Best Practices▌
✓ Do
- +Validate research and competitive analysis with real data
- +Collaborate with engineering when generating technical requirements
- +Customize frameworks and templates to your company context
- +Use skill for first drafts, refine with stakeholder input
- +Document successful prompt patterns for PM tasks
- +Combine AI efficiency with human judgment and intuition
✗ Don't
- −Don't publish competitive analysis without fact-checking
- −Don't finalize user stories without engineering review
- −Don't make prioritization decisions solely on AI scoring
- −Don't skip customer validation of generated requirements
- −Don't ignore company-specific context and culture
💡 Pro Tips
- ★Provide context: company goals, constraints, customer feedback
- ★Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
- ★Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
- ★Use skill for 70% generation + 30% customization to company needs
When to Use This▌
✓ Use When
Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.
✗ Avoid When
Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.
Learning Path▌
- 1Basic: user stories, feature specs, status updates
- 2Intermediate: competitive analysis, prioritization frameworks, PRDs
- 3Advanced: product strategy, go-to-market planning, OKR setting
- 4Expert: product vision, market positioning, business model innovation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.5★★★★★31 reviews- ★★★★★Tariq Shah· Dec 20, 2024
Useful defaults in nx-monorepo — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Ganesh Mohane· Dec 16, 2024
Useful defaults in nx-monorepo — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Meera Thomas· Dec 16, 2024
nx-monorepo has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Aisha Park· Nov 19, 2024
Registry listing for nx-monorepo matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Aisha Ghosh· Nov 11, 2024
nx-monorepo is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Sakshi Patil· Nov 7, 2024
nx-monorepo is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Zara Robinson· Nov 7, 2024
nx-monorepo fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Chaitanya Patil· Oct 26, 2024
Keeps context tight: nx-monorepo is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Tariq Sharma· Oct 26, 2024
We added nx-monorepo from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Layla Desai· Oct 10, 2024
nx-monorepo reduced setup friction for our internal harness; good balance of opinion and flexibility.
showing 1-10 of 31