skills/npm-supply-chain-security/SKILL.md
Audit and harden Node.js projects against npm supply chain attacks — compromised maintainer accounts, malicious package versions, and install-script payloads. Use when reviewing or setting up package.json, lockfiles, .npmrc, Dockerfile, or CI workflows for security; when the user mentions npm security, supply chain attacks, `npm audit`, lockfile policy, install scripts, or min-release-age; also when the user wants to check whether their dependencies are safe, or recover from a suspected compromise.
npx skillsauth add nbbaier/agent-skills npm-supply-chain-securityInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Adapted from NPM Security Best Practices for Supply Chain Attacks by Localcan.
Defends against three concrete attack patterns: zero-day malicious publishes (a compromised maintainer pushes a backdoored version), install-script payloads (lifecycle scripts run arbitrary code on install), and resolution drift (npm install picks up a newer-than-locked version). Controls operate at three layers — resolution (versions entering the lockfile), installation (lifecycle scripts), and execution environment (what the build can reach).
npm-primary; pnpm and bun equivalents are noted inline. Full per-PM detail in REFERENCE.md.
Apply the 30-minute baseline:
Commit the lockfile (package-lock.json / pnpm-lock.yaml / bun.lock).
Add an install cooldown — min-release-age=1 in .npmrc (npm 11+), or minimumReleaseAge: 1 in pnpm-workspace.yaml (pnpm 10.16+). Bun has no native equivalent — this is a real gap, since bun install re-resolves locally and bypasses any PR-layer cooldown. Configure Dependabot or Renovate cooldown as a partial mitigation for the update-PR path.
In CI/Dockerfile, install with frozen lockfile and --ignore-scripts:
npm ci --ignore-scriptspnpm install --frozen-lockfile --ignore-scriptsbun install --frozen-lockfile --ignore-scriptsAllow-list required native modules with a follow-up npm rebuild <pkg> (e.g. sharp, better-sqlite3).
Digest-pin base images: FROM node:24-alpine@sha256:..., not FROM node:24-alpine.
Add an audit step to CI: npm audit --audit-level=high (or pnpm audit / bun audit).
Put package.json, the lockfile, .npmrc, and Dockerfile under CODEOWNERS with required review.
Run the audit script (lives at scripts/audit.sh in this skill directory) from the target project's root:
bash <path-to-this-skill>/scripts/audit.sh
It detects the package manager, checks each baseline item, and prints PASS/FAIL/WARN. Treat each FAIL as a TODO; WARN items need human judgment.
Walk the user through the 30-minute checklist in order. Two recurring gotchas:
--ignore-scripts belongs in CI commands, not project-level .npmrc. Local dev often needs install scripts to compile native modules.--ignore-scripts globally.If a malicious version may have been installed:
npm ci from there.npm ls <bad-pkg> shows every dependency path. For multi-repo orgs, search across all lockfiles.This skill covers the install side — protecting your project from compromised upstream packages. If the user is also publishing packages to npm, point them at the publishing-side controls (separate concern, not audited here):
npm publish --provenance) so consumers can verify the build origin.See REFERENCE.md for per-control rationale, per-PM syntax, and incident background.
development
Ideate and critique data visualizations using Edward Tufte's principles from "The Visual Display of Quantitative Information." Use this skill when: (1) Designing new data visualizations or charts (2) Critiquing or improving existing visualizations (3) Reviewing dashboards or reports for graphical integrity (4) Deciding between visualization approaches (5) Reducing chartjunk or improving data-ink ratio (6) Planning small multiples or high-density displays Applies principles: data-ink ratio, chartjunk elimination, graphical integrity, lie factor, small multiples, and data density.
tools
Manage Val Town projects using the vt CLI. Use when working with Vals (Val Town serverless functions), syncing code to Val Town, creating HTTP endpoints, streaming logs, or managing Val Town branches. Triggers on tasks involving Val Town development, val creation/editing, or when user mentions "vt", "val town", or "vals".
development
Guidelines for proper React useEffect usage and avoiding unnecessary Effects. Use when writing, reviewing, or refactoring React components that use useEffect, useState, or handle side effects. Triggers on tasks involving React Effects, derived state, event handlers, data fetching, or component synchronization.
tools
Use before implementing logs in a medium to large scale production system.