nx-generators
Run Nx generators to create new projects, libraries, components. Use when user needs to generate code, scaffold projects, or understand generator options.
When & Why to Use This Skill
This Claude skill automates the use of Nx generators to streamline development workflows within monorepos. It enables users to efficiently scaffold new projects, libraries, and components while providing deep insights into generator options and configurations. By integrating Nx CLI commands, it ensures consistent project structures, reduces manual boilerplate setup, and helps developers maintain high-quality codebases through automated formatting and dry-run previews.
Use Cases
- Project Scaffolding: Quickly initialize new applications or libraries within an existing Nx workspace using standardized templates for React, Angular, or Node.js.
- Component & Feature Generation: Automatically create UI components, services, or state management modules with pre-configured testing and styling files.
- Generator Discovery: List and explore available plugins and generators to identify the best tools for specific architectural needs without leaving the terminal environment.
- Safe Code Execution: Use the dry-run capability to preview file system changes and validate generator options before committing changes to the codebase.
- Workspace Standardization: Ensure all generated code adheres to project-wide standards by automatically running formatting tools like Prettier after generation.
| name | nx-generators |
|---|---|
| description | Run Nx generators to create new projects, libraries, components. Use when user needs to generate code, scaffold projects, or understand generator options. |
| allowed-tools | Bash, Glob, Grep, Read |
Nx Generators
Finding and Installing new plugins
- List plugins:
pnpm nx list - Install plugins
pnpm nx add <plugin>. Example:pnpm nx add @nx/react.
Commands
- List generators for plugin:
pnpm nx list @nx/react - Generator help:
pnpm nx g @nx/react:application --help - Dry run:
pnpm nx g @nx/react:application myapp --dry-run - Execute:
pnpm nx g @nx/react:application myapp
Workflow
- Identify which plugin has needed generator
- Check generator options with
--help - Use
--dry-runto preview changes - Execute generator
- Run
pnpm nx format:writeafter generation