nx-generate

Generate applications, libraries, and boilerplate code using Nx workspace generators.

3|Updated May 14, 2026
One-click install
npx skills add https://github.com/jbadeau/fabster --skill nx-generate-jbadeau
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nx-generate
Source: https://github.com/jbadeau/fabster/tree/main/.cursor/skills/nx-generate
Command: npx skills add https://github.com/jbadeau/fabster --skill nx-generate-jbadeau

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Scaffolding new projects in an Nx monorepo involves many decisions—choosing the right generator, configuring options correctly, matching existing repo conventions, and verifying the output. This Skill guides the AI through the entire generator workflow so generated code lands in the right place, follows workspace patterns, and passes verification. ## Core Features & Use Cases - Generator Discovery & Selection: Lists available plugin and local workspace generators, preferring local generators customized for the repo. - Source-Level Inspection: Reads generator source code (not just schemas) to understand file outputs, side effects, and option interactions before running. - Safe Execution Workflow: Uses --dry-run and --no-interactive flags to verify file placement before committing changes. - Verification & Formatting: Runs format, build, lint, test, and typecheck targets after generation to confirm the workspace stays healthy. - Use Case: Ask the AI to create a new React library in your Nx monorepo; it discovers the right generator, checks buildable vs non-buildable conventions, dry-runs the command, generates the code, and verifies it with the workspace's targets. ## Quick Start Use the nx-generate skill to scaffold a new non-buildable React library called shared-ui in my Nx workspace and verify it builds and lints.

Frequently Asked Questions about nx-generate

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate a new library in an Nx workspace?

Run npx nx g @nx/react:library with the appropriate options, always using --no-interactive to avoid prompts. First dry-run the command to verify file placement, then execute it and verify with build, lint, and test targets.

How do I list available Nx generators?

Use npx nx list to view installed plugins, and npx nx list @nx/react to see all generators for a specific plugin. Local workspace generators are typically found in tools/generators or a local plugin directory.

Should an Nx library be buildable or non-buildable?

Default to non-buildable libraries for internal monorepo code consumed by apps, since the consumer's bundler compiles them directly. Choose buildable libraries with --bundler=vite or --bundler=swc when publishing to npm or sharing across repos.

Why does the Nx --directory flag create files in the wrong place?

The --directory flag expects the full path of the generated artifact, not its parent folder. Use --directory=libs/my-lib rather than --directory=libs, otherwise files land directly in the parent directory.

What should I do if generated Nx code fails tests or lint?

Fix manageable issues like minor lint or type errors directly, and run nx format --fix first. If you deleted generated spec files, either write replacement tests or remove the test target, since empty test suites cause nx test to fail.