重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
npx skills add https://github.com/nrwl/nx --skill nx-workspace此技能提供对 Nx 工作空间的只读探索。使用它来了解工作空间结构、项目配置、可用目标和依赖关系。
请注意,如果 nx 没有全局安装,您可能需要在命令前加上 npx/pnpx/yarn。请检查 lockfile 以确定正在使用的包管理器。
使用 nx show projects 列出工作空间中的项目。
# 列出所有项目
nx show projects
# 按模式(glob)过滤
nx show projects --projects "apps/*"
nx show projects --projects "shared-*"
# 按项目类型过滤
nx show projects --type app
nx show projects --type lib
nx show projects --type e2e
# 按目标过滤(拥有特定目标的项目)
nx show projects --withTarget build
nx show projects --withTarget e2e
# 查找受影响的项目(自基础分支以来发生更改)
nx show projects --affected
nx show projects --affected --base=main
nx show projects --affected --type app
# 组合过滤器
nx show projects --type lib --withTarget test
nx show projects --affected --exclude="*-e2e"
# 以 JSON 格式输出
nx show projects --json
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
使用 nx show project <name> --json 获取项目的完整解析后配置。
重要提示:请勿直接读取 project.json 文件——它只包含部分配置。nx show project 命令返回完整的解析后配置,包括从插件推断出的目标。
您可以阅读 node_modules/nx/schemas/project-schema.json 处的完整项目模式,以了解 nx 项目配置选项。
# 获取完整的项目配置
nx show project my-app --json
# 从 JSON 中提取特定部分
nx show project my-app --json | jq '.targets'
nx show project my-app --json | jq '.targets.build'
nx show project my-app --json | jq '.targets | keys'
# 检查项目元数据
nx show project my-app --json | jq '{name, root, sourceRoot, projectType, tags}'
目标定义了可以在项目上运行的任务。
# 列出项目的所有目标
nx show project my-app --json | jq '.targets | keys'
# 获取完整的目标配置
nx show project my-app --json | jq '.targets.build'
# 检查目标执行器/命令
nx show project my-app --json | jq '.targets.build.executor'
nx show project my-app --json | jq '.targets.build.command'
# 查看目标选项
nx show project my-app --json | jq '.targets.build.options'
# 检查目标输入/输出(用于缓存)
nx show project my-app --json | jq '.targets.build.inputs'
nx show project my-app --json | jq '.targets.build.outputs'
# 查找具有特定目标的项目
nx show projects --withTarget serve
nx show projects --withTarget e2e
直接读取 nx.json 以获取工作空间级别的配置。您可以阅读 node_modules/nx/schemas/nx-schema.json 处的完整项目模式,以了解 nx 项目配置选项。
# 读取完整的 nx.json
cat nx.json
# 或者使用 jq 查看特定部分
cat nx.json | jq '.targetDefaults'
cat nx.json | jq '.namedInputs'
cat nx.json | jq '.plugins'
cat nx.json | jq '.generators'
关键的 nx.json 部分:
targetDefaults - 应用于给定名称的所有目标的默认配置namedInputs - 用于缓存的可重用输入定义plugins - Nx 插件及其配置查找当前分支中的更改所影响的项目。
# 自基础分支以来受影响(自动检测)
nx show projects --affected
# 指定明确的基础分支
nx show projects --affected --base=main
nx show projects --affected --base=origin/main
# 两个提交之间受影响
nx show projects --affected --base=abc123 --head=def456
# 仅受影响的应用程序
nx show projects --affected --type app
# 受影响的项目,排除 e2e 项目
nx show projects --affected --exclude="*-e2e"
# 由未提交的更改影响
nx show projects --affected --uncommitted
# 由未跟踪的文件影响
nx show projects --affected --untracked
nx show projects
nx show projects --type app
nx show projects --type lib
nx show project X --json | jq '.targets | keys'
nx show project X --json | jq '.targets.build'
# 通过搜索导入来查找可能依赖于 Y 的项目
# (Nx 没有通过 CLI 的直接"依赖项"命令)
grep -r "from '@myorg/Y'" --include="*.ts" --include="*.tsx" apps/ libs/
cat node_modules/nx/schemas/nx-schema.json | jq '.properties | keys'
cat node_modules/nx/schemas/project-schema.json | jq '.properties | keys'
# 检查哪些文件发生了更改
git diff --name-only main
# 查看哪些项目拥有这些文件
nx show project X --json | jq '.root'
每周安装次数
71
代码仓库
GitHub 星标数
28.5K
首次出现
2026年1月28日
安全审计
安装于
opencode66
gemini-cli63
github-copilot63
codex63
cursor61
amp59
This skill provides read-only exploration of Nx workspaces. Use it to understand workspace structure, project configuration, available targets, and dependencies.
Keep in mind that you might have to prefix commands with npx/pnpx/yarn if nx isn't installed globally. Check the lockfile to determine the package manager in use.
Use nx show projects to list projects in the workspace.
# List all projects
nx show projects
# Filter by pattern (glob)
nx show projects --projects "apps/*"
nx show projects --projects "shared-*"
# Filter by project type
nx show projects --type app
nx show projects --type lib
nx show projects --type e2e
# Filter by target (projects that have a specific target)
nx show projects --withTarget build
nx show projects --withTarget e2e
# Find affected projects (changed since base branch)
nx show projects --affected
nx show projects --affected --base=main
nx show projects --affected --type app
# Combine filters
nx show projects --type lib --withTarget test
nx show projects --affected --exclude="*-e2e"
# Output as JSON
nx show projects --json
Use nx show project <name> --json to get the full resolved configuration for a project.
Important : Do NOT read project.json directly - it only contains partial configuration. The nx show project command returns the full resolved config including inferred targets from plugins.
You can read the full project schema at node_modules/nx/schemas/project-schema.json to understand nx project configuration options.
# Get full project configuration
nx show project my-app --json
# Extract specific parts from the JSON
nx show project my-app --json | jq '.targets'
nx show project my-app --json | jq '.targets.build'
nx show project my-app --json | jq '.targets | keys'
# Check project metadata
nx show project my-app --json | jq '{name, root, sourceRoot, projectType, tags}'
Targets define what tasks can be run on a project.
# List all targets for a project
nx show project my-app --json | jq '.targets | keys'
# Get full target configuration
nx show project my-app --json | jq '.targets.build'
# Check target executor/command
nx show project my-app --json | jq '.targets.build.executor'
nx show project my-app --json | jq '.targets.build.command'
# View target options
nx show project my-app --json | jq '.targets.build.options'
# Check target inputs/outputs (for caching)
nx show project my-app --json | jq '.targets.build.inputs'
nx show project my-app --json | jq '.targets.build.outputs'
# Find projects with a specific target
nx show projects --withTarget serve
nx show projects --withTarget e2e
Read nx.json directly for workspace-level configuration. You can read the full project schema at node_modules/nx/schemas/nx-schema.json to understand nx project configuration options.
# Read the full nx.json
cat nx.json
# Or use jq for specific sections
cat nx.json | jq '.targetDefaults'
cat nx.json | jq '.namedInputs'
cat nx.json | jq '.plugins'
cat nx.json | jq '.generators'
Key nx.json sections:
targetDefaults - Default configuration applied to all targets of a given namenamedInputs - Reusable input definitions for cachingplugins - Nx plugins and their configurationFind projects affected by changes in the current branch.
# Affected since base branch (auto-detected)
nx show projects --affected
# Affected with explicit base
nx show projects --affected --base=main
nx show projects --affected --base=origin/main
# Affected between two commits
nx show projects --affected --base=abc123 --head=def456
# Affected apps only
nx show projects --affected --type app
# Affected excluding e2e projects
nx show projects --affected --exclude="*-e2e"
# Affected by uncommitted changes
nx show projects --affected --uncommitted
# Affected by untracked files
nx show projects --affected --untracked
nx show projects
nx show projects --type app
nx show projects --type lib
nx show project X --json | jq '.targets | keys'
nx show project X --json | jq '.targets.build'
# Find projects that may depend on Y by searching for imports
# (Nx doesn't have a direct "dependents" command via CLI)
grep -r "from '@myorg/Y'" --include="*.ts" --include="*.tsx" apps/ libs/
cat node_modules/nx/schemas/nx-schema.json | jq '.properties | keys'
cat node_modules/nx/schemas/project-schema.json | jq '.properties | keys'
# Check what files changed
git diff --name-only main
# See which project owns those files
nx show project X --json | jq '.root'
Weekly Installs
71
Repository
GitHub Stars
28.5K
First Seen
Jan 28, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode66
gemini-cli63
github-copilot63
codex63
cursor61
amp59
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
123,700 周安装