# Pnpm Projects

> pnpm for Node.js Projects

- Skill: `webcoyote/pnpm-projects` (Agent Skill)
- Install (CLI): `npx skillmds@latest add webcoyote/pnpm-projects`
- Raw SKILL.md: https://api.skillmd.com/api/skills/webcoyote/pnpm-projects/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: webcoyote (https://skillmd.com/u/webcoyote)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/webcoyote/pnpm-projects

---


# pnpm for Node.js Projects

Always use `pnpm` instead of `npm` or `yarn`. If the user types `npm <cmd>`, translate to the `pnpm` equivalent and proceed (don't ask).

## Command translation

| Instead of            | Use                  |
|-----------------------|----------------------|
| `npm init -y`         | `pnpm init`          |
| `npm install`         | `pnpm install`       |
| `npm install <pkg>`   | `pnpm add <pkg>`     |
| `npm install -D <pkg>`| `pnpm add -D <pkg>`  |
| `npm install -g <pkg>`| `pnpm add -g <pkg>`  |
| `npm uninstall <pkg>` | `pnpm remove <pkg>`  |
| `npm run <script>`    | `pnpm <script>`      |
| `npm test`            | `pnpm test`          |
| `npx <bin>`           | `pnpm dlx <bin>`     |
| `yarn <anything>`     | `pnpm <equivalent>`  |

## New project setup

```bash
pnpm init                    # creates package.json
pnpm add -D typescript @types/node   # dev deps
pnpm add <runtime-deps>
```

Commit the `pnpm-lock.yaml` (not `package-lock.json` or `yarn.lock`). If a `package-lock.json` or `yarn.lock` exists in a project we're converting, delete it after generating `pnpm-lock.yaml`.

## Workspaces / monorepos

Use `pnpm-workspace.yaml` at the repo root:

```yaml
packages:
  - "packages/*"
  - "apps/*"
```

Run a script in one workspace: `pnpm --filter <name> <script>`.

## Don't

- Don't run `npm install` or `yarn install` — even if a lockfile from another tool exists, switch to pnpm.
- Don't suggest `npx`; use `pnpm dlx` (one-off) or `pnpm exec` (project-local bin).
- Don't add `engines.npm` in `package.json`; add `packageManager: "pnpm@<version>"` instead.

## If pnpm isn't installed

Tell the user to install it once: `brew install pnpm` (macOS) or `corepack enable && corepack prepare pnpm@latest --activate`. Don't fall back to npm.

