agentleFS
ZmokiZmoki/zmoki-astro-starter/.claude/skills/update-deps/SKILL.md

update-deps

Skill4 starsChanged 5 months agoMITView on GitHub

Update project dependencies (npm packages + GitHub Actions) safely, in staged and separately-verified commits. Use when the user wants to upgrade, bump, or update dependencies.

  • Deletes or force-pushes
  • Installs packages
  • Commits and pushes

10 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 3 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 10 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use a global override when the package reaches the tree through only one parent (confirm with npm ls <pkg> — one chain = safe to force …

    line 67
  2. Distinctive:

    Ask the user how far to go: safe-only, safe + specific majors, or everything.

    line 93
  3. Very specific:

    After a satori, @resvg/resvg-js, or culori bump, run npm run build and open a couple of dist/og/.png — confirm the cards still render with …

    line 127
  4. Distinctive:

    Commit the regenerated lock.

    line 146
  5. Distinctive:

    After bumping the floor, grep to confirm nothing drifted:

    line 179
  6. Very specific:

    not: run remark/rehype plugins.

    line 207
  7. Very specific:

    @lhci/cli audit noise (dev-only): Every npm audit finding and most deprecation warnings in this repo trace to @lhci/cli (Lighthouse CI) …

    line 223

“Common” is measured: kept by at least 6 in 10 of the 10 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

Update dependencies

Bump dependencies in staged, separately-committed steps, verifying at each step, so a regression is easy to bisect and revert. Never bump everything in one shot.

0. Baseline

Work on a branch (or a dedicated worktree). Ensure a clean tree, install, and confirm the project is green before changing anything — otherwise you can't tell what your changes broke:

npm install
npm run build && npm run check && npm run lint && npm run format:check
npm audit   # record the starting vulnerability count, so you know what you fixed

1. Categorize

npm outdated

Split the results into two buckets:

  • Safe — the Wanted column (within the current semver range). Low risk.
  • Major — Latest > Wanted (a new major). Breaking; handle one at a time.

2. Security audit

A dependency pass is also the moment to clear (or at least assess) security advisories and the npm warn deprecated … noise you saw on install.

npm audit

Never run npm audit fix --force blind. Its "fix" is frequently a downgrade to an ancient major — npm will cheerfully propose @lhci/cli@0.1.0 (15 majors back), which breaks the tool for zero real gain. Read each advisory and decide deliberately.

Triage each finding by where the vulnerable package sits — npm ls <pkg> shows the parent chain:

  1. Direct dep, forward fix exists — bump it like any other update (sections below). Prefer this.
  2. Transitive dep, parent has a newer release — bump the parent; the fix flows down.
  3. Transitive dep, no forward fix (the parent is already latest and still ships the vulnerable version) — pin the patched version with an overrides block in package.json, then reinstall and re-audit:

    // package.json — sits next to "devDependencies"
    "overrides": {
      "tmp": "^0.2.7",
      "uuid": "^11.1.1"
    }

    Use a global override when the package reaches the tree through only one parent (confirm with npm ls <pkg> — one chain = safe to force globally); scope it ("parent": { "pkg": "…" }) when other consumers still need the old version. An override force-changes a transitive package across a major boundary, so verify the owning tool still runs — npm audit going to 0 is necessary but not sufficient; the bump could break the consumer at runtime. For @lhci/cli, npx lhci healthcheck is the cheap end-to-end check.

Weigh the blast radius. A vuln in a dev/CI-only tool (Lighthouse, Prettier, ESLint) never reaches visitors — treat it differently from one in a runtime dependency. Fix what's cheap and safe; don't force a risky override on a dev tool for a local-only, never-shipped issue. Commit any overrides change on its own (fix(deps): …) so it's easy to bisect.

Deprecation warnings are not vulnerabilities

The npm warn deprecated … lines on install are maintainer notices ("no longer supported", "leaks memory"), not advisories. Trace each to its parent (npm ls <pkg>). If it's a transitive dep of a tool you can't move — the parent still requires the old version — the warning is cosmetic; leave it until upstream updates rather than forcing an override that risks breaking the parent at runtime. Only chase one when it carries a matching npm audit advisory, or the parent is your own direct dep.

3. Confirm scope

Ask the user how far to go: safe-only, safe + specific majors, or everything. Majors can be large migrations — don't assume.

4. Stage the work — one commit per bump

For safe updates (all at once is fine):

npm update
npm run build && npm run check && npm run lint
git commit -am "chore(deps): apply safe within-range dependency updates"

For each major, separately:

  1. Research the breaking changes first — read the official upgrade guide (fetch it). Don't trust memory for versions newer than your cutoff.
  2. npm install <pkg>@^<major> (install coupled packages together — see below).
  3. Apply the code/config migration.
  4. Verify (section 5), then commit with a message explaining what broke and how you migrated it.

5. Verification gates (every stage)

  • npm run build — must produce output; a green build alone isn't proof.
  • npm run check (astro type check) and npm run lint.
  • npm run format — the Tailwind + astro Prettier plugins re-sort/reflow; run it so format:check (CI) passes. Expect wide class-reorder diffs after a Tailwind bump — that's cosmetic, not functional.
  • Runtime, not just a green build: start npm run preview (and npm run dev — the Vite dev path differs) and curl real pages. Confirm the stylesheet links and serves, and that content-pipeline output is intact (copy buttons data-copy-button, external-link data-external, shiki astro-code). See the /run skill.
  • After a satori, @resvg/resvg-js, or culori bump, run npm run build and open a couple of dist/og/**.png — confirm the cards still render with the brand colors, fonts, and text (a broken font/color pipeline still "builds" but produces blank or black cards). See src/og/.

6. Lockfile hygiene (critical for CI)

Incremental npm install calls can leave package-lock.json missing cross-platform optional deps (e.g. Tailwind 4 pulls @tailwindcss/oxide native/wasm bindings + @emnapi/*). CI's npm ci validates the lock strictly and fails with EUSAGE … Missing: <pkg> from lock file. After the majors, regenerate cleanly and validate the way CI does:

rm -rf node_modules package-lock.json
npm install
npm ci        # must succeed — this is exactly what CI runs

Commit the regenerated lock.

7. GitHub Actions

Workflow actions are dependencies too, and pinned by major tag. Check them:

grep -rn "uses:" .github/workflows/
for a in actions/checkout actions/setup-node actions/upload-artifact actions/github-script; do
  echo "$a -> $(gh api repos/$a/releases/latest --jq .tag_name)"
done

Bump each uses: <action>@vN to the latest major. For github-script, skim the inline script: — v8/v9 keep github.rest.*, context.*, and require, so stable scripts carry over.

Node version — keep three files in sync

The Node major is pinned in three places that must move together whenever you bump the engines floor:

  • package.json engines.node (e.g. ">=24") — the declared floor.
  • .github/workflows/*.yml node-version: (ci.yml + lighthouse.yml) — CI.
  • .node-version (repo root, e.g. 24.11.1) — Cloudflare Pages, the deploy builder. This is the easy one to forget: Cloudflare reads neither engines nor the CI workflow, so if it's missing/stale the build falls back to an older default Node. That bit us once — Cloudflare ran Node 22, which can't execute the .ts build scripts natively (node scripts/generate-redirects.ts in prebuild), and the deploy died with ERR_UNKNOWN_FILE_EXTENSION even though CI was green. The build scripts are .ts and rely on Node ≥24's native type-stripping — so the deploy Node version is load-bearing, not cosmetic.

After bumping the floor, grep to confirm nothing drifted:

grep -H node .node-version; grep -n '"node"' package.json; grep -rn node-version .github/workflows/

8. PR + watch CI

git push -u origin <branch>
gh pr create --base main --title "chore(deps): …" --body "…"
gh pr checks <PR#> --watch --interval 15

Both ci and lighthouse must go green. If ci fails in seconds at "Install dependencies", it's the lockfile — go back to section 6.

Worktree caveat: gh pr merge --delete-branch fails with 'main' is already used by worktree because the primary checkout holds main. The merge still lands on GitHub; just delete the branch manually afterward: git push origin --delete <branch>.

Project-specific migration notes

Discovered during the Astro 7 / Tailwind 4 / Puppeteer 25 upgrade — check these if bumping past those majors:

  • Astro 7 markdown defaults to the new Sätteri processor, which does not run remark/rehype plugins. This project depends on custom rehype plugins, remarkRehype handlers, and shiki, so it opts back into the unified pipeline: npm i @astrojs/markdown-remark, then markdown.processor: unified() in astro.config.mjs. Keep it unless you port the plugins.
  • Astro Content Layer replaced the legacy type: "content" collections API. Config lives at src/content.config.ts with glob() loaders (astro/loaders); entries use .id (not .slug) and render(entry) from astro:content (not entry.render()). entry.body is now string | undefined — guard it.
  • Tailwind 4 drops the @astrojs/tailwind integration (which also caps Astro at 5) — use the @tailwindcss/vite plugin in astro.config.mjs. Astro 7 and Tailwind 4 are therefore coupled — bump them together. Styles enter via src/styles/global.css (@import "tailwindcss") imported in BaseLayout and BrandLayout. The v3-style tailwind.config.mjs is kept via the @config directive; the JS safelist is gone — use @source inline("…") for classes the scanner can't see (the rehype-injected copy-button classes). Verify the brand color page renders: /-/astro/brand/color/.
  • @lhci/cli audit noise (dev-only). Every npm audit finding and most deprecation warnings in this repo trace to @lhci/cli (Lighthouse CI) and its Lighthouse sub-deps — tmp, uuid, inquirer, and chrome-launcher → rimraf → glob → inflight. It's already on the latest version, so there's no forward fix, and npm audit fix --force would downgrade it to 0.1.0. The overrides block (tmp → ^0.2.7, uuid → ^11.1.1) clears all of the advisories; confirm with npx lhci healthcheck. The residual inflight/rimraf@3/glob@7 deprecation warnings come from chrome-launcher, carry no advisory, and are left as-is — forcing rimraf@4+ (callback API removed) would break chrome-launcher's temp-profile cleanup for no security gain.

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.