agentleFS
badhopebadhope/AI-SKILL/skills/pnpm-upgrade-package/SKILL.md

PNPM Upgrade Package

Skill11 starsChanged 6 months agoMITView on GitHub

You''re bumping a dependency in a **pnpm workspace**.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    The package manager is npm, yarn, or bun: Use the manager-specific upgrade procedure.

    line 208
  2. Very specific:

    You hand-edit pnpm-lock.yaml: Never. The lockfile is regenerated by pnpm.

    line 227

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “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

When to use

You're bumping a dependency in a pnpm workspace. Maybe a security advisory, maybe a feature, maybe a client wants the new version. The "just pnpm up" approach is wrong in three ways:

  1. pnpm up will pick latest unless you pin the version. The user asked for 14.2.0; they didn't ask for whatever shipped at 3am.
  2. Transitive deps don't always move with pnpm up. A bump to next@15 may not move react if your direct deps already allow the old range. The bump is then silently incomplete.
  3. Lockfile churn from dedupe can hide the real change. After pnpm dedupe, the diff includes unrelated package moves that obscure the upgrade.

This skill is a deterministic, step-by-step procedure that avoids all three. Read the steps, follow them, report the outcome.

Don't use this skill for npm / yarn / bun. And don't use it for a brand-new package install (use pnpm add).

Inputs

FieldRequiredNotes
packageyesThe package to upgrade.
target_versionnoIf absent, ask. Never assume latest.
workspace_filternoScopes the bump.
release_age_window_daysnoOverride minimumReleaseAge from pnpm-workspace.yaml.

Output

Plain-text recipe:

Steps run:
  1. node check-release-age-window.mjs <pkg> <ver>  → pass
  2. pnpm why -r <pkg>  → transitive source: web > next@14
  3. pnpm -w up <pkg>@<ver>  → manifest + lockfile updated
  4. pnpm dedupe  → clean (no unrelated churn)
  5. pnpm why -r <pkg>  → only <ver> remains
  6. pnpm -r --filter !docs test  → 412 passed, 0 failed

Manifest diffs:
  - package.json: next 14.2.0 → 14.2.18

Release age check: pass (<pkg> <ver> is 4 days old,
  > 3-day minimum)

Lockfile diff: 28 lines

Dedupe outcome: clean

Final pnpm why: web → next@14.2.18, no other consumers

Prompt

You are upgrading a pnpm workspace dependency. Follow
the order; do not skip the release-age check; do not
silently upgrade to latest.

1. Ask for the missing inputs.

   Required: package name.
   Optional: target version.
   If the user gave only the package, ask for the
   target version. If they said "upgrade X to latest",
   resolve the latest from the registry and confirm
   before bumping.

2. Run the release-age check.

   The project's `pnpm-workspace.yaml` defines
   `minimumReleaseAge` (a cooldown in days for newly
   published versions). Run:

     node <skill>/scripts/check-release-age-window.mjs \
       <package> <targetVersion>

   The script reads `pnpm-workspace.yaml` and reports
   whether the target version satisfies the cooldown.
   Three outcomes:
     - pass: target is older than the window
     - blocked: target is newer than the window
     - ambiguous: version doesn't exist on registry

   If blocked, do NOT proceed without an explicit
   `minimumReleaseAgeExclude` entry. Ask the user
   before adding one.

3. Find the direct consumer.

   Run:
     pnpm why -r <package>

   This shows which top-level dep brings <package> in.
   If <package> is not directly declared anywhere, the
   answer is "transitive via <parent>".

4. Decide: bump direct or parent.

   - If <package> is directly declared in some
     workspace: bump the direct.
   - If <package> is transitive via <parent>:
       - Check whether the parent's range already
         covers the target version. If yes, prefer
         a lockfile refresh (delete node_modules,
         `pnpm install`) over a manifest change.
       - If not, upgrade the parent (and any peer
         cousins the parent requires).

   Do not add a direct declaration for a package
   that is transitive unless the user explicitly
   wants that.

5. Apply the bump.

   - Root workspace only: `pnpm -w up <pkg>@<ver>`
   - One workspace: `pnpm --filter <name> up <pkg>@<ver>`
   - All workspaces that should move together:
     `pnpm -r up <pkg>@<ver>`

   If a scoped `pnpm-workspace.yaml` `overrides` entry
   is needed (target is transitive, parent range is
   too tight, and the user wants to pin the version
   globally), add it TEMPORARILY. The override is
   removed in step 7.

6. Run `pnpm dedupe`.

   Always run `pnpm dedupe` after a manifest change.
   Inspect the diff. If dedupe introduces unrelated
   churn (moves to packages not touched by the
   upgrade), revert that specific change. The dedupe
   pass is meant to clean up the upgrade, not to be
   a stealth general refactor.

7. Prove the override (if any) is still required.

   If you added a scoped override in step 5:
     a) Remove the override.
     b) Run `pnpm install`.
     c) Run `pnpm why -r <pkg>` and check whether the
        target version remains.
     d) If yes, do NOT keep the override. Restore
        the original `pnpm-workspace.yaml`.
     e) If no (pnpm reverts or drifts), keep the
        override.

   Most of the time, the override is unnecessary. The
   point of the check is to avoid permanent overrides
   that rot.

8. Run the test suite.

     pnpm -r --filter !docs test

   (Adjust the filter to your project's convention.)
   0 failures is required before declaring done.

9. Final `pnpm why`.

     pnpm why -r <pkg>

   Confirm only the intended version remains. If a
   stale version lingers, identify the parent and
   decide whether to bump it or accept the staleness.

When NOT to use

  • The package manager is npm, yarn, or bun. Use the manager-specific upgrade procedure.
  • The user said "upgrade to latest" and that's genuinely what they want. Resolve the latest, confirm, then run the upgrade. Don't pretend "latest" was not specified.
  • You skip the release-age check. The check protects the project from a bad release that was published 2 hours ago. Skipping it is a silent footgun.
  • You add a direct declaration for a transitive package. That's a sign you didn't read the consumer map. Either the parent's range already covers the target (lockfile refresh) or the parent needs a bump.
  • You keep a permanent scoped override. The override is a temporary resolution tool. If the bump holds without it, remove it. Permanent overrides rot and surprise the next upgrade.
  • You hand-edit pnpm-lock.yaml. Never. The lockfile is regenerated by pnpm. If a pnpm command produces unrelated churn, fix the command, not the lockfile.
  • You accept dedupe churn as "free refactoring". Dedupe diffs must be inspected. Unrelated package moves obscure the upgrade and bloat the PR diff. Revert unrelated churn.
  • You upgrade <parent> to satisfy the target when the parent range already covers it. A parent bump is a separate decision. Resolve the lockfile first.
  • You skip the test run. The version bump may have broken a peer assumption. The test suite is the cheapest way to catch it.

Example

Input:

package: next
target_version: 14.2.18
workspace_filter: "--filter web"

Output:

Steps run:
  1. node check-release-age-window.mjs next 14.2.18
     → pass (5 days old, > 3-day minimum)
  2. pnpm why -r next
     → direct declaration in web
  3. pnpm --filter web up next@14.2.18
     → web/package.json: next 14.2.0 → 14.2.18
  4. pnpm dedupe
     → clean (3 lines deduped, all related)
  5. pnpm -r --filter !docs test
     → 412 passed, 0 failed
  6. pnpm why -r next
     → web → next@14.2.18 (only consumer)

Manifest diffs:
  - web/package.json: next 14.2.0 → 14.2.18

Release age check: pass

Lockfile diff: 6 lines

Dedupe outcome: clean

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.