package-json-audit
Skill0 starsChanged 3 days agoMITView on GitHub
Audit a Node.js project's package.json and dependencies - missing or loose engines.node, missing, mixed or out-of-sync lockfiles (package-lock.json that would make npm ci fail), wildcard/latest/unbounded versions, git/URL dependencies on branches, curl|sh and sudo in npm scripts, postinstall hooks, nodemon/ts-node in start, dev tools and @types in dependencies, duplicates, deprecated packages (request, bull, csurf), accidental publishing, and installed packages that run install scripts - plus triage of `npm audit --json` (npm 7+ and npm 6/pnpm formats) into auto-fix, breaking upgrade, no-fix and dev-only groups. Use when the user asks to review package.json, fix npm audit warnings, harden the supply chain, prepare dependencies for production or CI, or asks "which of these vulnerabilities matter?".
- Pipes a download into a shell
- Reads credentials
- Installs packages
In this repository8 other files it gives its agents.
- AGENTS.mdAGENTS.md
- api-performanceSkill
- background-jobsSkill
- env-configSkill
- error-handling-patternsSkill
- logging-and-tracingSkill
- node-deploySkill
- node-security-reviewSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
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
- Very specific: line 24
Before publishing a package (accidental .env or test files in the tarball)
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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.
Files
package.json and dependency audit
Make dependency installs reproducible and safe, and turn a wall of npm audit output
into a short, ordered fix plan. Scripts are read-only; every npm command that changes
the lockfile is shown to the user first.
Paths below are relative to this skill's folder (in Claude Code: ${CLAUDE_SKILL_DIR}).
When to use
- "Review my package.json", "is this ready for production / CI?"
npm auditshows many vulnerabilities and the user wants to know what to do- Supply-chain hardening: lockfiles, install scripts, pinned versions,
npm ci - Before publishing a package (accidental
.envor test files in the tarball)
When not to use
- Vulnerabilities in the project's own code:
node-security-review - Container image CVEs (OS packages): use Trivy/Grype; base image choice is in
node-deploy - Choosing between libraries in depth: answer directly, this skill only flags risk
Workflow
- Locate packages. Monorepo? Run on the root and each workspace folder
(
packages/*/package.json). Note the package manager from the lockfile. - Audit package.json (read-only).
Exit 1 = findings at or abovepython3 scripts/audit_package_json.py . # root package python3 scripts/audit_package_json.py . packages/* --json # monorepo python3 scripts/audit_package_json.py . --node-modules # + installed packages with install scripts--fail-on(defaultmedium). Rule details and fixes: references/package-json-rules.md. - Get the vulnerability report (the user runs it, or you run it with permission; it
contacts the registry):
npm audit --json > audit.json npm audit --omit=dev --json > audit-prod.json # pnpm: pnpm audit --json > audit.json yarn berry: yarn npm audit --json (not supported here) - Triage.
Exit 1 when a non-dev package is at or abovepython3 scripts/triage_npm_audit.py audit.json --prod audit-prod.json python3 scripts/triage_npm_audit.py audit.json --min-severity moderate --json--fail-on(defaulthigh). - Decide per group (details in references/npm-audit-triage.md):
auto_fix: proposenpm audit fix(never--forcewithout discussion), run tests.major_upgrade: one branch per direct dependency; read its changelog/migration guide.no_fix: is the vulnerable function reachable? Options:overridesto a patched transitive version, replace the package, or a documented accepted risk with a review date.dev_only: lower priority, but CI runners hold secrets; do not ignore critical ones.
- Propose package.json edits as a diff (engines, ranges, moved deps,
private,packageManager) and the commands (npm i -D typescript,npm ci). Apply after approval. - Verify:
npm ci && npm test, re-run both scripts, show before/after counts.
Output
package.json audit: api - 2 high, 3 medium, 4 low
HIGH lockfile.missing commit package-lock.json, use npm ci in CI and Docker
HIGH dependencies.lodash 'latest' -> "^4.17.21"
MED dependencies.zod '^3.23.0' in package.json, '^3.22.0' in the lockfile -> npm install, commit both
MED scripts.start nodemon in production -> "node dist/server.js"
LOW dependencies.typescript move to devDependencies
npm audit: 6 vulnerable (2 critical, 1 high) -> plan
1. npm audit fix fixes lodash (high, direct)
2. Upgrade old-cli 2 -> 3 (breaking) fixes semver ReDoS
3. ip (critical, no fix, dev-only via socks): accept until <date>, track upstreamDoes 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
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.

