Generated banner for Pnpm
Generated logo for Pnpm

Pnpm

Anthony FuCommunityCreated by Anthony Fu

  • Skill
  • Tool integration
  • Software development
  • MIT
  • Low risk

From the author

Node.js package manager with strict dependency resolution. Use when running pnpm specific commands, configuring workspaces via pnpm-workspace.yaml, or managing dependencies with catalogs, patches, overrides, config dependencies, or the global virtual store.
— the description by Anthony Fu

From the skill’s files

Taken from the skill’s own files (its description, section headings and stated usage). Not an AutoGineer summary, and not written by the author as one.

Node.js package manager with strict dependency resolution. Use when running pnpm specific commands, configuring workspaces via pnpm-workspace.yaml, or managing dependencies with catalogs, patches, overrides, config dependencies, or the global virtual store. pnpm is a fast, disk space efficient package manager. It uses a content-addressable store to deduplicate packages across all projects on a machine, and enforces strict dependency resolution by default, preventing phantom dependencies.

What it does

  • Core
  • Features
  • Best Practices

When to use it

  • Use when running pnpm specific commands, configuring workspaces via pnpm-workspace.yaml, or managing dependencies with catalogs, patches, overrides, config dependencies, or the global virtual store.

Advantages

The skill’s files do not state this.

Usage examples

The skill’s files do not state this.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/antfu/pnpm/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip pnpm.zip -d .agents/skills

Documentation by Anthony Fu

pnpm is a fast, disk space efficient package manager. It uses a content-addressable store to deduplicate packages across all projects on a machine, and enforces strict dependency resolution by default, preventing phantom dependencies.

pnpm v12 is a Rust rewrite of v11: stable, and keeps v11's commands, flags, settings, and lockfile format — so most guidance here applies to both. A handful of v12 behaviors differ (git deps resolve via HTTPS, project-aware global bins, other package managers, packageImportMethod: auto hardlinks first on Linux) — see best-practices-migration.

Configuration model (important): pnpm settings live in pnpm-workspace.yaml (and the global config.yaml) using camelCase keys. .npmrc is used only for authentication/registry credentials, and the pnpm field of package.json is no longer read. When working in a pnpm project, check pnpm-workspace.yaml for settings/workspace structure and .npmrc only for auth. Always use --frozen-lockfile (or pnpm ci) in CI.

The skill is based on pnpm 12.18, generated at 2026-11-05. It covers v11+v12 behavior (config split, config includes, isolated global packages, allowBuilds, pmOnFail, global virtual store, native release management, workspace task orchestration, and experimental Python/Cargo support) where current docs describe them.

Core

TopicDescriptionReference
CLI Commandsinstall/add/remove/update, run, dlx/pnx, workspace, runtime, publishing (version, view, sbom, stage)core-cli
Configurationpnpm-workspace.yaml settings (camelCase), global config.yaml, config includes, packageConfigs, auth (.npmrc, auth.ini)core-config
WorkspacesMonorepo support: filtering, workspace protocol, shared lockfile, packageConfigscore-workspaces
StoreContent-addressable store, virtual store, node linker modes (incl. loaded/store loader), frozen/read-only storecore-store

Features

TopicDescriptionReference
CatalogsCentralized dependency versions; catalogMode, catalog: in overridesfeatures-catalogs
OverridesForce versions (incl. transitive & peer deps); packageExtensionsfeatures-overrides
PatchesModify third-party packages; patchedDependencies in pnpm-workspace.yamlfeatures-patches
AliasesInstall under custom names (npm:) and registry aliases (namedRegistries)features-aliases
Hooks.pnpmfile.mjs hooks (readPackage, updateConfig, beforePacking), finders, resolvers/fetchersfeatures-hooks
Peer DependenciesAuto-install, strict mode, rules, dedupePeers, peers checkfeatures-peer-deps
Config DependenciesShare hooks/settings/catalogs/patches across repos via configDependenciesfeatures-config-dependencies
Global Virtual Store & ShimsShared node_modules, git-worktree multi-agent setups, isolated global packages, project-aware bins, other package managersfeatures-global-virtual-store
Supply-Chain SecurityBuild approval (allowBuilds), permissions and agent skills, minimumReleaseAge, trustPolicy, lockfile integrityfeatures-supply-chain-security
Task OrchestrationCross-project task graphs (tasks/dependsOn), concurrency groups, priority, pnpm pipelinefeatures-task-orchestration
Release ManagementNative versioning: pnpm change/version -r/lane, lanes, epics, fixed groupsfeatures-versioning
Multi-EcosystemPython (pypi:) and Cargo (crate:) dependencies alongside npm (experimental)features-multi-ecosystem

Best Practices

TopicDescriptionReference
CI/CD SetupGitHub Actions, GitLab, Docker, pnpm ci, store caching, frozen lockfilesbest-practices-ci
Migrationnpm/Yarn → pnpm, phantom deps, and pnpm v10 → v11 → v12 upgrade notesbest-practices-migration
PerformanceInstall optimizations, allowBuilds, global virtual store, workspace parallelizationbest-practices-performance

