MCP HubMCP Hub
スキル一覧に戻る

Enforcing pnpm

camoneart
更新日 Today
95 閲覧
2
2
GitHubで表示
その他general

について

このClaude Skillは、パッケージインストール、スクリプト実行、依存関係管理の際にnpm/yarnコマンドを自動検出してブロックし、pnpmの排他的使用を強制します。`npm install`や`npx`などの禁止コマンドを傍受し、修正されたpnpm相当のコマンドを提供します。このスキルは、ユーザーがパッケージマネージャーに言及した時や依存関係を操作する際に作動し、プロジェクト全体で一貫したパッケージ管理を保証します。

クイックインストール

Claude Code

推奨
プラグインコマンド推奨
/plugin add https://github.com/camoneart/claude-code
Git クローン代替
git clone https://github.com/camoneart/claude-code.git ~/.claude/skills/Enforcing pnpm

このコマンドをClaude Codeにコピー&ペーストしてスキルをインストールします

ドキュメント

Enforcing pnpm

プロジェクトでpnpmを統一的に使用するための強制スキル。

いつ使うか

  • パッケージのインストール時
  • スクリプトの実行時
  • 依存関係の管理時
  • CI/CD設定時
  • ユーザーがパッケージマネージャーについて言及した時

基本原則

このプロジェクトは packageManager: [email protected] を前提として構成されている。

1. 実行コマンド

すべてのスクリプトは pnpm <script> 形式で実行:

pnpm run lint
pnpm test
pnpm build

2. グローバルコマンド

pnpx ではなく pnpm dlx を使用:

# ❌ 間違い
pnpx create-react-app my-app

# ✅ 正しい
pnpm dlx create-react-app my-app

3. スクリプト内の呼び出し

package.json で npm や yarn を呼び出さない:

{
  "scripts": {
    "build": "pnpm run compile"  // ✅
  }
}

禁止コマンド

以下のコマンドを検知したら警告し、pnpmに置き換えて再実行

npm コマンド

npm install    → pnpm install
npm run build  → pnpm run build
npm test       → pnpm test
npx xxx        → pnpm dlx xxx

yarn コマンド

yarn           → pnpm install
yarn add xxx   → pnpm add xxx
yarn build     → pnpm run build

CI/CD設定

GitHub Actions などの CI でも pnpm を使用:

- uses: pnpm/action-setup@v2
  with:
    version: 8

- run: pnpm install --frozen-lockfile

- run: pnpm test

キャッシュ設定

- uses: actions/setup-node@v3
  with:
    node-version: 18
    cache: 'pnpm'  # ✅ pnpm-store をキャッシュ

ドキュメント規則

README・各種ドキュメントに掲載するコマンド例も全て pnpm 表記へ統一:

# ❌ 間違い
npm install
npm run dev

# ✅ 正しい
pnpm install
pnpm run dev

自動修正フロー

Claude Code が npm コマンドを誤って実行しようとした場合:

  1. 警告を表示
  2. 自動で pnpm に置き換え
  3. 再実行

例:

検出: npm install
↓
警告: このプロジェクトではpnpmを使用します
↓
自動変換: pnpm install
↓
実行

例外処理

以下の場合のみ警告をスキップ:

  • ユーザーが明示的に npm/yarn の使用を指示した場合
  • package.json の scripts 内で外部ツールが npm を要求する場合(要確認)

トラブルシューティング

pnpm がインストールされていない場合

npm install -g pnpm
# または
corepack enable
corepack prepare pnpm@latest --activate

lockfile の不整合

rm -rf node_modules pnpm-lock.yaml
pnpm install

チェックリスト

  • 全てのコマンドが pnpm 形式か
  • CI設定で pnpm を使用しているか
  • ドキュメントが pnpm 表記になっているか
  • package.json の scripts が pnpm を呼び出しているか

GitHub リポジトリ

camoneart/claude-code
パス: skills/enforcing-pnpm

関連スキル

algorithmic-art

メタ

This Claude Skill creates original algorithmic art using p5.js with seeded randomness and interactive parameters. It generates .md files for algorithmic philosophies, plus .html and .js files for interactive generative art implementations. Use it when developers need to create flow fields, particle systems, or other computational art while avoiding copyright issues.

スキルを見る

subagent-driven-development

開発

This skill executes implementation plans by dispatching a fresh subagent for each independent task, with code review between tasks. It enables fast iteration while maintaining quality gates through this review process. Use it when working on mostly independent tasks within the same session to ensure continuous progress with built-in quality checks.

スキルを見る

executing-plans

デザイン

Use the executing-plans skill when you have a complete implementation plan to execute in controlled batches with review checkpoints. It loads and critically reviews the plan, then executes tasks in small batches (default 3 tasks) while reporting progress between each batch for architect review. This ensures systematic implementation with built-in quality control checkpoints.

スキルを見る

cost-optimization

その他

This Claude Skill helps developers optimize cloud costs through resource rightsizing, tagging strategies, and spending analysis. It provides a framework for reducing cloud expenses and implementing cost governance across AWS, Azure, and GCP. Use it when you need to analyze infrastructure costs, right-size resources, or meet budget constraints.

スキルを見る