pnpm

Manages Node.js dependencies with pnpm workspaces, catalogs, patches, and overrides.

1|Updated Aug 24, 2026
One-click install
npx skills add https://github.com/yamcodes/the-hat --skill pnpm-yamcodes
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: pnpm
Source: https://github.com/yamcodes/the-hat/tree/main/skills/pnpm
Command: npx skills add https://github.com/yamcodes/the-hat --skill pnpm-yamcodes

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Node.js projects often suffer from phantom dependencies, duplicated packages wasting disk space, and inconsistent versions across monorepos. This Skill provides guidance for using pnpm's strict dependency resolution, content-addressable store, and workspace tooling to manage packages correctly. ## Core Features & Use Cases - CLI & Configuration Guidance: Covers install, add, update, run, exec, and dlx commands plus pnpm-workspace.yaml and .npmrc settings. - Monorepo Workspaces: Explains workspace protocol, package filtering, topological builds, and shared lockfiles for multi-package repositories. - Advanced Dependency Control: Documents catalogs for centralized versions, overrides for transitive dependencies, patches for third-party fixes, and peer dependency rules. - Use Case: When migrating a monorepo from npm to pnpm, use this Skill to convert lockfiles, set up pnpm-workspace.yaml with catalogs, and configure CI with --frozen-lockfile installs. ## Quick Start Ask the AI to help you migrate your project from npm to pnpm and configure a workspace with shared dependency catalogs.

Frequently Asked Questions about pnpm

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

FAQPage Schema
How do I migrate from npm or Yarn to pnpm?▼

Run pnpm import to convert package-lock.json or yarn.lock into pnpm-lock.yaml, then delete old lockfiles and node_modules and run pnpm install. For monorepos, create pnpm-workspace.yaml and convert internal dependencies to the workspace: protocol.

How do pnpm workspaces work for monorepos?▼

Define packages in pnpm-workspace.yaml with glob patterns, then reference local packages using the workspace: protocol in package.json. Use pnpm --filter to run commands on specific packages and pnpm -r to run scripts across all packages in topological order.

What is the difference between pnpm catalogs and overrides?▼

Catalogs define versions for direct dependencies that packages explicitly reference with catalog:, while overrides force versions on any dependency including transitive ones automatically. Use catalogs for version management and overrides for security fixes or compatibility issues.

Why does pnpm fail with phantom dependency errors?▼

pnpm uses strict isolated node_modules where packages can only access declared dependencies, unlike npm's hoisted layout. Fix failures by explicitly adding missing packages with pnpm add, or set node-linker=hoisted in .npmrc for compatibility.

How do I patch a third-party package with pnpm?▼

Run pnpm patch <pkg>@<version> to open an editable copy, make your changes, then run pnpm patch-commit with the provided path. This creates a .patch file in patches/ and registers it under patchedDependencies in package.json.

Does pnpm support CI/CD caching for faster installs?▼

Yes, cache the pnpm store directory in GitHub Actions or GitLab CI and always run pnpm install --frozen-lockfile. Use Corepack with the packageManager field in package.json to pin consistent pnpm versions across environments.