Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计提醒

nx-generateNX 生成

Agent Skill

nx-generate 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

1,693

周安装

72

GitHub Stars

2,233

下载量

593
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:nx-generate(NX 生成)
来源仓库:https://github.com/tech-leads-club/agent-skills
仓库路径:skills/nx-generate
安装命令:
npx skills add https://github.com/tech-leads-club/agent-skills --skill nx-generate
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/tech-leads-club/agent-skills --skill nx-generate

简介

nx-generate 用于查找、检索和筛选相关信息。

  • 适合在 Nx 工作区或 Monorepo 项目中提供支持。
  • 通过 npx skills add 命令从指定仓库安装使用。
  • 安装前建议确认权限和维护状态,避免误操作。nx-generate 属于研究检索类 Skill,可作为该场景下的辅助能力补充。
  • 可结合原始 README 了解具体生成规则和调用方式。

SKILL.md

Run Nx Generator

Nx generators are powerful tools that scaffold projects, 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:

  • Create new projects like libraries or applications
  • Scaffold features or boilerplate code
  • Run workspace-specific or custom generators
  • Do anything else that an nx generator exists for

Generator Discovery Flow

Step 1: List Available Generators

Use the Nx CLI to discover available generators:

  • List all generators for a plugin: npx nx list @nx/react
  • View available plugins: npx nx list

This includes:

  • Plugin generators (e.g., @nx/react:library, @nx/js:library)
  • Local workspace generators (defined in the repo's own plugins)

Step 2: Match Generator to User Request

Based on the user's request, identify which generator(s) could fulfill their needs. Consider:

  • What artifact type they want to create (library, application, etc.)
  • Which framework or technology stack is relevant
  • Whether they mentioned specific generator names

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.

Pre-Execution Checklist

Before running any generator, complete these steps:

1. Fetch Generator Schema

Use the --help flag to understand all available options:

npx nx g @nx/react:library --help

Pay attention to:

  • Required options that must be provided
  • Optional options that may be relevant to the user's request
  • Default values that might need to be overridden

2. Read Generator Source Code

Understanding what the generator actually does helps you:

  • Know what files will be created/modified
  • Understand any side effects (updating configs, installing deps, etc.)
  • Identify options that might not be obvious from the schema

To find generator source code:

  • For plugin generators: Use node -e "console.log(require.resolve('@nx/<plugin>/generators.json'));" to find the generators.json, then locate the source from there
  • If that fails, read directly from node_modules/<plugin>/generators.json
  • For local generators: They are typically in tools/generators/ or a local plugin directory. You can search the repo for the generator name to find it.

2.5 Reevaluate if the generator is right

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.

3. Understand Repo Context

Before generating, examine the target area of the codebase:

  • Look at similar existing artifacts (other libraries, applications, etc.)
  • Identify patterns and conventions used in the repo
  • Note naming conventions, file structures, and configuration patterns
  • Try to match these patterns when configuring the generator

For example, if similar libraries are using a specific test runner, build tool or linter, try to match that if possible. If projects or other artifacts are organized with a specific naming convention, try to match it.

4. Validate Required Options

Ensure all required options have values:

  • Map the user's request to generator options
  • Infer values from context where possible
  • Ask the user for any critical missing information

Execution

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.

Consider Dry-Run (Optional)

Running with --dry-run first is strongly encouraged but not mandatory. Use your judgment:

  • For complex generators or unfamiliar territory: do a dry-run first
  • For simple, well-understood generators: may proceed directly
  • Dry-run shows file names and created/deleted/modified markers, but not content
  • There are cases where a generator does not support dry-run (for example if it had to install an npm package) - in that case --dry-run might fail. Don't be discouraged but simply move on to running the generator for real and iterating from there.

Running the Generator

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:library --name=my-utils --no-interactive

Handling Generator Failures

If the generator fails:

  1. Diagnose the error - Read the error message carefully
  2. Identify the cause - Missing options, invalid values, conflicts, etc.
  3. Attempt automatic fix - Adjust options or resolve conflicts
  4. Retry - Run the generator again with corrected options

Common failure reasons:

  • Missing required options
  • Invalid option values
  • Conflicting with existing files
  • Missing dependencies
  • Generator doesn't support certain flag combinations

Post-Generation

1. Modify Generated Code (If Needed)

Generators provide a starting point, but the output may need adjustment to match the user's specific requirements:

  • Add or modify functionality as requested
  • Adjust imports, exports, or configurations
  • Integrate with existing code patterns in the repo

2. Format Code

Run formatting on all generated/modified files:

nx format --fix

Languages other than javascript/typescript might need other formatting invocations too.

3. Run Verification

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>

4. Handle Verification Failures

When verification fails:

If scope is manageable (a few lint errors, minor type issues):

  • Fix the issues
  • Re-run verification to confirm

If issues are extensive (many errors, complex problems):

  • Attempt simple, obvious fixes first
  • If still failing, escalate to the user with:

- Description of what was generated - What verification is failing - What you've attempted to fix - Remaining issues that need user input

Error Handling

Generator Failures

  • Check the error message for specific causes
  • Verify all required options are provided
  • Check for conflicts with existing files
  • Ensure the generator name and options are correct

Missing Options

  • Consult the generator schema for required fields
  • Infer values from context when reasonable
  • Ask the user for values that cannot be inferred

Key Principles

  1. Local generators first - Always prefer workspace/local generators over external plugin generators when both could work
  2. Understand before running - Read both the schema AND the source code to fully understand what will happen
  3. No prompts - Always use --no-interactive to prevent hanging
  4. Generators are starting points - Modify the output as needed to fully satisfy the user's requirements
  5. Verify changes work - Don't just generate; ensure the code builds, lints, and tests pass
  6. Be proactive about fixes - Don't just report errors; attempt to resolve them automatically when possible
  7. Match repo patterns - Study existing similar code in the repo and match its conventions

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.1%
按下载量换算214

Claude

32.54%
按下载量换算193

Cursor

20.01%
按下载量换算119

Gemini CLI

9.12%
按下载量换算54

安全审计

Gen Agent Trust Hub

可疑

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills