Agent skill
nx-workspace
Configure, explore, and optimize Nx monorepo workspaces. Use when setting up Nx, exploring workspace structure, configuring project boundaries, analyzing affected projects, optimizing build caching, or implementing CI/CD with affected commands. Keywords — nx, monorepo, workspace, projects, targets, affected. Do NOT use for running tasks (use nx-run-tasks) or code generation with generators (use nx-generate).
Install this agent skill to your Project
npx add-skill https://github.com/tech-leads-club/agent-skills/tree/main/packages/skills-catalog/skills/(tooling)/nx-workspace
SKILL.md
Nx Workspace Management
Quick Start
Exploring workspace: nx show projects and nx show project <name> --json
Running tasks: nx <target> <project> (e.g., nx build my-app)
Affected analysis: nx show projects --affected or nx affected -t <target>
Note: Prefix commands with
npx/pnpx/yarnif nx isn't installed globally.
Core Commands
List and Explore Projects
# 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=main
Get Project Information
Critical: Always use nx show project <name> --json for full resolved configuration. Do NOT read project.json directly - it contains only partial configuration.
# 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
# Run specific project
nx build web --configuration=production
# Run affected
nx affected -t test --base=main
# View dependency graph
nx graph
Workspace Architecture
workspace/
├── apps/ # Deployable applications
├── libs/ # Shared libraries
│ ├── shared/ # Shared across scopes
│ └── feature/ # Feature-specific
├── nx.json # Workspace configuration
└── tools/ # Custom executors/generators
Library Types
| Type | Purpose | Example |
|---|---|---|
| feature | Business logic, smart components | feature-auth |
| ui | Presentational components | ui-buttons |
| data-access | API calls, state management | data-access-users |
| util | Pure functions, helpers | util-formatting |
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?"
nx show projects --type app # List applications
nx show projects --type lib # List libraries
"How do I run project X?"
nx show project X --json | jq '.targets | keys'
"What changed?"
nx show projects --affected --base=main
Quick Troubleshooting
- Targets not showing: Use
nx show project <name> --json, not project.json - Affected not working: Ensure git history available (
fetch-depth: 0in CI) - Cache issues: Run
nx reset
For detailed troubleshooting, see reference/best-practices.md.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
seo
Optimize for search engine visibility and ranking. Use when asked to "improve SEO", "optimize for search", "fix meta tags", "add structured data", "sitemap optimization", or "search engine optimization". Do NOT use for accessibility (use web-accessibility), performance (use core-web-vitals), or comprehensive site audits covering multiple areas (use web-quality-audit).
web-quality-audit
Comprehensive web quality audit covering performance, accessibility, SEO, and best practices in a single review. Use when asked to "audit my site", "review web quality", "run lighthouse audit", "check page quality", or "optimize my website" across multiple areas at once. Orchestrates specialized skills for depth. Do NOT use for single-area audits — prefer core-web-vitals, web-accessibility, seo, or web-best-practices for focused work.
accessibility
Audit and improve web accessibility following WCAG 2.1 guidelines. Use when asked to "improve accessibility", "a11y audit", "WCAG compliance", "screen reader support", "keyboard navigation", or "make accessible". Do NOT use for SEO (use seo), performance (use core-web-vitals), or comprehensive site audits covering multiple areas (use web-quality-audit).
react-best-practices
React and Next.js performance optimization guidelines from Vercel Engineering. Use when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements. Do NOT use for component API architecture or composition patterns (use react-composition-patterns instead).
best-practices
Apply modern web development best practices for security, compatibility, and code quality. Use when asked to "apply best practices", "security audit", "modernize code", "code quality review", or "check for vulnerabilities". Do NOT use for accessibility (use web-accessibility), SEO (use seo), performance (use core-web-vitals), or comprehensive multi-area audits (use web-quality-audit).
perf-lighthouse
Run Lighthouse audits locally via CLI or Node API, parse and interpret reports, and set performance budgets. Use when measuring site performance, understanding Lighthouse scores, setting up budgets, or integrating audits into CI. Triggers on: lighthouse, run lighthouse, lighthouse score, performance audit, performance budget. Do NOT use for fixing specific performance issues (use perf-web-optimization or core-web-vitals) or Astro-specific optimization (use perf-astro).
Didn't find tool you were looking for?