Generate code using nx generators. ALWAYS use this first when generating code with Nx instead of calling MCP tools and running nx generate immediately. This is used to scaffold code or transform existing code - for example creating libraries or apps, creating components, or anything else that is boilerplate code or automates repetitive tasks. Use this whenever someone wants to 'create', 'generate', 'add' artifacts of that kind in an nx repo.
/plugin marketplace add nrwl/nx-ai-agents-config/plugin install nx@nx-claude-pluginsThis skill is limited to using the following tools:
Nx generators are powerful tools that scaffold code, create projects, add components, 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:
Use mcp__nx-mcp__nx_generators to get a list of all available generators in the workspace. This includes:
@nx/react:component, @nx/js:library)Based on the user's request, identify which generator(s) could fulfill their needs. Consider:
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 and conventions.
It's possible that the user request is something that no Nx generator exists for whatsoever. In this case, you can stop using this skill and try to help the user another way. HOWEVER, the burden of proof for this is high. Before aborting, carefully consider each and every generator that's available. Look into details for any that could be related in any way before making this decision.
Before running any generator, complete these steps:
Use mcp__nx-mcp__nx_generator_schema to understand all available options. Pay attention to:
Understanding what the generator actually does helps you:
To find generator source code:
node -e "console.log(require.resolve('@nx/<plugin>/generators.json'));" to find the generators.json, then locate the source from therenode_modules/<plugin>/generators.jsontools/generators/ or a local plugin directory. You can search the repo for the generator name to find it.Once you have built up an understanding of what the selected generator does, reconsider: Is this the right generator to service the user request? If not, it's okay to go back to the Generator Discovery Flow and select a different generator before proceeding. If you do, make sure to go through the entire pre-execution checklist once more.
Before generating, examine the target area of the codebase:
Ensure all required options have values:
Keep in mind that you might have to prefix things with npx/pnpx/yarn if the user doesn't have nx installed globally. Many generators will behave differently based on where they are executed. For example, first-party nx library generators use the cwd to determine the directory that the library should be placed in. This is highly important.
Running with --dry-run first is strongly encouraged but not mandatory. Use your judgment:
Execute the generator with:
nx generate <generator-name> <options> --no-interactive
CRITICAL: Always include --no-interactive to prevent prompts that would hang the execution.
Example:
nx generate @nx/react:component --name=MyButton --no-interactive
If the generator fails:
Common failure reasons:
Generators provide a starting point, but the output may need adjustment to match the user's specific requirements:
Run formatting on all generated/modified files:
nx format --fix
Languages other than javascript/typescript might need other formatting invocations too.
Verify that the generated code works correctly. What this looks like will vary depending on the type of generator and the targets available. If the generator created a new project, run its targets directly Use your best judgement to determine what needs to be verified.
Example:
nx lint <new-project>
nx test <new-project>
nx build <new-project>
When verification fails:
If scope is manageable (a few lint errors, minor type issues):
If issues are extensive (many errors, complex problems):
Local generators first - Always prefer workspace/local generators over external plugin generators when both could work
Understand before running - Read both the schema AND the source code to fully understand what will happen
No prompts - Always use --no-interactive to prevent hanging
Generators are starting points - Modify the output as needed to fully satisfy the user's requirements
Verify changes work - Don't just generate; ensure the code builds, lints, and tests pass
Be proactive about fixes - Don't just report errors; attempt to resolve them automatically when possible
Match repo patterns - Study existing similar code in the repo and match its conventions
This skill should be used when the user asks about libraries, frameworks, API references, or needs code examples. Activates for setup questions, code generation involving libraries, or mentions of specific frameworks like React, Vue, Next.js, Prisma, Supabase, etc.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.