pnpm
Use this for Node.js package management with pnpm's strict dependency model.
Project Fit Check
Before running pnpm:
- Read
package.json,pnpm-workspace.yaml,pnpm-lock.yaml,.npmrc,engines,packageManager, and toolchain files. - Use the repo's pinned pnpm version through Corepack, mise, Volta, or the documented path.
- Run commands from the workspace root unless a package-level command is explicitly needed.
- Do not replace npm/yarn/bun with pnpm unless the user asked.
- Treat lockfile changes as intentional and review them.
Commands
pnpm install
pnpm --filter <package> <script>
pnpm exec <tool>
pnpm why <package>
pnpm update <package>
pnpm patch <package>
Workspace Rules
- Use
--filterfor targeted work. - Keep root scripts as orchestration; package scripts do package-local work.
- Prefer
workspace:*for internal package dependencies. - Use catalogs only when the repo already uses or wants centralized versions.
- Use
overridessparingly and document why.
Dependency Rules
- Add dependencies to the package that imports them.
- Keep dev tools in the narrowest sensible workspace.
- Do not bypass peer dependency warnings without understanding runtime impact.
- Use
pnpm whybefore deleting or deduplicating dependencies.
Red Flags
- running install from the wrong directory
- changing package manager version without aligning docs and CI
- lockfile churn unrelated to the task
- adding dependency at root because it is convenient
- using
--forceor--shamefully-hoistas a first move