nx-workspace
Original:🇺🇸 English
Translated
Configure, explore, and optimize Nx monorepo workspaces. Use when setting up Nx, exploring workspace structure, configuring project boundaries, running tasks, analyzing affected projects, optimizing build caching, or implementing CI/CD with affected commands. Keywords - nx, monorepo, workspace, projects, targets, affected, build, lint, test.
5installs
Added on
NPX Install
npx skill4agent add tech-leads-club/agent-skills nx-workspaceTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Nx Workspace Management
Quick Start
Exploring workspace: and
Running tasks: (e.g., )
Affected analysis: or
nx show projectsnx show project <name> --jsonRunning tasks:
nx <target> <project>nx build my-appAffected analysis:
nx show projects --affectednx affected -t <target>Note: Prefix commands with/npx/pnpxif nx isn't installed globally.yarn
Core Commands
List and Explore Projects
bash
# List all projects
nx show projects
# Filter by type, pattern, or target
nx show projects --type app
nx show projects --projects "apps/*"
nx show projects --withTarget build
# Find affected projects
nx show projects --affected --base=mainGet Project Information
Critical: Always use for full resolved configuration. Do NOT read directly - it contains only partial configuration.
nx show project <name> --jsonproject.jsonbash
# Get full configuration
nx show project my-app --json
# Extract targets
nx show project my-app --json | jq '.targets | keys'Configuration schemas:
- Workspace:
node_modules/nx/schemas/nx-schema.json - Project:
node_modules/nx/schemas/project-schema.json
Run Tasks
bash
# Run specific project
nx build web --configuration=production
# Run affected
nx affected -t test --base=main
# View dependency graph
nx graphWorkspace Architecture
workspace/
├── apps/ # Deployable applications
├── libs/ # Shared libraries
│ ├── shared/ # Shared across scopes
│ └── feature/ # Feature-specific
├── nx.json # Workspace configuration
└── tools/ # Custom executors/generatorsLibrary Types
| Type | Purpose | Example |
|---|---|---|
| feature | Business logic, smart components | |
| ui | Presentational components | |
| data-access | API calls, state management | |
| util | Pure functions, helpers | |
Detailed Resources
Configuration: See reference/configuration.md for:
- nx.json templates and options
- project.json structure
- Module boundary rules
- Remote caching setup
Commands: See reference/commands.md for:
- Complete command reference
- Advanced filtering options
- Common workflows
CI/CD: See reference/ci-cd.md for:
- GitHub Actions configuration
- GitLab CI setup
- Jenkins, Azure Pipelines, CircleCI examples
- Affected commands in pipelines
Best Practices: See reference/best-practices.md for:
- Do's and don'ts
- Complete troubleshooting guide
- Performance optimization
- Migration guides
Common Workflows
"What's in this workspace?"
bash
nx show projects --type app # List applications
nx show projects --type lib # List libraries"How do I run project X?"
bash
nx show project X --json | jq '.targets | keys'"What changed?"
bash
nx show projects --affected --base=mainQuick Troubleshooting
- Targets not showing: Use , not project.json
nx show project <name> --json - Affected not working: Ensure git history available (in CI)
fetch-depth: 0 - Cache issues: Run
nx reset
For detailed troubleshooting, see reference/best-practices.md.