Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

npm

$ npm Official Med Risk
npm / GitHub · Code & DevOps · Artistic-2.0 · macos / linux / windows

The standard CLI bundled with Node.js for managing package.json, package-lock.json, scripts, and registries. Offers rich --json support across ls, outdated, audit, view, install --dry-run, and publish --dry-run, plus --ignore-scripts and npm ci for deterministic installs.

FCRS-1.0 Score
84 /100
Good
High Confidence
Zero-Friction Install
npm install -g npm
CLI vs MCP Decision CLI Only

Direct local Node.js package and script runner tightly bound to node_modules and package-lock.json.

Agent-Readiness Checklist

Local Probe Evidence
✓ JSON Output
— Field Filtering
✓ Non-Interactive
✓ Dry-Run
— Read-Only Mode
✓ NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md
Version
11.19.1
Startup
101 ms
Exit Codes (help / invalid)
1 / 1
NO_COLOR Clean / Non-TTY Safe
Yes / Safe
Captured --help excerpt
npm <command>

Usage:

npm install        install all the dependencies in your project
npm install <foo>  add the <foo> dependency to your project
npm test           run this project's tests
npm run <foo>      run the script named <foo>
npm <command> -h   quick help on <command>
npm -l             display usage info for all commands
npm help <term>    search for help on <term>
npm help npm       more involved overview

All commands:

    access, adduser, approve-scripts, audit, bugs, cache, ci,
    completion, config, dedupe, deny-scripts, deprecate, diff,
    dist-tag, docs, doctor, edit, exec, explain, explore,
    find-dupes, fund, get, help, help-search, init, install,
    install-ci-test, install-scripts, install-test, link, ll,
    login, logout, ls, org, outdated, owner, pack, ping, pkg,
    prefix, profile, prune, publish, query, rebuild, repo,
    restart, root, run, sbom, search, set, shrinkwrap, stage,
    star, stars, start, stop, team, test, token, trust,
    undeprecate, uninstall, unpublish, unstar, update, version,
    view, whoami

Specify configs in the ini-formatted file:
    /Users/pcyan/.npmrc
or on the command line via: npm <command> --key=value

More configuration info: npm help config
Configuration fields: npm help 7 config

[email protected] /opt/homebrew/Cellar/node@24/24.22.0/lib/node_modules/npm

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 19 / 25

Broad --json support across ls, audit, outdated, view, install, and publish, plus --dry-run, --no-color, --no-fund, and -y.

  • Native --json and --dry-run on core commands
  • Deterministic npm ci mode
Trust & Safety 19 / 25

Supports --dry-run and --ignore-scripts, though default npm install runs arbitrary preinstall/postinstall package scripts unless blocked.

  • Lifecycle script execution risk mitigated by --ignore-scripts
Setup & Portability 14 / 15

Pre-bundled with every Node.js installation across macOS, Linux, and Windows.

  • Bundled by default with Node.js
Utility & Efficiency 14 / 15

Universal Node.js ecosystem package manager and script runner (npm run, npm exec).

  • Standard registry and workspace tooling
Maintenance & Lineage 10 / 10

Official GitHub/npm CLI (npm/cli) maintained under Artistic-2.0.

  • Official npm/cli repository
Docs & Verifiability 8 / 10

Complete command manuals at docs.npmjs.com and npm help <cmd>.

  • Official documentation at docs.npmjs.com/cli

Security, Auth & Guardrails

Auth Modes
No Auth Config File Env API Key
Credential Storage

Reads registry tokens from ~/.npmrc (_authToken) or NPM_TOKEN environment variables; local reads need no auth.

Side Effects
Read-Only Local Write Remote Write
Cost & Quotas

Artistic-2.0 open-source CLI; public npm registry reads and open-source publishing are free.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# npm Agent Rules
- Prefer `npm ci --ignore-scripts` over `npm install` on existing repos to avoid lockfile drift and untrusted `postinstall` scripts.
- Always preview with `npm publish --dry-run` and never publish without explicit user confirmation.

Agent-Ready Command Recipes

Safe Read-Only Queries

Inspect dependency tree and vulnerabilities as JSON
npm ls --depth=0 --json && npm audit --json

Exports top-level installed dependencies and security advisories as structured JSON.

Preview package installation without writing disk
npm install --dry-run --json

Simulates dependency resolution and reports planned adds/updates in JSON.

Controlled Writes & Previews

Clean lockfile install without lifecycle scripts
npm ci --ignore-scripts --no-audit --no-fund

Reproduces node_modules strictly from package-lock.json while blocking postinstall script execution.

Strengths for Agents

  • + --json and --dry-run work consistently across inspection, install, and publish flows.
  • + Bundled with Node.js everywhere with npm ci for deterministic lockfile installs.

Caveats & Pitfalls

  • ! npm install executes postinstall lifecycle scripts by default unless --ignore-scripts is passed.
  • ! Slower disk installs and looser node_modules isolation than pnpm.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI