link-workspace-packages

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

1|Updated Apr 15, 2025
One-click install
npx skills add https://github.com/shanieMoonlight/moonlight-repo --skill link-workspace-packages-shaniemoonlight
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: link-workspace-packages
Source: https://github.com/shanieMoonlight/moonlight-repo/tree/main/.gemini/skills/link-workspace-packages
Command: npx skills add https://github.com/shanieMoonlight/moonlight-repo --skill link-workspace-packages-shaniemoonlight

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill automates the process of linking packages within a monorepo, resolving dependency issues that arise when working with multiple interconnected packages.

Core Features & Use Cases

  • Cross-Package Dependency Management: Easily add dependencies between sibling packages in monorepos using npm, yarn, pnpm, or bun.
  • Resolves Module Not Found Errors: Fixes common import errors like "cannot find module" or "TS2307" by ensuring correct package linking.
  • Use Case: After creating a new UI component library and a new application package, use this Skill to link the UI library as a dependency to the application, enabling the application to import and use the components.

Quick Start

Use the link-workspace-packages skill to add the '@org/ui' package as a dependency to the '@org/app' package using pnpm.

Frequently Asked Questions about link-workspace-packages

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

FAQPage Schema
How do I fix 'cannot find module' errors when importing a sibling package in a monorepo?

Resolve 'cannot find module' errors in a monorepo by linking workspace packages using package manager-specific workspace commands, ensuring correct symlinking for inter-package dependencies. This process connects sibling packages so imports resolve correctly.

How do I link a local UI library to an application package using pnpm?

Link a local UI library to an application package using pnpm by executing pnpm's workspace commands to add the library as a dependency. This symlinks the packages, allowing the application to import and use the UI components directly.

Does this monorepo package linking approach work with yarn and bun?

Yes, this monorepo package linking approach works with yarn and bun, as well as npm and pnpm. It leverages package manager-specific workspace commands to facilitate cross-package dependency management and symlinking across these environments.

What is the best way to manage dependencies between interconnected packages in a monorepo?

The best way to manage dependencies between interconnected packages in a monorepo is using workspace linking commands. This symlinks sibling packages automatically, resolving dependency issues and enabling seamless imports across the workspace without manual path configurations.

Why does TypeScript throw TS2307 errors for workspace packages even though they exist in my monorepo?

TypeScript throws TS2307 errors for workspace packages because they are not properly linked or symlinked in the monorepo. Linking the workspace packages using your package manager's workspace commands resolves this by establishing the correct dependency paths.