nx-generate

Generate Nx project scaffolding using inspected generators with dry-run verification.

Updated Apr 11, 2025
One-click install
npx skills add https://github.com/pabloimrik17/monolab --skill nx-generate-pabloimrik17
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nx-generate
Source: https://github.com/pabloimrik17/monolab/tree/main/.opencode/skills/nx-generate
Command: npx skills add https://github.com/pabloimrik17/monolab --skill nx-generate-pabloimrik17

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill removes uncertainty and manual effort when creating or modifying projects in an Nx monorepo by discovering the correct generator, inspecting its behavior, and running it with safe, repository-aligned options to avoid misplaced files or inconsistent configuration.

Core Features & Use Cases

  • Discover and inspect generators: Locate plugin and local workspace generators, read their schema and source code to understand exact file outputs and side effects.
  • Safe generation workflow: Prefer local generators, always use --no-interactive, run dry-runs to verify placement, and adjust flags such as directory, name, and bundler to match repo conventions.
  • Verify and integrate: Format and run appropriate verification targets (lint/test/build/typecheck) and modify generated artifacts to align with existing patterns; use case: scaffold a non-buildable React library that fits the monorepo's layout and CI checks.

Quick Start

Generate a non-buildable React library named ui-button in libs/ui/button using the workspace generator and verify the output with a dry run before applying.

Frequently Asked Questions about nx-generate

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

FAQPage Schema
How do I scaffold a new library in an Nx monorepo without misplacing files?

To scaffold an Nx library safely, use the nx generate command with --dry-run to verify file placement and --no-interactive to apply repository-aligned options automatically before finalizing the output.

What is the best way to discover available workspace generators in an Nx monorepo?

Discovering available Nx workspace generators involves inspecting the monorepo's local plugin schemas and source code to understand exact file outputs, side effects, and available configuration flags before execution.

How do I create a non-buildable React library in an Nx workspace that matches existing conventions?

Creating a non-buildable React library in Nx requires locating the specific workspace generator, aligning flags like directory and bundler to match repository conventions, and verifying the output with a dry run.

Can I use nx generate to modify existing applications and libraries in a monorepo?

Yes, you can use nx generate to modify existing Nx applications and libraries by running local or plugin generators with adjusted flags to ensure the changes match the monorepo's established patterns and configurations.

Why should I run a dry run before applying Nx generator output to my workspace?

Running an Nx generator dry run is necessary to preview the exact file modifications and placements without writing to disk, ensuring the generated artifacts align with your monorepo conventions before applying changes.

How do I verify generated Nx boilerplate aligns with my repository's CI checks?

To verify generated Nx boilerplate, run the appropriate workspace targets such as lint, test, build, and typecheck, and modify the generated artifacts to align with existing repository patterns and CI checks.