nx-generate

Scaffold applications and libraries in Nx monorepos using workspace generators.

3|10|Updated Feb 23, 2026
One-click install
npx skills add https://github.com/fleetshift/fleetshift-poc --skill nx-generate-fleetshift
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nx-generate
Source: https://github.com/fleetshift/fleetshift-poc/tree/main/.agents/skills/nx-generate
Command: npx skills add https://github.com/fleetshift/fleetshift-poc --skill nx-generate-fleetshift

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Manually creating new apps and libraries in an Nx monorepo leads to inconsistent structure, misconfigured targets, and boilerplate errors. This Skill runs the correct Nx generator with the right options so generated code matches existing repo conventions and passes verification. ## Core Features & Use Cases - Generator Discovery & Selection: Lists available plugin and local workspace generators, preferring local generators that encode repo-specific patterns. - Source-Aware Execution: Reads generator source code and uses --dry-run to confirm file placement before running with --no-interactive. - Convention Matching & Verification: Examines existing projects for naming and tooling patterns, then formats and validates output with build, lint, test, and typecheck targets. - Use Case: When asked to add a new React library to the monorepo, the Skill picks the right generator, decides between buildable and non-buildable output, runs it non-interactively, and verifies the result compiles and passes tests. ## Quick Start Ask the agent to scaffold a new library or app in the Nx workspace, for example: create a new React library called shared-ui under libs using the nx generator.

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 and --no-interactive to avoid prompts. Discover available generators with npx nx list, check options via --help, and use --dry-run first to confirm files land in the correct directory.

Should an Nx library be buildable or non-buildable?

Default to non-buildable libraries for internal monorepo code consumed directly as TypeScript source by apps. Choose buildable libraries with --bundler=vite or --bundler=swc when publishing to npm, sharing across repos, or improving cache hits for stable code.

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. Passing --directory=libs with a separate name creates files directly under libs; use --directory=libs/my-lib so package.json and sources land in libs/my-lib.

Should I use a local workspace generator or an Nx plugin generator?

Prefer the local workspace generator when both could satisfy the request, since local generators encode the repo's specific patterns and conventions. Local generators typically live in tools/generators or a local plugin directory.

What should I do after running an Nx generator?

Format the output with nx format --fix, then verify with the workspace's build, lint, test, and typecheck targets, often via nx run-many. If you remove generated spec files, either write replacement tests or remove the test target so nx test does not fail.