Files

references/features-patches.md


name: pnpm-patches description: Patch third-party packages directly with customized fixes

pnpm Patches

pnpm's patching feature lets you modify third-party packages directly. Useful for applying fixes before upstream releases or customizing package behavior.

Creating a Patch

Step 1: Initialize Patch
pnpm patch <pkg>@<version>

# Example
pnpm patch [email protected]

This creates a temporary directory with the package source and outputs the path:

You can now edit the following folder: /tmp/abc123...
Step 2: Edit Files

Navigate to the temporary directory and make your changes:

cd /tmp/abc123...
# Edit files as needed
Step 3: Commit Patch
pnpm patch-commit <path-from-step-1>

# Example
pnpm patch-commit /tmp/abc123...

pnpm patch extracts to node_modules/.pnpm_patches/<pkg> (or --edit-dir/-d <dir>; fails if non-empty: ERR_PNPM_PATCH_EDIT_DIR_EXISTS/ERR_PNPM_EDIT_DIR_NOT_EMPTY). Run pnpm install first (ERR_PNPM_PATCH_NO_LOCKFILE otherwise). If several versions are installed, pnpm asks which to patch and whether to apply to all (then the key is the bare package name). patch-commit accepts a path, or a package name/specifier (ERR_PNPM_AMBIGUOUS_PATCH_TARGET if several edit dirs match), and runs an install afterwards to apply the patch. To change a package's dependencies, use overrides or a hook, not a patched package.json.

This creates a .patch file in patches/ and records it in pnpm-workspace.yaml:

patches/
└── [email protected]
patchedDependencies:
  [email protected]: patches/[email protected]

patchedDependencies (like all pnpm settings) now lives in pnpm-workspace.yaml, not the package.json#pnpm field.

Patch File Format

Patches use standard unified diff format:

diff --git a/lib/router/index.js b/lib/router/index.js
index abc123..def456 100644
--- a/lib/router/index.js
+++ b/lib/router/index.js
@@ -100,6 +100,7 @@ function createRouter() {
   // Original code
-  const timeout = 30000;
+  const timeout = 60000; // Extended timeout
   return router;
 }

Managing Patches

List Patched Packages
pnpm list --depth=0
# Shows (patched) marker for patched packages
Update a Patch
# Edit existing patch
pnpm patch [email protected]

# After editing
pnpm patch-commit <path>
Remove a Patch
pnpm patch-remove <pkg>@<version>

# Example  
pnpm patch-remove [email protected]

patch-remove with no args lists recorded patches and prompts. It deletes the patch files, removes the keys, and deletes an empty patches dir. Errors: ERR_PNPM_NO_PATCHES_TO_REMOVE, ERR_PNPM_PATCH_NOT_FOUND.

Or manually:

  1. Delete the patch file from patches/

  2. Remove the entry from patchedDependencies in pnpm-workspace.yaml

  3. Run pnpm install

Patch Configuration

Multiple Packages / Workspaces

Patches are shared across the whole workspace from the root pnpm-workspace.yaml:

A version-less key (express:) patches every installed version. All workspace packages using a matching version get the patch.

Patches from a config dependency

Patch files can live inside a shared config dependency and be referenced by path:

configDependencies:
  my-patches: '1.0.0'
patchedDependencies:
  react: node_modules/.pnpm-config/my-patches/react.patch
allowUnusedPatches
allowUnusedPatches: true   # don't fail when a listed patch wasn't applied

ignorePatchFailures was removed in v11. A patch that fails to apply now always throws. When several patches are grouped, all errors are reported together at the end.

Best Practices

  1. Version specificity: Patches are tied to exact versions. Update patches when upgrading dependencies.

  2. Document patches: Add comments explaining why the patch exists:

    # In patches/README.md
    ## [email protected]
    Fixes timeout issue. PR pending: https://github.com/expressjs/express/pull/1234
  3. Minimize patches: Keep patches small and focused. Large patches are hard to maintain.

  4. Track upstream: Note upstream issues/PRs so you can remove patches when fixed.

  5. Test patches: Ensure patched code works correctly in your use case.

Troubleshooting

Patch fails to apply
ERR_PNPM_PATCH_FAILED  Cannot apply patch

The package version changed. Recreate the patch:

pnpm patch-remove [email protected]
pnpm patch [email protected]
# Reapply changes
pnpm patch-commit <path>
Patch not applied

Ensure:

  1. Version in patchedDependencies matches installed version exactly

  2. Run pnpm install after adding patch configuration

<!-- Source references: - https://pnpm.io/cli/patch - https://pnpm.io/cli/patch-commit - https://pnpm.io/config-dependencies -->

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs Node.js

Security

What our scanner noticed· Low risk

  • Instructions that use the network

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
Anthony Fu
Publisher
Anthony Fu (Community)
Source
antfu/skills · skills/pnpm · commit f63e9ec
Licence
MIT License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE.md)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Anthony Fu.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download pnpm.zip