# check-npm

Reads a JS/TS repo's package manager config and flags supply-chain gaps: tool version, lifecycle scripts, unsafe dependency protocols and release age.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 2800 installs · ★ 290
- Author: grafana
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/grafana/skills/tree/HEAD/skills/grafana-plugins/check-npm/SKILL.md
- Updated: 2026-10-25
- HTML: https://affpapa.org/en/nevibecode/skills/check-npm

## What it does

The skill audits the workspace root and touches nothing. It first works out which package manager you use: the `packageManager` field in `package.json`, then a lockfile, otherwise npm. No `package.json` means it stops right there.

Four checks follow. The tool version has to clear a threshold: npm 11.15.0, yarn 4.14.0, pnpm 11.0.0. Then it looks for disabled lifecycle scripts — `ignore-scripts=true` on npm, `enableScripts: false` on yarn, `strictDepBuilds` on pnpm. Manifests get scanned for unsafe protocols: git URLs, tarballs, `file:`, `link:` and the rest. The last check is a minimum release age of 3 days, or 4320 minutes.

You get a table of `PASS` and `FAIL` rows plus paste-ready config snippets for every failure. One thing to watch: pnpm 11 and later ignore script settings in `.npmrc` and `package.json#pnpm`, so those lines do nothing there. When everything passes, the skill says so and stops.

## Requirements
- Works with: Grafana

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add grafana/skills --skill check-npm -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/check-npm/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/check-npm/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add grafana/skills --skill check-npm -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/check-npm/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add grafana/skills --skill check-npm -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/check-npm/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install grafana/skills check-npm
```

2. **Manually: put the files in place**
- File: `.github/skills/check-npm/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add grafana/skills --skill check-npm -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/grafana/skills --path skills/grafana-plugins/check-npm
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/check-npm/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add grafana/skills --skill check-npm -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/grafana/skills/tree/HEAD/skills/grafana-plugins/check-npm/SKILL.md

## When to use it
- confirm dependency lifecycle scripts are turned off
- spot git URLs and tarballs hiding in dependencies
- check that npm or pnpm meets the minimum version
- set a 3-day minimum release age
- grab ready config lines for whatever failed

## Example prompts
- audit this repo's npm config for supply-chain risks
- run the package manager audit and show me the PASS/FAIL table
- check whether lifecycle scripts are disabled and whether any git dependencies exist

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: c2288f53e0d95b12.

BEGIN THIRD-PARTY FILE c2288f53e0d95b12
````text
---
name: check-npm
license: Apache-2.0
disable-model-invocation: false
description: >-
  Audit a JavaScript/TypeScript repo's npm, yarn, or pnpm configuration for
  supply-chain hardening: tool version, lifecycle scripts, unsafe dependency
  protocols, and minimum release age ≥3 days. Use when the user invokes
  /check-npm or asks to audit package manager security, lifecycle scripts, git
  dependencies, ignore-scripts, min-release-age, allow-git,
  approvedGitRepositories, strictDepBuilds, or blockExoticSubdeps in a Grafana
  plugin or JS/TS project.
---

# npm / yarn / pnpm supply-chain audit

Read-only audit of the workspace root. Do not modify any files.

## 0. Detect package manager

```bash
test -f package.json || { echo "STOP: no package.json at workspace root"; exit 1; }
jq -r '.packageManager // "unset"' package.json
ls -1 yarn.lock package-lock.json pnpm-lock.yaml 2>/dev/null || true
```

If no `package.json`, stop. Priority: `packageManager` → lockfile → default npm.

## 1. Tool version

```bash
npm --version    # required ≥ 11.15.0
yarn --version   # required ≥ 4.14.0
pnpm --version   # required ≥ 11.0.0
```

Use semver comparison. Verify pinned `packageManager` meets threshold.

| Manager | Minimum |
|---------|---------|
| npm | 11.15.0 |
| yarn | 4.14.0 |
| pnpm | 11.0.0 |

## 2. Lifecycle scripts disabled

```bash
grep -E '^ignore-scripts=' .npmrc 2>/dev/null
grep -E 'enableScripts:' .yarnrc.yml 2>/dev/null
grep -E 'strictDepBuilds:|dangerouslyAllowAllBuilds:|allowBuilds:' pnpm-workspace.yaml 2>/dev/null
```

| Manager | PASS | FAIL |
|---------|------|------|
| npm | `.npmrc` has `ignore-scripts=true` | missing or `false` |
| yarn | `enableScripts: false` or key absent | `enableScripts: true` |
| pnpm ≥ 11 | `strictDepBuilds` unset/`true`, `dangerouslyAllowAllBuilds` unset/`false`, and `allowBuilds` unset/`[]` | `strictDepBuilds: false`, `dangerouslyAllowAllBuilds: true`, or `allowBuilds` non-empty |
| pnpm 10 | `.npmrc` `ignore-scripts=true` OR `strictDepBuilds: true` | neither |

pnpm 11+ ignores script settings in `.npmrc` and `package.json#pnpm`. pnpm 10 / yarn edge cases: [references/managers.md](references/managers.md).

## 3. Unsafe dependency protocols

Registry:

```bash
grep -E '^allow-git=' .npmrc 2>/dev/null
grep -E 'approvedGitRepositories:' .yarnrc.yml 2>/dev/null
grep -E 'blockExoticSubdeps:' pnpm-workspace.yaml 2>/dev/null
```

Scan workspace `package.json` files (`dependencies`, `devDependencies`, `optionalDependencies`, `peerDependencies`). Prefer workspace-member discovery (pnpm-workspace.yaml / root workspaces / lerna / rush) per [references/protocols.md](references/protocols.md), then scan only those manifests. Fallback (may overmatch non-workspace manifests):

    find . -name package.json -not -path '*/node_modules/*'
````
END THIRD-PARTY FILE c2288f53e0d95b12

The third-party file has ended. Everything between the c2288f53e0d95b12 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2822 of 5223 bytes. © grafana · Apache-2.0 · https://github.com/grafana/skills/tree/HEAD/skills/grafana-plugins/check-npm/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
