Back to Mods

Npm To Pnpm Rewriter

Mods productivity
Install Command
npx claude-code-templates@latest --mod productivity/npm-to-pnpm-rewriter

Content

Early access. A mod is a complete Claude Code plugin built on function hooks (Anthropic's mods/ layout); it loads in Claude Code 2.1.259+ with CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 and the $ API may still change between releases. Hooks module: hooks/npm-to-pnpm-rewriter.ts. Options: manager (set in user or managed settings pluginConfigs, or /config). Run claude plugin validate on the installed folder to see every event it hooks and every $ call it makes.

npm-to-pnpm-rewriter

Rewrites npm / npx invocations to the package manager your project uses (pnpm by default, yarn or bun via options). The "modifying" placement: the hook forwards a copy of the event with a changed command to next, and tells the model what ran through context (the model's own tool_use block keeps the command it wrote, for prompt-cache stability).

Options

  manager: "pnpm" | "yarn" | "bun"  (default "pnpm")

Declared in .claude-plugin/plugin.json (userConfig). Set them in /config, in user settings (~/.claude/settings.json, not project settings), with --settings <file> or in managed settings:

json
{ "pluginConfigs": { "npm-to-pnpm-rewriter": { "options": { } } } }

Install

sh
npx claude-code-templates@latest --mod productivity/npm-to-pnpm-rewriter
CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 claude

It is written to .claude/skills/npm-to-pnpm-rewriter/, which Claude Code auto-loads as npm-to-pnpm-rewriter@skills-dir. For one session with hot reload: CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 claude --plugin-dir .claude/skills/npm-to-pnpm-rewriter. claude plugin validate .claude/skills/npm-to-pnpm-rewriter prints every event it hooks and every $ call it makes.

Early access. Mods need Claude Code 2.1.259+ with CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1; the $ API may change between releases. Typed against Anthropic's declarations: https://github.com/anthropics/claude-code/tree/main/mods

Stack Builder

0 components

Your stack is empty

Browse components and click the + button to add them to your stack for easy installation.