npm-jsr-first-publish
Skill2 starsChanged todayApache-2.0View on GitHub
Prepare a brand-new npm and JSR package for its first release from GitHub Actions. The bundled script publishes an npm 0.0.0 placeholder, adds the npm trusted publisher, and creates and links the JSR package. Use before a new package's first release, or when its release fails because the npm package doesn't exist, has no trusted publisher, or the JSR package isn't linked.
- Commits and pushes
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Check the package is releasable: Before any human step:
- Very specific: line 42
Leave the placeholder at 0.0.0.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
npm and JSR First Publish
npm trusted publishing (OIDC) only works for a package that already exists, and JSR's OIDC publishing needs the package created and linked to its GitHub repository first. Neither can happen from a release workflow, so the first publish needs a one-off human run of first-publish.sh.
The script publishes a 0.0.0 placeholder instead of the real version. The shared npm publish workflow doesn't skip versions that already exist, so publishing the real version by hand makes the release's npm job fail as a duplicate.
Workflow
- Check the package is releasable. Before any human step:
- The caller release workflow exists, runs on
release: published, and grantsid-token: writeto the publish jobs. Note its filename and anyenvironment:on the publish jobs, since the trusted publisher must match both. - Release tags equal the version (
0.1.0, novprefix), andpackage.jsonandjsr.jsonversions match. - JSR resolves bare imports from
dependenciesanddevDependencies, notpeerDependencies. List every peer indevDependenciesas well, or JSR's server rejects the publish even thoughjsr publish --dry-runpasses locally. - Dependencies between packages in the same repository use exact versions, not
workspace:. - The repository's checks,
npm pack --dry-runandjsr publish --dry-runpass, and the changes are pushed.
- The caller release workflow exists, runs on
- Prepare the script in tmp. Copy first-publish.sh to
/tmp/opencode/<repository>/first-publish.sh, keep it executable, and run it yourself with--dry-runand the real arguments. Package directories go in dependency order. Fix anything the dry run reports. - Hand it to the user. Give the exact command without
--dry-run, to run in their own terminal. Don't run it for them:npm login, npm's browser 2FA, and creating and linking on jsr.io are human-only. The script:- signs in to npm if needed;
- packs each package (running its own build), rewrites the copy to
0.0.0without pack scripts or provenance (provenance only works in CI), points sibling dependencies at0.0.0, and publishes it; - runs
npm trust github <package> --repo <owner/name> --file <workflow> --allow-publishattached to the terminal, so npm can ask for 2FA, and offers a retry if it fails while the new package reaches the registry; - opens jsr.io to create each JSR package and link it to the repository, then confirms through the JSR API.
Verify without waiting on the registries. Both registries are likely to look missing for a while, and that's safe to continue past:
- npm returns 404 to
npm viewand signed-out requests for 10 minutes or more after a first publish, even though the website already shows the package andnpm trustworks straight away. - JSR's package page has no versions until the first release, and new versions take a while to appear.
Take the script's output as evidence:
+ <package>@0.0.0, "Trust configuration created successfully" (npm trust listneeds an npm login), and the JSR check confirming the link. Confirm the link withcurl https://api.jsr.io/scopes/<scope>/packages/<name>, wheregithubRepositoryshould be set. Move on to the next step and checknpm view <package> versionsin a background shell instead of blocking on it.- npm returns 404 to
- First release, only when asked. Publish the GitHub release for the real version and watch its run.
dot git releasescan't create a repository's first release (its refresh gets a 404 for the missing latest release), so create it with theghCode Mode tools' release create orgh release create <version> --title <version> --notes-file <file>instead. The new versions can take minutes to appear on npm and JSR; a green run with "+<package>@<version>" in the npm job is enough to continue.
Traps
- npm prompts for 2FA only when attached to a terminal. Never capture or pipe the output of
npm publishornpm trustin the script. - npm allows one trusted publisher per package. If one exists with the wrong repository, workflow or environment, the user replaces it with
npm trust revoke --id <id> <package>, then reruns the script. - Allow publishing, not only staged publishing. A staged-only trusted publisher leaves releases waiting for approval.
- A failed release job reruns against the same tag. If a fix needs a code change, release a patch version, or have the user run
jsr publishlocally from a clean checkout of that version. - Leave the placeholder at
0.0.0. The first real release becomeslatestbecause it's higher.
In this repository56 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agentic-workflowsSkill
- asking-questionsSkill
- broSkill
- browser-accessSkill
- change-review-handoffSkill
- changeset-scopeSkill
- check-skill-updatesSkill
- chillSkill
- ci-loopSkill
- cleanup-unnecessary-variablesSkill
- code-reviewSkill
- decision-modelsSkill
- diagnoseSkill
- effect-principlesSkill
- evidence-firstSkill
- gh-stackSkill
- git-contextSkill
- github-development-rulesetsSkill
- github-repository-setupSkill
- grillingSkill
- handoffSkill
- herdr-workflowsSkill
- home-assistant-frontendSkill
- home-assistant-lit-renderingSkill
- human-step-guideSkill
- import-external-skillSkill
- inbox-reportingSkill
- issue-loopSkill
- lit-renderingSkill
- maintain-docsSkill
- opencode-effectSkill
- pitchfork-dev-serversSkill
- pkexec-rootSkill
- planSkill
- release-oxlint-rulesSkill
- remote-change-diffSkill
- remove-single-use-functionsSkill
- researchSkill
- retroSkill
- review-stagesSkill
- review-steeringSkill
- safe-process-signalsSkill
- session-coordinationSkill
- shared-workflowsSkill
- show-meSkill
- skill-prefixesSkill
- staged-implementationSkill
- task-focusSkill
- task-runnersSkill
- testingSkill
- to-questionnaireSkill
- types-enforce-tsSkill
- wranglerSkill
- writing-dot-skillsSkill
- writing-styleSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

