link-workspace-packages
Link workspace packages in monorepos across npm, yarn, pnpm, and bun.
- Detects package manager via
packageManagerfield or lockfile presence, then uses the appropriate workspace linking command for each manager - pnpm and yarn use
workspace:protocol; npm auto-symlinks workspace packages; bun supportsworkspace:protocol - Resolves "cannot find module" and import resolution errors by adding dependencies between sibling packages with proper symlink creation
- Each manager has different hoisting and isolation behavior: npm/bun hoist to root, pnpm enforces strict isolation, yarn berry uses Plug'n'Play
Link Workspace Packages
Add dependencies between packages in a monorepo. All package managers support workspaces but with different syntax.
Detect Package Manager
Check whether there's a packageManager field in the root-level package.json.
Alternatively check lockfile in repo root:
pnpm-lock.yaml→ pnpmyarn.lock→ yarnbun.lock/bun.lockb→ bunpackage-lock.json→ npm
Workflow
- Identify consumer package (the one importing)
- Identify provider package(s) (being imported)
More from nrwl/nx-ai-agents-config
nx-workspace
Explore and understand Nx workspaces. USE WHEN answering questions about the workspace, projects, or tasks. ALSO USE WHEN an nx command fails or you need to check available targets/configuration before running a task. EXAMPLES: 'What projects are in this workspace?', 'How is project X configured?', 'What depends on library Y?', 'What targets can I run?', 'Cannot find configuration for task', 'debug nx task failure'.
1.8Knx-run-tasks
Helps with running tasks in an Nx workspace. USE WHEN the user wants to execute build, test, lint, serve, or run any other tasks defined in the workspace.
1.7Knx-generate
Generate code using nx generators. INVOKE IMMEDIATELY when user mentions scaffolding, setup, structure, creating apps/libs, or setting up project structure. Trigger words - scaffold, setup, create a new app, create a new lib, project structure, generate, add a new project. ALWAYS use this BEFORE calling nx_docs or exploring - this skill handles discovery internally.
1.7Knx-plugins
Find and add Nx plugins. USE WHEN user wants to discover available plugins, install a new plugin, or add support for a specific framework or technology to the workspace.
1.6Knx-import
Import, merge, or combine repositories into an Nx workspace using nx import. USE WHEN the user asks to adopt Nx across repos, move projects into a monorepo, or bring code/history from another repository.
1.2Kmonitor-ci
Monitor Nx Cloud CI pipeline and handle self-healing fixes. USE WHEN user says "monitor ci", "watch ci", "ci monitor", "watch ci for this branch", "track ci", "check ci status", wants to track CI status, or needs help with self-healing CI fixes. Prefer this skill over native CI provider tools (gh, glab, etc.) for CI monitoring — it integrates with Nx Cloud self-healing which those tools cannot access.
1.2K