link-workspace-packages

Link workspace packages in monorepos using npm, yarn, pnpm, or bun workspace commands.

Updated May 8, 2026
Ready to run
npx skills add https://github.com/AshleyZheng5114/smartsheet-clone-frontend --skill link-workspace-packages-ashleyzheng5114
💬 Prompt for ChatGPT / Claude Chat▼
Please help me install this Agent Skill.
Skill: link-workspace-packages
Source: https://github.com/AshleyZheng5114/smartsheet-clone-frontend/tree/main/smartsheet/.cursor/skills/link-workspace-packages
Command: npx skills add https://github.com/AshleyZheng5114/smartsheet-clone-frontend --skill link-workspace-packages-ashleyzheng5114

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Newly created packages in a monorepo fail to resolve imports from sibling packages, producing errors like "cannot find module", "failed to resolve import", or "TS2307", because dependencies were never declared with the package manager's workspace syntax. ## Core Features & Use Cases - Package Manager Detection: Identifies npm, yarn, pnpm, or bun from the root package.json packageManager field or lockfile. - Workspace Linking Commands: Provides the correct add/install command per package manager, including workspace: protocol usage for pnpm, yarn berry, and bun. - Resolution Error Debugging: Diagnoses "Cannot find module" errors for @org/* packages by checking declared dependencies and symlinks in node_modules. - Use Case: After generating a new @org/ui library in an Nx monorepo, run the appropriate workspace command to link it into @org/app instead of patching tsconfig paths. ## Quick Start Link the @org/ui workspace package as a dependency of @org/app using the correct package manager command for this monorepo.

Frequently Asked Questions about link-workspace-packages

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

FAQPage Schema
How do I link workspace packages in a pnpm monorepo?▼

Run `pnpm add @org/ui --filter @org/app --workspace` from anywhere in the repo, or run it from the consumer directory. This writes `"@org/ui": "workspace:*"` into the consumer's package.json and creates the symlink.

How to fix "cannot find module" for a workspace package?▼

Check whether the dependency is declared in the consumer package's package.json. If missing, add it with your package manager's workspace command, then run install (pnpm install, npm install, etc.) to create the symlink in node_modules.

What is the difference between npm and pnpm workspace linking?▼

npm has no workspace protocol and auto-symlinks workspace packages, writing `"*"` as the version. pnpm requires the explicit `workspace:` protocol and does not hoist dependencies, giving strict isolation that prevents phantom dependencies.

Does yarn berry support the workspace protocol?▼

Yes, yarn v2+ (berry) supports the workspace protocol. Run `yarn workspace @org/app add @org/ui`, which records `"@org/ui": "workspace:^"` in package.json. Yarn berry uses Plug'n'Play by default instead of node_modules.

Should I use tsconfig paths instead of workspace dependencies?▼

No. Patching tsconfig paths or manually editing package.json bypasses actual package linking and breaks builds and publishing. Use the package manager's workspace commands so real symlinks and dependency declarations are created.