installing-npm-packages

p-chan's avatarfrom p-chan

npm、yarn、pnpm、bun で適切なバージョンのパッケージをインストールします。npm、yarn、pnpm、bun を使ってパッケージをインストールするときに必ず使用してください。

⭐8stars🔀0forks📁View on GitHub🕐Updated Jan 4, 2026

When & Why to Use This Skill

This Claude skill automates the installation of Node.js packages by intelligently detecting the project's specific package manager—npm, yarn, pnpm, or bun. It ensures environment consistency by identifying existing lock files and fetching the latest package versions, streamlining the dependency management process for developers.

Use Cases

  • Case 1: Automatically detecting the correct package manager (e.g., pnpm vs. npm) based on the presence of lock files or package.json fields to avoid environment conflicts.
  • Case 2: Fetching the latest stable version of a library and installing it with the precise syntax required by the detected tool.
  • Case 3: Managing the distinction between dependencies and devDependencies during the installation process to maintain a clean project structure.
nameinstalling-npm-packages
descriptionnpm、yarn、pnpm、bun で適切なバージョンのパッケージをインストールします。npm、yarn、pnpm、bun を使ってパッケージをインストールするときに必ず使用してください。

パッケージインストール

ワークフロー

1. パッケージマネージャーの検出

1-1. packageManager フィールドを確認

grep '"packageManager"' package.json

1-2. lock ファイルを確認(packageManager フィールドがない場合)

ls package-lock.json yarn.lock pnpm-lock.yaml bun.lockb 2>/dev/null

2. 最新バージョンを取得

npm view <pkg> version

3. インストール

種類 npm yarn pnpm bun
dependencies npm install <pkg>@<v> yarn add <pkg>@<v> pnpm add <pkg>@<v> bun add <pkg>@<v>
devDependencies npm install -D <pkg>@<v> yarn add -D <pkg>@<v> pnpm add -D <pkg>@<v> bun add -d <pkg>@<v>