agentleFS
louisbrulenaudetlouisbrulenaudet/monorepo-template/.agents/skills/pnpm/SKILL.md

pnpm

Skill18 starsChanged 2 months agoApache-2.0View on GitHub

pnpm workspace and dependency management for this monorepo. Triggers on: pnpm install, pnpm add/remove/update, workspace protocol, catalogs, filtering, lockfile, hoisting, allowBuilds, minimumReleaseAge, CI install failures, and dependency version drift. Use when user or agent: adds/removes packages, scaffolds workspace packages, debugs install/hoisting issues, updates shared tool versions, or changes pnpm-workspace.yaml.

  • Reads credentials
  • 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

18 rules. 0 are common, 2 are distinctive, and 16 are very specific to this project.

  • 0

    Common

    Most of the 9 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 16

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Do not put task logic in root package.json when it belongs in packages - see the turborepo skill.

    line 23
  2. Very specific:

    After adding a new app under apps/, run pnpm install before turbo commands.

    line 37
  3. Distinctive:

    Always link internal packages with the workspace protocol:

    line 41
  4. Very specific:

    Never duplicate a shared package version as a registry range in an app - use workspace:*.

    line 55
  5. Very specific:

    Keep front-app-only utilities (e.g.

    line 99
  6. Very specific:

    Run pnpm run ci after any dependency bump.

    line 106
  7. Very specific:

    Do not bump the same package in multiple package.json files independently - use the catalog.

    line 108
  8. Very specific:

    Prefer --filter <name> over cd apps/foo && pnpm add - keeps context at repo root.

    line 149
  9. Very specific:

    When pnpm install fails on a blocked build script:

    line 166
  10. Very specific:

    Add to allowBuilds in pnpm-workspace.yaml with true or false.

    line 169
  11. Very specific:

    Do not disable strictDepBuilds to silence failures.

    line 172
  12. Very specific:

    Always commit pnpm-lock.yaml with manifest changes.

    line 188
  13. Very specific:

    Never commit .env, .dev.vars, or secrets.

    line 190
  14. Very specific:

    Create directory under apps/ or packages/ with package.json ("private": true).

    line 208
  15. Very specific:

    Add workspace:* deps on shared packages as needed.

    line 209
  16. Very specific:

    Use catalog: for shared tools (hono, oxfmt, oxlint, vite, etc.).

    line 210
  17. Very specific:

    Add a package turbo.json with "extends": ["//"] and a tags entry.

    line 212
  18. Distinctive:

    Add AGENTS.md if the package has non-trivial conventions.

    line 213

“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 Skill

Fast, disk-efficient package manager for this pnpm + Turborepo monorepo. pnpm owns the dependency graph, lockfile, and supply-chain policy; Turborepo owns task orchestration (build, lint, dev, --affected).

Division of Labor

ConcernToolAgent action
Add/remove/update depspnpmpnpm add, pnpm remove, pnpm up
Shared version pinspnpm catalogEdit pnpm-workspace.yaml catalog:
Internal packagespnpm workspace"@repo/foo": "workspace:*"
Build/lint/dev/deployTurborepopnpm turbo run <task> or pnpm <task>
Affected CITurborepopnpm turbo run <task> --affected

Do not put task logic in root package.json when it belongs in packages - see the turborepo skill.

This Repo

SettingValue
pnpm version12.6.0 (pinned via devEngines.packageManager in root package.json; resolved version and integrity in pnpm-lock.yaml packageManagerDependencies)
Workspace globsapps/*, packages/* in pnpm-workspace.yaml
Install (local)pnpm install
Install (CI)pnpm install --frozen-lockfile
Update all depspnpm run update → pnpm update --recursive --latest (bumps catalog entries in pnpm-workspace.yaml)
LockfileSingle pnpm-lock.yaml (pnpm workspace default)
Policy locationpnpm-workspace.yaml only - project .npmrc is auth-only under pnpm 11

After adding a new app under apps/, run pnpm install before turbo commands.

Workspace Protocol

Always link internal packages with the workspace protocol:

{
  "dependencies": {
    "@repo/dtos-common": "workspace:*",
    "@repo/enums-common": "workspace:*"
  }
}
  • workspace:* - always use the local workspace version (preferred).
  • On publish, pnpm rewrites workspace: to semver ranges automatically.

Never duplicate a shared package version as a registry range in an app - use workspace:*.

Catalogs (Shared Tool Versions)

Shared versions live in the default catalog in pnpm-workspace.yaml with catalogMode: prefer (prefer catalog on pnpm add when listed; one-off deps still allowed):

catalog:
  '@cloudflare/vite-plugin': 2.0.0-beta.sha-ad79608dd
  '@tailwindcss/vite': ^4.3.3
  '@vitejs/plugin-react': ^6.0.5
  babel-plugin-react-compiler: ^1.0.0
  cf: 1.0.0-beta.5
  hono: ^4.13.0
  oxfmt: ^0.62.0
  oxlint: ^1.77.0
  oxlint-tsgolint: ^7.0.2001
  react: ^19.2.8
  react-dom: ^19.2.8
  tailwindcss: ^4.3.3
  typescript: ^7.0.2
  vite: ^8.2.0
  wrangler: ^4.143.0
  zod: ^4.5.2

cf and @cloudflare/vite-plugin are exact beta pins: cf accepts only plugin versions >=2.0.0-0 <3, and the plugin ships a snapshot per push. Bump the two deliberately and together, and re-check both pins after pnpm run update (pnpm update --recursive --latest).

TanStack packages (@tanstack/*) and @types/* are also in the catalog - see pnpm-workspace.yaml for the full list.

Reference in any package.json:

{
  "dependencies": {
    "hono": "catalog:"
  },
  "devDependencies": {
    "oxfmt": "catalog:",
    "oxlint": "catalog:"
  }
}

Keep front-app-only utilities (e.g. rollup-plugin-visualizer) out of the catalog. Escalate catalogMode to strict only after catalog coverage is complete.

Workflow for bumping a shared tool:

  1. All catalog + non-catalog deps: pnpm run update - runs pnpm update --recursive --latest, which rewrites catalog ranges in pnpm-workspace.yaml and keeps "catalog:" in manifests.
  2. One catalog-managed package: pnpm update --recursive --latest <pkg> (e.g. oxfmt).
  3. Manual pin: edit pnpm-workspace.yaml catalog:, then pnpm install.
  4. Run pnpm run ci after any dependency bump.

Do not bump the same package in multiple package.json files independently - use the catalog.

Workspace-level overrides (e.g. @types/node) stay in pnpm-workspace.yaml, not in individual manifests.

Agent Command Cheat Sheet

# Add runtime dep to an app
pnpm add <pkg> --filter front-app

# Add dev dep to an app
pnpm add -D <pkg> --filter worker-api

# Add tooling dep to workspace root
pnpm add -D <pkg> -w

# Remove from one package
pnpm remove <pkg> --filter front-app

# Run command in one package + its deps
pnpm --filter worker-api... <cmd>

# Run command in one package only
pnpm --filter front-app <cmd>

# Update all deps (including catalog entries in pnpm-workspace.yaml)
pnpm run update

# Update one catalog-managed package to latest
pnpm up -r -L oxfmt

# Update within existing ranges only (no catalog bump)
pnpm up -r

# Inspect why a package is installed
pnpm why <pkg>

# Reproducible CI install
pnpm install --frozen-lockfile

Prefer --filter <name> over cd apps/foo && pnpm add - keeps context at repo root.

Package names: front-app, worker-api, @repo/dtos-common, @repo/enums-common, @repo/typescript-config.

Security Settings

Configured in pnpm-workspace.yaml:

SettingPurpose
strictDepBuilds: trueBlock lifecycle scripts unless explicitly allowed
allowBuildsMap of packages allowed (true) or denied (false) to run install scripts
trustPolicy: no-downgradeReject installs that would downgrade package trust/provenance
blockExoticSubdeps: trueBlock exotic (non-registry) transitive dependencies
minimumReleaseAge (unset)pnpm's default 24-hour cooldown on newly published versions
minimumReleaseAgeExcludeHotfix exceptions (@cloudflare/*, cf, wrangler, miniflare, typescript)

When pnpm install fails on a blocked build script:

  1. Decide if the script is necessary (e.g. esbuild, workerd) or optional.
  2. Add to allowBuilds in pnpm-workspace.yaml with true or false.
  3. Re-run pnpm install.

Do not disable strictDepBuilds to silence failures.

Hoisting Policy

Use pnpm strict linking defaults. This repository has no hoisting override: workspace dependencies use workspace:*, shared versions use catalog:, and each package declares every dependency it imports. pnpm 11 ignores non-auth project .npmrc settings, so package-manager policy belongs in pnpm-workspace.yaml. Fix a phantom dependency by declaring it in the owning package; do not add broad hoisting.

CI

GitHub Actions uses:

  1. pnpm/setup (pnpm v11+ successor to pnpm/action-setup) with runtime: node@24 and install: false (default install is not frozen); the store cache is actions/cache keyed on pnpm-lock.yaml in ci.yml only, since pnpm/setup's cache: true saves a new entry on every run
  2. pnpm install --frozen-lockfile (version comes from root package.json devEngines.packageManager)
  3. pnpm turbo run <task> --affected

Rules:

  • Always commit pnpm-lock.yaml with manifest changes.
  • CI uses --frozen-lockfile - lockfile must be in sync.
  • Never commit .env, .dev.vars, or secrets.

Common Mistakes

MistakeCorrect approach
Duplicate root-owned tools in each package.jsonKeep OXC, Turbo, cf, and Wrangler tooling at the narrowest actual owner
pnpm add foo at root without -wUse -w for root deps, --filter for packages
Registry version for @repo/*Use workspace:*
Registry version for a catalogued packageUse catalog:
Put install policy in .npmrcPut it in pnpm-workspace.yaml
Hoist a missing package to mask a phantom dependencyDeclare it in the importing package
Disable strictDepBuildsAdd entry to allowBuilds
Run pnpm build for app tasksUse pnpm turbo run build or pnpm build
Hand-edit pnpm-lock.yamlRun pnpm install to regenerate

Scaffolding a New Workspace Package

  1. Create directory under apps/ or packages/ with package.json ("private": true).
  2. Add workspace:* deps on shared packages as needed.
  3. Use catalog: for shared tools (hono, oxfmt, oxlint, vite, etc.).
  4. Run pnpm install.
  5. Add a package turbo.json with "extends": ["//"] and a tags entry.
  6. Add AGENTS.md if the package has non-trivial conventions.

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.