npm-security-best-practices — Claude Code skill: security and install
Guides npm dependency hardening, supply-chain attack prevention, and safer package-manager settings. Useful when reviewing Node.js installs.
npx skills add reason-machines/security-skills --skill npm-security-best-practices -a claude-codeWhat npm-security-best-practices does
This skill covers npm package security, package-manager configuration, and ways to reduce supply-chain attack risk. It explains how to disable lifecycle scripts, block git dependencies, enforce release-age checks, and allow build scripts only for selected packages.
The material includes npm, pnpm, and Bun examples, plus workflows for npx, @lavamoat/allow-scripts, npq, Socket Firewall, and Snyk. It also covers .npmrc, pnpm-workspace.yaml, package.json, lockfiles, Renovate, and Dependabot. Some checks require the relevant CLI tools and Snyk authentication.
The practical tradeoff is clear: disabling scripts can break packages that need a build step, so review the allowlist before applying the settings.
What it helps with
- harden npm dependency installation
- block lifecycle scripts and git dependencies
- check a package before adding it
- delay adoption of newly released versions
- review suspicious lockfile changes
Example prompts for the agent
- Review this project’s npm setup and propose a safer
.npmrcthat disables scripts and blocks git dependencies. - Show how to install a package securely with
npm,pnpm, andnpx, including supply-chain checks. - Set up selective build-script permissions with
@lavamoat/allow-scriptsand explain which packages need approval.
How to install npm-security-best-practices
1Skills CLI (Vercel)
npx skills add reason-machines/security-skills --skill npm-security-best-practices -a claude-code2Manually: put the files in place
~/.claude/skills/npm-security-best-practices/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/npm-security-best-practices/
1Skills CLI (Vercel)
npx skills add reason-machines/security-skills --skill npm-security-best-practices -a codex2Manually: put the files in place
.agents/skills/npm-security-best-practices/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add reason-machines/security-skills --skill npm-security-best-practices -a cursor2Manually: put the files in place
.cursor/skills/npm-security-best-practices/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install reason-machines/security-skills npm-security-best-practices2Manually: put the files in place
.github/skills/npm-security-best-practices/SKILL.md1Skills CLI (Vercel)
npx skills add reason-machines/security-skills --skill npm-security-best-practices -a gemini-cli2Platform CLI
gemini skills install https://github.com/reason-machines/security-skills --path skills/npm-security-best-practicesManually: put the files in place
.devin/skills/npm-security-best-practices/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add reason-machines/security-skills --skill npm-security-best-practices -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about npm-security-best-practices
How do I install npm-security-best-practices in Claude Code?
Run npx skills add reason-machines/security-skills --skill npm-security-best-practices -a claude-code, then run the same command again: npx skills add reason-machines/security-skills --skill npm-security-best-practices -a claude-code. The skill file is located at ~/.claude/skills/npm-security-best-practices/SKILL.md.
What does npm-security-best-practices do?
It guides the agent through safer npm, pnpm, and Bun configuration, supply-chain risk reduction, and dependency-script control. It also covers checks with npq, Socket Firewall, and Snyk.
What should I check before disabling install scripts?
ignore-scripts=true blocks lifecycle scripts. Packages such as esbuild may need explicit approval through allowBuilds or trustedDependencies, so review those exceptions before applying the policy.