agentleFS
G1JoshiG1Joshi/Agent-Skills/skills/devops/npm/SKILL.md

npm

Skill15 starsChanged 42 days agoMITView on GitHub

Expert npm package manager assistance covering package.json, lockfiles, workspaces (monorepos), scripts, and security audits. Use when managing JavaScript/Node.js dependencies and publishing packages.

  • Installs packages

7 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use frontend-design.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • BlockSkill

    frontend-design

    Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 0 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 7 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use native npm workspaces in root package.json:

    line 81
  2. Very specific:

    Always use npm ci in CI/CD pipelines instead of npm install to enforce exact lockfile dependencies.

    line 99
  3. Very specific:

    Use overrides in root package.json to resolve security vulnerabilities in deep transitive dependencies.

    line 101
  4. Very specific:

    Commit package-lock.json to version control in all projects.

    line 102
  5. Very specific:

    Use npm install --force or --legacy-peer-deps in production builds.

    line 106

“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

npm

npm is the default package manager for Node.js, providing dependency resolution, workspace management, security auditing, and publishing workflows for JavaScript ecosystems.

When to Use

  • JavaScript / TypeScript Package Management: Installing, publishing, and managing npm modules and dependencies.
  • Multi-Package Monorepos (npm Workspaces): Coordinating interconnected local packages with unified dependency resolution.
  • Supply Chain Security & Provenance: Publishing packages with cryptographically verifiable build provenance.
  • Vulnerability Auditing & Dependency Overrides: Resolving transitively vulnerable packages using overrides.

Quick Start

npm init -y
npm install lodash
npm install --save-dev jest

# Monorepo
npm init -w packages/my-lib

Core Concepts

Configuring npm Workspaces in Monorepos

Declaring multi-package structures in root package.json:

{
  "name": "enterprise-monorepo",
  "private": true,
  "workspaces": ["packages/*", "apps/*"],
  "scripts": {
    "build": "npm run build --workspaces --if-present",
    "test": "npm test --workspaces --if-present"
  },
  "overrides": {
    "glob": "^10.4.0",
    "semver": "^7.6.0"
  }
}

Clean Installations & Deterministic Lockfiles

Installing dependencies in continuous integration:

# Clean install adhering strictly to package-lock.json (never mutates lockfile)
npm ci

# Audit dependencies for known CVEs
npm audit --audit-level=high

# Run targeted script across all workspaces
npm run test --workspace=packages/core-utils

Publishing Packages with Cryptographic Provenance

Publishing to the npm registry with supply-chain verification:

# Publish package with Sigstore verifiable provenance
npm publish --access public --provenance

Common Patterns

Monorepo Workspaces Configuration

Problem: Managing shared libraries across multiple internal packages without publishing to external registries.

Solution: Use native npm workspaces in root package.json:

{
  "name": "my-monorepo",
  "private": true,
  "workspaces": ["packages/*", "apps/*"],
  "scripts": {
    "build": "npm run build --workspaces --if-present",
    "test": "npm test --workspaces"
  }
}

Best Practices

Do:

  • Always use npm ci in CI/CD pipelines instead of npm install to enforce exact lockfile dependencies.
  • Publish public packages with --provenance to establish cryptographic build transparency.
  • Use overrides in root package.json to resolve security vulnerabilities in deep transitive dependencies.
  • Commit package-lock.json to version control in all projects.

Don't:

  • Use npm install --force or --legacy-peer-deps in production builds; resolve peer version conflicts cleanly.
  • Publish packages containing sensitive files; maintain an explicit .npmignore or "files" whitelist.
  • Execute untrusted scripts during install without verifying packages (npm install --ignore-scripts).

Troubleshooting

ErrorCauseSolution
npm ERR! code ERESOLVE: could not resolve dependencyPeer dependency version conflict.Run npm install --legacy-peer-deps or align conflicting package versions.
npm ERR! code EACCES: permission deniedInstalling global packages without permissions on system node directory.Configure user npm prefix: npm config set prefix ~/.npm-global.
package-lock.json out of syncDependencies installed with different npm major versions.Delete node_modules and run npm ci for strict deterministic installs.

References

Download now (ZIP)

Does 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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.