setup-pm — Claude Code command: select your package manager
setup-pm — a command to configure which package manager (npm, pnpm, yarn, or bun) Claude Code uses in your project or globally. Use it when you want to enforce a specific manager across your workflow.
MIT ★ 6,739 updated 2026-01-23
/plugin marketplace add WorldFlowAI/everything-claude-code
/plugin install everything-claude-code@everything-claude-codeWhat setup-pm does
setup-pm lets you pick your package manager through multiple methods: set a global preference, configure it per project, or pass it via the CLAUDE_PACKAGE_MANAGER environment variable. The command checks in a specific sequence — environment variable first, then project config, then the packageManager field in package.json, then lock files (package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb), global config at ~/.claude/package-manager.json, and finally defaults to the first available manager from pnpm → bun → yarn → npm.
Configuration lives in JSON files: globally in ~/.claude/package-manager.json, per-project in .claude/package-manager.json, or in your package.json. The command supports --detect mode to show current settings, --global and --project flags to set preferences, and --list to display available managers.
What it helps with
- use pnpm or bun instead of npm as default in Claude Code
- enforce the same package manager across all projects without repetition
- quickly check which manager your system is currently using
- override the manager via environment variable for a single session
Example prompts for the agent
- Detect and show me what package manager is currently active
- Set pnpm as the global package manager preference
- Configure bun as the manager for this project only
How to install setup-pm
1Plugin marketplace
/plugin marketplace add WorldFlowAI/everything-claude-code/plugin install everything-claude-code@everything-claude-code2Manually: put the files in place
.claude/commands/setup-pm.mdCall it with /setup-pm. For all projects use ~/.claude/commands/
Manually: put the files in place
~/.codex/prompts/setup-pm.mdCall it with /prompts:setup-pm. Codex marks this format deprecated in favour of skills
Manually: put the files in place
.github/prompts/setup-pm.prompt.mdManually: put the files in place
.gemini/commands/setup-pm.tomlGemini stores commands as TOML: the prompt text goes into the prompt field
Questions about setup-pm
How do I install setup-pm in Claude Code?
In Claude Code, run /plugin marketplace add WorldFlowAI/everything-claude-code, then /plugin install everything-claude-code@everything-claude-code. The command will be available at .claude/commands/setup-pm.md.
What does setup-pm do?
It configures which package manager (npm, pnpm, yarn, or bun) Claude Code will use when working with dependencies. You can set a preference globally, for a single project, or override it with an environment variable.
What order does setup-pm check for the package manager?
It checks the CLAUDE_PACKAGE_MANAGER environment variable first, then project config at .claude/package-manager.json, the packageManager field in package.json, lock files (package-lock.json, yarn.lock, and others), global config at ~/.claude/package-manager.json, and finally defaults to the first available manager among pnpm, bun, yarn, and npm.
Source text
setup-pm.md · MIT
---
description: Configure your preferred package manager (npm/pnpm/yarn/bun)
disable-model-invocation: true
---
# Package Manager Setup
Configure your preferred package manager for this project or globally.
## Usage
```bash
# Detect current package manager
node scripts/setup-package-manager.js --detect
# Set global preference
node scripts/setup-package-manager.js --global pnpm
# Set project preference
node scripts/setup-package-manager.js --project bun
# List available package managers
node scripts/setup-package-manager.js --list
```
## Detection Priority
When determining which package manager to use, the following order is checked:
1. **Environment variable**: `CLAUDE_PACKAGE_MANAGER`
2. **Project config**: `.claude/package-manager.json`
3. **package.json**: `packageManager` field
4. **Lock file**: Presence of package-lock.json, yarn.lock, pnpm-lock.yaml, or bun.lockb
5. **Global config**: `~/.claude/package-manager.json`
6. **Fallback**: First available package manager (pnpm > bun > yarn > npm)
## Configuration Files
### Global Configuration
```json
// ~/.claude/package-manager.json
{
"packageManager": "pnpm"
}
```
### Project Configuration
```json
// .claude/package-manager.json
{
"packageManager": "bun"
}
```
### package.json
```json
{
"packageManager": "[email protected]"
}
```
## Environment Variable
Set `CLAUDE_PACKAGE_MANAGER` to override all other detection methods:
```bash
# Windows (PowerShell)
$env:CLAUDE_PACKAGE_MANAGER = "pnpm"
# macOS/Linux
export CLAUDE_PACKAGE_MANAGER=pnpm
```
## Run the Detection
To see current package manager detection results, run:
```bash
node scripts/setup-package-manager.js --detect
```
© Affaan Mustafa · MIT · WorldFlowAI/everything-claude-code