Npm Security Best Practices
Hardened npm and pnpm configuration guidance that blocks lifecycle scripts, git dependencies, and freshly published packages.
- CCM score
- 46 of 100
- skills.sh installs
- 770
- GitHub stars
- 13
- last updated
- Jul 14, 2026
Own this skill? Claim it
What it does
- Covers secure-by-default
.npmrc,pnpm-workspace.yaml, and BuntrustedDependenciessettings for supply chain attack prevention - Includes secure install commands,
@lavamoat/allow-scriptsallowlisting, hardenednpxusage, and scoped registries against dependency confusion - Enforces a 30-day minimum release age,
ignore-scripts, andallow-git=noneas the baseline configuration - Designed for Node.js teams that want to audit npm, pnpm, and Bun dependency installs alongside tools like npq and Socket
Install
$ npx -y skills add reason-machines/security-skills --skill npm-security-best-practices -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
npm Security Best Practices
Skill by ara.so — Security Skills collection.
This skill provides expert guidance on securing npm package installations, preventing supply chain attacks, and implementing security best practices for Node.js development. Based on the comprehensive npm-security-best-practices repository by Lirantal.
Overview
The npm ecosystem is a frequent target for supply chain attacks including:
- Shai-Hulud attacks - Worm-like propagation through compromised packages
- Nx incident - Malicious code in postinstall scripts
- event-stream attack - Long-running exfiltration via lifecycle scripts
- Dependency confusion - Attackers publishing malicious packages with internal names
This skill covers configuration, tooling, and practices to mitigate these risks across npm, pnpm, and Bun.
Secure-by-Default Configuration
npm (.npmrc)
Create or update .npmrc in your project root or global config (~/.npmrc):
# Disable all lifecycle scripts (postinstall, preinstall, etc.)
ignore-scripts=true
# Block git-based dependencies (git+ssh://, git+https://, etc.)
allow-git=none
Details
- Repository
- github.com/reason-machines/security-skills
- Categories
- Security, DevOps & Cloud
- First seen
- Jul 14, 2026
Questions
What does the npm-security-best-practices skill do?
It gives expert guidance on securing npm packages, preventing supply chain attacks, and hardening npm, pnpm and Bun configurations. It covers settings such as ignore-scripts, allow-git and minimum release age, plus tools like npq and Socket Firewall.
How do I install the npm-security-best-practices skill?
Run npx -y skills add reason-machines/security-skills --skill npm-security-best-practices -y inside your project. Once installed, the agent can apply npm security settings and install hardening steps to your Node.js project.
Where does npm-security-best-practices stand in the Security category?
It sits in the Security category on Claude Marketplaces, alongside skills such as security-audit and cloudflare-one. It focuses specifically on npm dependency risk, covering postinstall scripts, git-based dependencies and dependency confusion.
Which npm attacks does this skill help protect against?
It addresses supply chain attacks like the Shai-Hulud worm, the Nx incident, the event-stream attack and dependency confusion. It shows how to block malicious lifecycle scripts and reduce exposure to newly published packages.
More from reason-machines/security-skills
All 58- Malware Awareness Bitdefender Crack Fraud767
- Security Detections Mcp754
- Malware Repository Warning748
- Malware Detection And Reporting747
- Malware Analysis Warning731
- Malware Distribution Awareness717
- Kali Pentest Ai Agent697
- Bitdefender Malware Analysis686
- Skill File Security681
- Bitdefender Malware Investigation677
- Zen Ai Pentest Framework676
- Edgesecurityaccess Wireguard Vpn670
- Sparkfinderoven Security Compliance Skills661
- Securityclaw Autonomous Soc Agent659
- Security Compliance Skills Suite Claude652
- Pentestify Security Report Generator639
- Awesome Claude Code Security Compliance Suite633
- Sparkfinderoven R01 Security Compliance Skills630
- Sparkfinderoven Claude Security Compliance Suite625
- S800 Vehicle Network Security Testing623
- Sparkfinderoven Security Compliance Suite622
- Esaa Security Audit617
- Foundry Security Spec586
- Anthropic Cybersecurity Skills1.3K
Similar to Npm Security Best Practices
More Securitydependency-upgradesecondsky/claude-skills426 installsSecure dependency upgrades that enforce package cooldowns, blocked install scripts, and frozen lockfiles across major package managers.
dependency-auditoronewave-ai/claude-skills337 installsAudit npm, pnpm, and Yarn dependencies for vulnerabilities, outdated packages, and unused code.
pnpmmindrally/skills774 installsBest practices for pnpm workspaces, filtered commands, and strict dependency isolation in monorepos.
openclaw-security-hardeningreason-machines/security-skills971 installsDeployment guide and defense matrix for high-privilege OpenClaw AI agents, with red/yellow line rules and nightly audits.
report-malicious-repositoryreason-machines/security-skills927 installsGuide for spotting and reporting malicious repositories that pose as cracked or pirated security software.