pnpm · mindrally — Claude Code skill: what it does, how to install
Guides your agent on pnpm workspace structures, strict package isolation, and monorepo scripts.
npx skills add Mindrally/skills --skill pnpm -a claude-codeWhat pnpm does
This skill guides agents through pnpm dependency workflows in JavaScript and TypeScript repositories. It establishes conventions for monorepo structures, preferring pnpm over npm or yarn to keep lockfiles consistent and make use of content-addressable storage.
Inside, the skill details configurations for pnpm-workspace.yaml, targeted task execution using --filter, and recursive multi-package runs with -r. It provides .npmrc settings that balance package isolation against tooling needs, noting selective hoisting patterns with public-hoist-pattern.
Docker workflows leverage pnpm fetch alongside offline installations, while indiscriminate hoisting via shamefully-hoist is discouraged. Without an established workspace file, multi-package filtering and internal protocols will fail.
What it helps with
- configure monorepo architecture using
pnpm-workspace.yaml - link local dependencies with the
workspace:protocol - run build and test tasks across packages in parallel
- override vulnerable transitive packages inside
package.json
Example prompts for the agent
- Configure a workspace file covering applications and shared library directories.
- Add
lodashstrictly to@org/my-appusing package filtering. - Run tests across all workspaces and their dependents in parallel.
How to install pnpm
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill pnpm -a claude-code2Manually: put the files in place
~/.claude/skills/pnpm/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/pnpm/
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill pnpm -a codex2Manually: put the files in place
.agents/skills/pnpm/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill pnpm -a cursor2Manually: put the files in place
.cursor/skills/pnpm/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install Mindrally/skills pnpm2Manually: put the files in place
.github/skills/pnpm/SKILL.md1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill pnpm -a gemini-cli2Platform CLI
gemini skills install https://github.com/Mindrally/skills --path pnpmManually: put the files in place
.devin/skills/pnpm/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add Mindrally/skills --skill pnpm -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about pnpm
How to install pnpm in Claude Code?
Run npx skills add Mindrally/skills --skill pnpm -a claude-code in your terminal. You can also save the file directly to ~/.claude/skills/pnpm/SKILL.md.
What does the pnpm skill do?
It gives the agent instructions for monorepo workspaces, dependency overrides, Docker caching via pnpm fetch, and filtered command execution.
How does the skill handle local packages?
It enforces the workspace: protocol, such as workspace:* or workspace:^. When publishing, pnpm substitutes these placeholders with actual version numbers.
Source text
SKILL.md · Apache-2.0
---
name: pnpm
description: Best practices for pnpm package manager, workspace management, and monorepo configuration
metadata:
maintainer: Mindrally
source: https://github.com/Mindrally/skills
---
# pnpm Development
You are an expert in pnpm, the fast, disk space efficient package manager for JavaScript and TypeScript projects.
## Core Principles
- Always use pnpm (not npm or yarn) for package management
- Leverage pnpm's strict dependency resolution for better security
- Use the content-addressable store for disk space efficiency
- Maintain consistent lockfile (`pnpm-lock.yaml`)
## Installation and Setup
- Install pnpm globally: `npm install -g pnpm`
- Or use corepack: `corepack enable && corepack prepare pnpm@latest --activate`
- Specify pnpm version in `package.json`:
```json
{
"packageManager": "[email protected]"
}
```
## Workspace Configuration
Create `pnpm-workspace.yaml` for monorepo setup:
```yaml
packages:
- 'apps/*'
- 'packages/*'
- 'tooling/*'
```
- Use glob patterns to define workspace package locations
- All matched directories with `package.json` become workspace packages
## Dependency Management
- Install dependencies: `pnpm install`
- Add dependencies to specific workspace:
```bash
pnpm add lodash --filter @org/my-app
pnpm add -D typescript --filter @org/my-lib
```
- Use workspace protocol for internal dependencies:
```json
{
"dependencies": {
"@org/shared-utils": "workspace:*",
"@org/ui": "workspace:^"
}
}
```
- Protocol options:
- `workspace:*` - Any version, replaced with actual version on publish
- `workspace:^` - Compatible versions
- `workspace:~` - Patch versions only
## Filtering Commands
Run commands in specific packages:
```bash
pnpm --filter @org/my-app dev
pnpm --filter "./apps/*" build
pnpm --filter "...@org/my-lib" test # Include dependents
pnpm --filter "@org/my-lib..." build # Include dependencies
```
- Filter patterns:
- `--filter <package-name>` - Specific package
- `--filter "./path/*"` - By path
- `--filter "...<pkg>"` - Package and its dependents
- `--filter "<pkg>..."` - Package and its dependencies
## Scripts and Task Running
- Run scripts across workspaces:
```bash
pnpm -r run build # Run in all packages
pnpm -r --parallel run dev # Run in parallel
pnpm -r --stream run test # Stream output
```
- Define root-level scripts for common operations:
```json
{
"scripts": {
"build": "pnpm -r run build",
"dev": "pnpm --filter @org/web dev",
"lint": "pnpm -r run lint",
"test": "pnpm -r run test"
}
}
```
## Dependency Hoisting
Configure hoisting in `.npmrc`:
```ini
# Strict mode - no hoisting
hoist=false
# Selective hoisting
public-hoist-pattern[]=*eslint*
public-hoist-pattern[]=*prettier*
# Shamefully hoist everything (not recommended)
shamefully-hoist=true
```
- Prefer strict mode for better dependency isolation
- Use public hoisting for tools that need flat node_modules
## Peer Dependencies
Configure peer dependency handling in `.npmrc`:
```ini
auto-install-peers=true
strict-peer-dependencies=false
```
- Resolve peer dependency warnings appropriately
- Document required peer dependencies clearly
## Overrides and Resolutions
Override dependencies in root `package.json`:
```json
{
"pnpm": {
"overrides": {
"lodash": "^4.17.21",
"[email protected]": "npm:bar@^2.0.0"
}
}
}
```
- Use overrides to fix security vulnerabilities
- Pin problematic transitive dependencies
## Publishing Workspaces
- Configure publishable packages with proper fields
- Publish with `pnpm publish`
- Workspace protocol references are replaced with actual versions
## Performance Optimization
- Use `pnpm fetch` in Docker for better caching:
```dockerfile
COPY pnpm-lock.yaml ./
RUN pnpm fetch
COPY . ./
RUN pnpm install --offline
```
- Configure store location for CI caching
- Use `--frozen-lockfile` in CI environments
## Best Practices
- Always commit `pnpm-lock.yaml`
- Use `.npmrc` for consistent team configuration
- Prefer `workspace:*` for internal dependencies
- Keep root `package.json` minimal
- Use `pnpm dedupe` to optimize lockfile
- Audit regularly with `pnpm audit`
- Use `pnpm why <package>` to debug dependency issues
- Integrate with Turborepo or Nx for advanced task running
- Set `engine-strict=true` to enforce Node.js version requirements
© Mindrally · Apache-2.0 · Mindrally/skills
Similar skills
All skills for DevOps and infrastructure →pnpm by other authors comes first.