pnpm-workspace

pnpm workspace monorepo management with filtering, catalogs, and shared configs. Use when setting up monorepos, managing workspace dependencies, filtering package commands, or sharing configuration across packages.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "pnpm-workspace" with this command: npx skills add oakoss/agent-skills/oakoss-agent-skills-pnpm-workspace

pnpm Workspace

Overview

pnpm workspaces provide built-in monorepo support through pnpm-workspace.yaml, the workspace: protocol for local package linking, and powerful filtering to run commands across specific packages. Catalogs enforce consistent dependency versions across all workspace packages.

When to use: Multi-package repositories, shared libraries with consuming apps, consistent dependency management across packages, running commands on subsets of packages.

When NOT to use: Single-package projects, projects already using npm/yarn workspaces (migration required), projects that need floating dependency versions per package.

Quick Reference

PatternAPI / ConfigKey Points
Define workspacepnpm-workspace.yaml with packages globsGlobs match directories containing package.json
Link local package"dep": "workspace:*"Always resolves to local workspace package
Link with version range"dep": "workspace:^1.0.0"Fails install if local version does not satisfy range
Default catalogcatalog: key in pnpm-workspace.yamlSingle source of truth for dependency versions
Named catalogcatalogs: key with named groupsMultiple version sets (e.g., react18, react17)
Use catalog in package"dep": "catalog:" or "dep": "catalog:name"Resolved to actual version on pnpm publish
Filter by name--filter <name> or -F <name>Exact name or glob pattern (@scope/*)
Filter with dependencies--filter "foo..."Package and all its dependencies
Filter with dependents--filter "...foo"Package and all packages that depend on it
Filter by directory--filter "./packages/app"All packages under a directory path
Filter by git changes--filter "[origin/main]"Packages changed since a commit or branch
Exclude from filter--filter "!foo"Remove matching packages from selection
Run script in packagepnpm --filter <pkg> <script>Runs script only in matched packages
Recursive runpnpm -r run <script>Runs script in all workspace packages
Install allpnpm installSingle lockfile for entire workspace
Publish workspace pkgpnpm publishReplaces workspace: and catalog: with real versions
Inject workspace depsinject-workspace-packages=true in .npmrcHard-links instead of symlinks; required for deploy
Script security (v10+)allowBuilds in package.jsonLifecycle scripts blocked by default; opt-in per dep

Common Mistakes

MistakeCorrect Pattern
Using workspace:* then publishing as-ispnpm automatically replaces workspace:* with real versions on publish
Forgetting to list directory in packages:Every package directory must match a glob in pnpm-workspace.yaml
Using npm install in workspace packagesAlways use pnpm install from the workspace root
Hardcoding versions duplicated across packagesUse catalog: to centralize version definitions
Running pnpm install inside a sub-packageRun from workspace root; use --filter to target packages
Expecting --filter to match directory names--filter matches package.json name field, not directory names
Not escaping ! in zsh for exclude filtersUse \! or quote the filter: --filter="!foo"
Using workspace: for non-workspace depsworkspace: protocol only works for packages defined in the workspace
Lifecycle scripts failing after pnpm 10 upgradepnpm 10 blocks scripts by default; add deps to allowBuilds in config
Using pnpm deploy without inject-workspace-packagesSet inject-workspace-packages=true in .npmrc (required in pnpm 10)

Delegation

  • Workspace scaffolding: Use Explore agent to discover existing package structure
  • Dependency auditing: Use Task agent to check version consistency across packages

If the turborepo skill is available, delegate build orchestration, task caching, and CI optimization to it. If the changesets skill is available, delegate versioning, changelog generation, and npm publishing to it.

References

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

playwright

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

ui-ux-polish

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

tanstack-form

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

find-skills

No summary provided by upstream source.

Repository SourceNeeds Review