agentleFS
MindrallyMindrally/skills/pnpm/SKILL.md

pnpm

Skill266 starsChanged 10 months agoApache-2.0View on GitHub

Best practices for pnpm package manager, workspace management, and monorepo configuration

  • Installs packages

13 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

20 rules. 0 are common, 11 are distinctive, and 9 are very specific to this project.

  • 0

    Common

    Most of the 9 edited versions we read keep these.

  • 11

    Distinctive

    This author's own choices. Worth a look.

  • 9

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Always use pnpm (not npm or yarn) for package management

    line 12
  2. Distinctive:

    Use the content-addressable store for disk space efficiency

    line 14
  3. Very specific:

    Create pnpm-workspace.yaml for monorepo setup:

    line 30
  4. Distinctive:

    Use glob patterns to define workspace package locations

    line 39
  5. Very specific:

    All matched directories with package.json become workspace packages

    line 40
  6. Distinctive:

    Add dependencies to specific workspace:

    line 45
  7. Distinctive:

    Use workspace protocol for internal dependencies:

    line 50
  8. Distinctive:

    Run commands in specific packages:

    line 66
  9. Distinctive:

    Run scripts across workspaces:

    line 83
  10. Distinctive:

    Prefer strict mode for better dependency isolation

    line 117
  11. Distinctive:

    Use public hoisting for tools that need flat node_modules

    line 118
  12. Distinctive:

    Document required peer dependencies clearly

    line 130
  13. Distinctive:

    Use overrides to fix security vulnerabilities

    line 147
  14. Very specific:

    Use pnpm fetch in Docker for better caching:

    line 158
  15. Very specific:

    Use --frozen-lockfile in CI environments

    line 166
  16. Very specific:

    Use .npmrc for consistent team configuration

    line 171
  17. Very specific:

    Prefer workspace:* for internal dependencies

    line 172
  18. Very specific:

    Keep root package.json minimal

    line 173
  19. Very specific:

    Use pnpm dedupe to optimize lockfile

    line 174
  20. Very specific:

    Use pnpm why <package> to debug dependency issues

    line 176

“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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:
    {
      "packageManager": "pnpm@9.0.0"
    }

Workspace Configuration

Create pnpm-workspace.yaml for monorepo setup:

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:
    pnpm add lodash --filter @org/my-app
    pnpm add -D typescript --filter @org/my-lib
  • Use workspace protocol for internal dependencies:
    {
      "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:

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:
    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:
    {
      "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:

# 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:

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:

{
  "pnpm": {
    "overrides": {
      "lodash": "^4.17.21",
      "foo@1.x": "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:
    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

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.