Skip to content
Agentmart
Submit a tool

npm-publish

Publish the current package to npm.

Skill by danielrosehill

IndexedMIT★ 1
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/danielrosehill-npm-publish

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Publish the current package to npm. Prefers trusted publishing (a GitHub Actions workflow publishing via OIDC on a version tag, no stored token); otherwise publishes from the shell with a granular token in NPM_TOKEN (deprecated for publishing around January 2027) or interactively with 2FA. Use when the user asks to "npm publish", "publish to npm", "release this package", "set up npm publishing", or "bump and publish".

Use cases: devops, productivity

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/npm-publish

What's inside

Skill name
npm-publish
Description
Publish the current package to npm. Prefers trusted publishing (a GitHub Actions workflow publishing via OIDC on a version tag, no stored token); otherwise publishes from the shell with a granular token in NPM_TOKEN (deprecated for publishing around January 2027) or interactively with 2FA. Use when the user asks to "npm publish", "publish to npm", "release this package", "set up npm publishing", or "bump and publish".
License
MIT
Instructions
59 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# npm publish

## Pick the route

| Route | When | Credential |
|---|---|---|
| **1. Trusted publishing** (preferred) | package source on GitHub/GitLab | none stored: CI exchanges an OIDC token with npm |
| 2. Granular token, "bypass 2FA" | quick one-off from a shell, **until ~January 2027** | `NPM_TOKEN` in the environment |
| 3. Interactive | anything else, and after the deprecation | `npm login` + 2FA code |

Why: GitHub changelog 2026-07-08 ("npm install-time security and GAT bypass2FA
deprecation"). Bypass-2FA granular tokens lost their 2FA bypass for account/package
management in August 2026 and lose **direct publishing around January 2027**. After that,
their publishes are only staged until a human approves with 2FA.

## 1. Trusted publishing

1. Add `.github/workflows/publish.yml`: trigger `push: tags: ["v*"]`, `permissions:
   id-token: write`, `actions/setup-node` with `registry-url: https://registry.npmjs.org`,
   **npm ≥ 11.5.1** (`npm install -g npm@latest`), then `npm ci`, build, `npm publish`.
   Check that the tag matches `package.json` version. Provenance is attached automatically.
2. One-time, by the package owner on npmjs.com: package → Settings → **Trusted publisher** →
   GitHub Actions → owner, repository, workflow file name. (The package must already exist;
   publish the first version by route 2 or 3.)
3. Release: bump `version`, commit, `git tag vX.Y.Z && git push --tags`. Verify with
   `npm view <name> version` and the workflow run, not by assuming.

## 2. Token in `NPM_TOKEN` (until ~Jan 2027)

Granular token: read+write, limited packages, "bypass 2FA", expiry. Run under whatever
injects `NPM_TOKEN` for one command; never write it to `~/.npmrc` or the repo:

```bash
bash -c '
  [ -n "$NPM_TOKEN" ] || { echo "NPM_TOKEN missing"; exit 1; }
  cfg=$(mktemp); trap "rm -f $cfg" EXIT; chmod 600 "$cfg"
  printf "//registry.npmjs.org/:_authToken=%s\n" "$NPM_TOKEN" > "$cfg"
  NPM_CONFIG_USERCONFIG="$cfg" npm whoami && NPM_CONFIG_USERCONFIG="$cfg" npm publish'
```

## 3. Interactive

`npm login` (user runs it, e.g. `! npm login`), then `npm publish --otp=<code>` with the code
fetched immediately before (codes expire in ~30 s).

## Always

- Check the registry first (`npm view <name> version`). Publishing an existing version fails.
- Scoped packages without `publishConfig.access`: add `--access public`.
- Verify on the registry afterwards; push the commit and tag.

| Symptom | Meaning |
|---|---|
| `E401` on `whoami` | token expired or revoked |
| `EOTP` | token lacks bypass-2FA (or the bypass no longer applies). Use route 1 or 3 |
| `E403 … cannot publish over` | version exists. Bump |
| CI: `ENEEDAUTH` / 404 on publish | trusted publisher not configured, wrong workflow filename, or npm < 11.5.1 |

From danielrosehill/Linux-Packaging-Plugin, MIT.

Signals

Stars
1
Forks
0
Open issues
0
Last commit (this folder)
Oct 21, 2026 (7 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from danielrosehill

Cite this page

npm-publish skill. Agent Mart. https://agentmart.dev/skills/danielrosehill-npm-publish (last updated 2026-10-24)