When to use
Use this skill proactively for:
- Installing dependencies
- Adding or removing packages
- Running scripts
- Any command that involves a package manager
Instructions
Always use pnpm as the package manager. Before running any package manager command, check which package manager the project is already using:
- If
pnpm-lock.yamlexists → use pnpm - If
yarn.lockexists → use yarn - If
package-lock.jsonexists → use npm - If none exist (new project) → use pnpm
Never switch the package manager mid-project. If a project already uses npm, continue with npm throughout. Do not mix package managers in the same project.
pnpm Command mappings
| Instead of | Use |
|---|---|
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 run <script> |
npm ci | pnpm install --frozen-lockfile |
npx <cmd> | pnpm dlx <cmd> |
Lockfile and Dockerfile
- Always reference
pnpm-lock.yaml(notpackage-lock.json) in pnpm projects - In Dockerfiles, use
pnpm install --frozen-lockfile --prodfor production installs - Copy both
package.jsonandpnpm-lock.yamlinto Docker images