Skip to content
Enforcing pnpm logo

Enforcing pnpm

Ensure pnpm is used exclusively for package management, blocking npm/yarn commands. Use when running package scripts, installing dependencies, or when user mentions package manager/依存関係/パッケージ.

SKILL.md

Full skill instructions

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 を呼び出しているか

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View