
Nx Generate
Scaffold Nx apps, libraries, and workspace generators with non-interactive CLI runs instead of hand-rolling monorepo structure.
Overview
nx-generate is an agent skill for the Build phase that runs Nx generators to scaffold apps, libraries, and workspace structure with non-interactive discovery and verification.
Install
npx skills add https://github.com/nrwl/nx-ai-agents-config --skill nx-generateWhat is this skill?
- Invoke before nx_docs when trigger words are scaffold, setup, generate, or new app/lib
- Runs generators with --no-interactive to avoid hanging prompts
- Reads generator source plus schema to match what the generator actually does
- Aligns output with existing repo patterns from similar artifacts
- Verifies with lint, test, build, or typecheck targets appropriate to the workspace
- Always use --no-interactive on generator runs
Adoption & trust: 1.9k installs on skills.sh; 24 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need new monorepo projects or migrations but guessing flags or reading docs first wastes agent time and risks inconsistent structure.
Who is it for?
Solo builders adding Nx apps/libs or running workspace generators who want one disciplined flow with --no-interactive and post-generate verification.
Skip if: Teams that only need Nx concept docs without running a generator, or workspaces where interactive CLI prompts are required.
When should I use this skill?
User mentions scaffolding, setup, structure, creating apps/libs, project structure, generate, add a new project, or trigger words scaffold, setup, create a new app, create a new lib.
What do I get? / Deliverables
After the skill runs, generated code follows repo patterns and passes the workspace’s lint, test, build, or typecheck checks you choose for verification.
- Scaffolded app or library
- Generator-driven file changes
- Verification pass on lint/test/build/typecheck
Recommended Skills
Journey fit
Creating apps and libs is core product construction in a monorepo, which maps to the Build phase. Nx generators wire workspace structure and tooling—integration-style setup across projects rather than a single UI screen.
How it compares
Use instead of ad-hoc nx command guessing or jumping straight to nx_docs when the job is explicitly to scaffold or generate.
Common Questions / FAQ
Who is nx-generate for?
Solo and indie developers (and small teams) shipping in Nx monorepos who want their coding agent to scaffold apps, libraries, or generator-driven changes reliably.
When should I use nx-generate?
Use it in Build when you say scaffold, setup, create a new app or lib, project structure, generate, or add a new project—before exploratory nx_docs calls for the same task.
Is nx-generate safe to install?
Review the Security Audits panel on this Prism page for the ingested skill package; the skill runs shell Nx commands and modifies generated files in your repo.
SKILL.md
READMESKILL.md - Nx Generate
# Run Nx Generator Nx generators are powerful tools that scaffold projects, make automated code migrations or automate repetitive tasks in a monorepo. They ensure consistency across the codebase and reduce boilerplate work. This skill applies when the user wants to: - Create new projects like libraries or applications - Scaffold features or boilerplate code - Run workspace-specific or custom generators - Do anything else that an nx generator exists for ## Key Principles 1. **Always use `--no-interactive`** - Prevents prompts that would hang execution 2. **Read the generator source code** - The schema alone is not enough; understand what the generator actually does 3. **Match existing repo patterns** - Study similar artifacts in the repo and follow their conventions 4. **Verify with lint/test/build/typecheck etc.** - Generated code must pass verification. The listed targets are just an example, use what's appropriate for this workspace. ## Steps ### 1. Discover Available Generators Use the Nx CLI to discover available generators: - List all generators for a plugin: `npx nx list @nx/react` - View available plugins: `npx nx list` This includes plugin generators (e.g., `@nx/react:library`) and local workspace generators. ### 2. Match Generator to User Request Identify which generator(s) could fulfill the user's needs. Consider what artifact type they want, which framework is relevant, and any specific generator names mentioned. **IMPORTANT**: When both a local workspace generator and an external plugin generator could satisfy the request, **always prefer the local workspace generator**. Local generators are customized for the specific repo's patterns. If no suitable generator exists, you can stop using this skill. However, the burden of proof is high—carefully consider all available generators before deciding none apply. ### 3. Get Generator Options Use the `--help` flag to understand available options: ```bash npx nx g @nx/react:library --help ``` Pay attention to required options, defaults that might need overriding, and options relevant to the user's request. ### Library Buildability **Default to non-buildable libraries** unless there's a specific reason for buildable. | Type | When to use | Generator flags | | --------------------------- | ----------------------------------------------------------------- | ----------------------------------- | | **Non-buildable** (default) | Internal monorepo libs consumed by apps | No `--bundler` flag | | **Buildable** | Publishing to npm, cross-repo sharing, stable libs for cache hits | `--bundler=vite` or `--bundler=swc` | Non-buildable libs: - Export `.ts`/`.tsx` source directly - Consumer's bundler compiles them - Faster dev experience, less config Buildable libs: - Have their own build target - Useful for stable libs that rarely change (cache hits) - Required for npm publishing **If unclear, ask the user:** "Should this library be buildable (own build step, better caching) or non-buildable (source consumed directly, simpler setup)?" ### 4. Read Generator Source Code **This step is critical.** The schema alone does not tell you everything. Reading the source code helps you: - Know exactly what files will be created/modified and where - Understand side effects (updating configs, installing deps, etc.) - Identify behaviors and options not obvious from the schema - Underst