Link workspace packages in this npm workspace. USE WHEN: (1) you just created or generated new packages and need to wire up their dependencies, (2) user imports from a sibling package and needs to add it as a dependency, (3) you get resolution errors for workspace packages (@org/*) like "cannot find
Install
mkdir -p .claude/skills/link-workspace-packages-vehpus && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/15952" && unzip -o skill.zip -d .claude/skills/link-workspace-packages-vehpus && rm skill.zipInstalls to .claude/skills/link-workspace-packages-vehpus
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Link workspace packages in this npm workspace. USE WHEN: (1) you just created or generated new packages and need to wire up their dependencies, (2) user imports from a sibling package and needs to add it as a dependency, (3) you get resolution errors for workspace packages (@org/*) like "cannot find module", "failed to resolve import", "TS2307", or "cannot resolve". DO NOT patch around with tsconfig paths or manual package.json edits - use npm workspace commands to fix actual linking.About this skill
Link Workspace Packages
Add dependencies between packages in this npm workspace.
Confirm Workspace Context
Check the root package.json for a packageManager field and confirm the committed root package-lock.json is present.
Workflow
- Identify consumer package (the one importing)
- Identify provider package(s) (being imported)
- Add dependency using npm's workspace syntax
- Verify symlinks created in consumer's
node_modules/
npm
npm links local workspace packages during install when the dependency name matches another workspace package.
# From the workspace root
npm install @org/ui --workspace @org/app
# Or from inside the consumer package directory
npm install @org/ui
Result in package.json:
{ "dependencies": { "@org/ui": "^0.0.1" } }
npm usually saves the current workspace package version range and resolves it to the local workspace during install.
Examples
Example 1: Link ui lib to app
npm install @org/ui --workspace @org/app
Example 2: npm - link multiple packages
npm install @org/data-access @org/ui --workspace @org/dashboard
Example 3: Debug "Cannot find module"
- Check if dependency is declared in consumer's
package.json - If not, add it using appropriate command above
- Run
npm installat the workspace root
Notes
- Symlinks appear in
<consumer>/node_modules/@org/<package> - npm workspaces hoist shared dependencies to the root
node_modulesby default, so each package should still declare its direct dependencies explicitly. - Root
package.jsonshould have"private": trueto prevent accidental publish