link-workspace-packages

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

3|10|Updated Feb 23, 2026
One-click install
npx skills add https://github.com/fleetshift/fleetshift-poc --skill link-workspace-packages-fleetshift
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: link-workspace-packages
Source: https://github.com/fleetshift/fleetshift-poc/tree/main/.agents/skills/link-workspace-packages
Command: npx skills add https://github.com/fleetshift/fleetshift-poc --skill link-workspace-packages-fleetshift

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 manager, including workspace: protocol usage for pnpm, yarn berry, and bun. - Resolution Error Debugging: Diagnoses "cannot find module" errors by checking whether the dependency is declared in the consumer's package.json. - Use Case: You generate a new @org/ui library and your @org/app package cannot import it; run the appropriate workspace add command to create the symlink and fix resolution. ## Quick Start Link my @org/ui package as a dependency of @org/app in this pnpm monorepo and fix the module resolution errors.

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 local packages in a pnpm monorepo?

Use pnpm add with the workspace flag, for example pnpm add @org/ui --filter @org/app --workspace. This writes "@org/ui": "workspace:*" into the consumer's package.json and creates the symlink in its node_modules.

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

First 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.

Does npm support the workspace: protocol like pnpm?

No, npm has no workspace: protocol. npm auto-symlinks workspace packages during install, so you declare the dependency as "*" using npm install @org/ui --workspace @org/app and it resolves locally.

How do I know which package manager a monorepo uses?

Check the packageManager field in the root package.json, or inspect the lockfile: pnpm-lock.yaml means pnpm, yarn.lock means yarn, bun.lock or bun.lockb means bun, and package-lock.json means npm.

Why should I avoid tsconfig paths to fix workspace imports?

Tsconfig paths only patch module resolution at compile time and do not create real dependency links, which breaks builds and publishing. Declaring the dependency with the package manager's workspace command fixes actual linking.