$npx -y skills add luochang212/skill-zoo --skill npm-releaseUse when publishing or preparing to publish an npm package from this repository, especially the Skill Zoo CLI package under packages/cli. Also use when npm publish fails because of duplicate versions, npm authentication, browser authentication, dist-tag propagation, tarball conte
| 1 | # npm Release |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Publish an npm package from this repo with local verification, clean package contents, and npm browser authentication. For Skill Zoo today, the npm package is the CLI package in `packages/cli`; the workspace root is private and is not the package to publish. |
| 6 | |
| 7 | **Announce at start:** "I'm using the npm-release skill to publish the npm package." |
| 8 | |
| 9 | ## Privacy Guardrails |
| 10 | |
| 11 | Do not write private npm account details into repo files, skill files, logs, release notes, or final summaries. This includes npm usernames, email addresses, authentication secrets, browser auth URLs, auth IDs, tokens, local npm debug log paths, and machine-specific temporary directories. |
| 12 | |
| 13 | It is fine to state generic facts such as "npm required browser authentication" or "the authenticated owner account was permitted." Do not paste the actual authentication URL into a committed file. If a URL is needed transiently, use it only to complete the live browser flow. |
| 14 | |
| 15 | ## When to Use |
| 16 | |
| 17 | Use this skill when: |
| 18 | |
| 19 | - The user says "publish npm", "release the npm package", "npm publish", "发 npm", or "发布 npm 包" |
| 20 | - The package is in a workspace and you need to identify the real publishable package |
| 21 | - `npm publish` fails with duplicate version, npm authentication, owner, tarball, or bin problems |
| 22 | - The user asks whether a package is ready for npm publication |
| 23 | - A release bump needs to update package metadata and lockfile state consistently |
| 24 | |
| 25 | Do not use this skill for: |
| 26 | |
| 27 | - Desktop app GitHub Releases or Homebrew cask releases; use `app-release` |
| 28 | - Tauri updater implementation; use `tauri-updater` |
| 29 | - Publishing a package you have not locally verified |
| 30 | |
| 31 | ## Package Target |
| 32 | |
| 33 | For this repo, start with the CLI package: |
| 34 | |
| 35 | ```bash |
| 36 | cd packages/cli |
| 37 | ``` |
| 38 | |
| 39 | Confirm the root package is not the target: |
| 40 | |
| 41 | ```bash |
| 42 | node -e "console.log(require('./package.json').private)" |
| 43 | node -e "const p=require('./packages/cli/package.json'); console.log(p.name, p.version, p.bin)" |
| 44 | ``` |
| 45 | |
| 46 | If the target changes in the future, publish from the directory whose `package.json` has the public npm `name`, `bin`, `files`, `scripts.prepack`, and production `dependencies`. |
| 47 | |
| 48 | ## Preflight |
| 49 | |
| 50 | Check the repo instructions and current working tree first: |
| 51 | |
| 52 | ```bash |
| 53 | test -f CLAUDE.md && sed -n '1,220p' CLAUDE.md |
| 54 | test -f AGENTS.md && sed -n '1,220p' AGENTS.md |
| 55 | git status --short |
| 56 | ``` |
| 57 | |
| 58 | Do not revert or overwrite unrelated changes. If publish-relevant files already have user edits, inspect them and work with the current state. |
| 59 | |
| 60 | Check npm registry state before changing versions: |
| 61 | |
| 62 | ```bash |
| 63 | cd packages/cli |
| 64 | npm view skill-zoo version dist-tags --json |
| 65 | npm view skill-zoo versions --json |
| 66 | npm whoami |
| 67 | npm owner ls skill-zoo |
| 68 | ``` |
| 69 | |
| 70 | If the local version already exists on npm, explain that npm versions are immutable and ask the user which new version to publish before changing files. Do not choose or apply the release version silently. |
| 71 | |
| 72 | ## Version Bump |
| 73 | |
| 74 | For the Skill Zoo CLI package, update: |
| 75 | |
| 76 | - `packages/cli/package.json` |
| 77 | - `bun.lock` workspace entry for `packages/cli` |
| 78 | |
| 79 | Ask the user to confirm the exact version before editing release files. If they ask for a recommendation, propose the smallest sensible semver bump and explain why, then wait for confirmation before applying it. |
| 80 | |
| 81 | After bumping, search for hardcoded old versions that should follow the package version: |
| 82 | |
| 83 | ```bash |
| 84 | OLD_VERSION=<previous-version> |
| 85 | rg "\"version\": \"${OLD_VERSION}\"|skill-zoo-cli@${OLD_VERSION}|skill-zoo@${OLD_VERSION}" packages/cli bun.lock |
| 86 | ``` |
| 87 | |
| 88 | Tests should generally depend on `CLI_VERSION` rather than hardcoding a release version. This prevents a release bump from breaking tests only because an expected metadata string changed. |
| 89 | |
| 90 | ## Required Verification |
| 91 | |
| 92 | Run these from `packages/cli` after any version or release-related change: |
| 93 | |
| 94 | ```bash |
| 95 | npm run typecheck |
| 96 | npm test |
| 97 | npm run build |
| 98 | npm publish --dry-run |
| 99 | ``` |
| 100 | |
| 101 | The dry-run must show the expected version and tarball contents. For this CLI, expected package contents are small and should normally be: |
| 102 | |
| 103 | ```text |
| 104 | README.md |
| 105 | dist/index.d.ts |
| 106 | dist/index.js |
| 107 | package.json |
| 108 | wui/app.js |
| 109 | wui/index.html |
| 110 | wui/styles.css |
| 111 | ``` |
| 112 | |
| 113 | If extra source, test, repo, log, or private files appear, fix the `files` whitelist or ignore rules before publishing. |
| 114 | |
| 115 | ## CLI Package Checks |
| 116 | |
| 117 | Before publishing a CLI package, verify the executable path matches `bin` and can start from the built artifact: |
| 118 | |
| 119 | ```bash |
| 120 | cd ../.. |
| 121 | sed -n '1,20p' packages/cli/src/index.ts |
| 122 | sed -n '1,20p' packages/cli/dist/index.js |
| 123 | ls -l packages/cli/dist/index.js packages/cli/dist/index.d.ts |
| 124 | node packages/cli/dist/index.js --version |
| 125 | node packages/cli/dist/index.js --help | sed -n '1,120p' |
| 126 | ``` |
| 127 | |
| 128 | For higher con |