Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Npm Pro

ASecurity

Master npm: workspaces, lockfiles, scripts, publishing, provenance, and security hygiene. Use when managing JS dependencies with npm.

2 stars
0 votes
0 copies
0 views
Added 9/29/2026
ai-agentsrustgobashreactnodegitsecurity

Security Analysis

A92/100
mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned 9/29/2026

$npx -y skills add aicodedecode/awesome-muse-skills --skill npm-pro --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Npm Pro?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Npm Pro
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/aicodedecode-npm-pro/badge)](https://www.skillsdirectory.com/skills/aicodedecode-npm-pro)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: npm-pro
description: Master npm: workspaces, lockfiles, scripts, publishing, provenance, and security hygiene. Use when managing JS dependencies with npm.
category: development
---

# npm Pro

A practical guide to npm done well: workspaces, lockfile discipline, script conventions, safe publishing (provenance, 2FA, access tokens), and security hygiene — squeezing reliability out of the default package manager.

## Overview

npm ships with Node and remains the baseline every other manager is compared against. Its weaknesses are well-known (slower installs, flat `node_modules` allowing phantom deps), but with discipline — lockfiles committed, `ci` in pipelines, workspaces for monorepos, provenance for publishing — it's a perfectly solid choice, and its registry compatibility is universal.

## When to use

- Default choice for libraries (max compatibility with consumers' tooling).
- Small-to-medium projects where install speed isn't the bottleneck.
- Publishing packages to the npm registry.
- Teams that prefer zero extra tooling beyond Node.

## Core concepts

- **`package-lock.json`.** Commit it (apps *and* libraries — libraries benefit too for reproducible dev/CI). `npm ci` installs exactly from the lockfile; `npm install` may update it.
- **Workspaces.** `workspaces: ["apps/*", "packages/*"]` in root package.json; `npm run build -w web` / `--workspace`; `npm run test --workspaces` for all.
- **Scripts.** `pre`/`post` hooks, `npx` for one-off binaries. Keep scripts composable (`build` calls `build:types`, `build:js`).
- **Provenance.** `--provenance` on publish attests the package was built in CI from a specific commit — verifiable supply-chain metadata. Enable it.
- **Access control.** Scoped packages default to restricted; `--access public` for open-source. 2FA required for publishing on accounts (use it; automation via granular tokens).
- **`overrides`.** Force dependency versions (CVE fixes, dedupe). Powerful, temporary by intent — revisit regularly.
- **`npm audit` / `npm audit fix`.** Vulnerability scanning; `fix` bumps within semver ranges. For major bumps, do it deliberately.

## Practical workflow

**1. Setup.**
```bash
npm init -y
# package.json: "packageManager": "npm@10.x" (corepack pin)
npm install --save-exact   # or configure save-exact=true to avoid ^ drift
```

**2. Daily commands.**
```bash
npm ci                       # CI / clean installs (fast, deterministic)
npm install lodash           # add (updates lockfile)
npm uninstall lodash
npm update                   # bump within semver ranges
npm dedupe                   # flatten duplicates
npm ls react                 # inspect why a version is present
npm explain lodash           # dependency chain detail
npm outdated                 # what can be bumped
npx tsc --noEmit             # run a binary without installing
```

**3. Workspaces.**
```bash
npm run build --workspace=packages/ui
npm run test --workspaces --if-present
npm exec --workspace=apps/web -- eslint src
```

**4. Publishing a library.**
```bash
npm version patch            # bump + tag
npm publish --provenance --access public
```
Pre-publish checklist: `files` field set (don't ship tests/config), `.npmignore`/`.gitignore` sane, `npm pack --dry-run` to inspect the tarball, README documents install + usage.

**5. CI.**
```yaml
- run: npm ci
- run: npm run lint && npm run test --workspaces --if-present
- run: npm publish --provenance   # on release tags only
```

## Common pitfalls

- **`npm install` in CI.** Slow and non-deterministic vs the lockfile. `npm ci` always in CI.
- **Uncommitted lockfile.** "Works on my machine" across the team. Commit `package-lock.json`, always.
- **Phantom dependencies.** Flat `node_modules` lets you import undeclared packages — works locally, breaks for consumers or under stricter managers. Declare everything you import.
- **Publishing too much.** Shipping `src`, tests, and configs bloats installs. Use `files: ["dist"]` and verify with `npm pack --dry-run`.
- **No 2FA / long-lived tokens in CI.** Use granular access tokens with publish-only scope, stored as CI secrets; enable 2FA on the account.
- **`latest` dist-tag accidents.** Publishing a beta as `latest` upgrades everyone unintentionally. Use `--tag beta` for prereleases.
- **Ignoring `npm audit`.** Run it in CI; triage highs/criticals. `audit fix` first, manual bumps for the rest.
- **Postinstall scripts from deps.** A supply-chain risk vector. Review new dependencies' install scripts; consider `--ignore-scripts` with explicit allowlists for trusted packages.
- **Version drift via `^`.** `^1.2.3` floats within majors — fine for apps with lockfiles, surprising for libraries' consumers. `save-exact` for apps; thoughtful ranges for libraries.

Attribution

aicodedecodeaicodedecode
View sourceSee grades on GitHubMore from aicodedecode →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698621 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →