Skip to content
Back to skills

Publishing Npm Packages

ASecurity

Use when publishing an npm package or checking that one is ready to publish. Triggers on `npm publish`, `package.json` fields such as files, publishConfig, or private, a publish that fails because the version exists, provenance, dist-tags, or per-platform native-binary packages, even when the user doesn't say 'npm'.

  • 6 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 30, 2026
ai-agentsgogit

Security analysis

A100/100

Pro scans all 7 files and shows the line behind each finding

Scanned November 30, 2026

npx -y skills add xonovex/platform --skill publishing-npm-packages --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Publishing Npm Packages?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Publishing Npm Packages
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/xonovex-publishing-npm-packages/badge)](https://www.skillsdirectory.com/skills/xonovex-publishing-npm-packages)

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

Download with Pro
SKILL.md
---
name: publishing-npm-packages
description: "Use when publishing an npm package or checking that one is ready to publish. Triggers on `npm publish`, `package.json` fields such as files, publishConfig, or private, a publish that fails because the version exists, provenance, dist-tags, or per-platform native-binary packages, even when the user doesn't say 'npm'."
---

# npm Publishing Guidelines

Validate publish-readiness and publish packages idempotently, with correct access, provenance, dist-tags, and platform fields.

## Core Principles

- **npm requires only name + version**: `license` / `repository` / `files` are house policy, not npm rules, and `private: true` blocks publishing outright, see [references/publish-check.md](references/publish-check.md)
- **Provenance needs CI + OIDC**: `--provenance` only works from a supported runner with `id-token` permission, the public registry, and a matching `repository`; it errors elsewhere, see [references/publish.md](references/publish.md)
- **Access is derived**: unscoped packages are always public; scoped packages default to restricted and need `--access public` on first publish, see [references/publish.md](references/publish.md)
- **Platform packages gate install**: `os` / `cpu` / `libc` restrict where a native-binary package installs; inject and restore those fields safely, see [references/publish.md](references/publish.md)

## Operations

- **publish-check**: validate a package.json is publish-ready, separating npm rules from policy, see [references/publish-check.md](references/publish-check.md)
- **publish**: publish a package idempotently with provenance / access / dist-tag / platform handling, see [references/publish.md](references/publish.md)

## Gotchas

- Hard-requiring `license` / `repository` / `files` exceeds npm (it warns, it doesn't block), and rejecting a `repository` shorthand string like `github:org/repo` is wrong: treat the three as policy
- `publishConfig.access` is only meaningful for `@scoped` names; unscoped packages cannot be restricted: don't hard-require it universally
- `--provenance` fails outside a supported CI/OIDC environment: gate it on CI, never expect a local no-op
- `files` supports globs and `dist/` is built later: don't existence-check glob entries or build outputs; `package.json` / `README` / `LICENSE` / `main` are always included
- Inject-then-restore of `os` / `cpu` / `libc` must restore on failure (try/finally), and `libc` is a silent no-op unless `os` includes `linux`
- A pre-release published without `--tag` lands on `latest` and installs by default: derive a dist-tag from the version

## Progressive Disclosure

- Read [references/publish-check.md](references/publish-check.md) - Load when validating that a package is ready to publish
- Read [references/publish.md](references/publish.md) - Load when publishing (idempotency, provenance, access, dist-tag, platform fields)

Files in this skill

  • SKILL.md2.8 KB
  • eval-output.json3.4 KB
  • eval-trigger.json4.1 KB
  • moon.yml86 B
  • references/publish-check.md1.8 KB
  • references/publish.md2.2 KB
  • sources.json4.1 KB

Attribution

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

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.