npx skills add mblode/agent-skills --skill autoshipDrive an npm release end to end: changeset, fix loop, push, CI watch, Version Packages PR merge, publish watch, npm verification.
- IS: the full release pipeline for an existing changesets-based npm package, from writing the changeset file to confirming the new version on the registry.
- IS NOT: opening a feature PR (use
pr-creator), monitoring a feature PR for reviews, conflicts, or CI (usepr-babysitter), general build/type fixes outside a release flow, or scaffolding a new package (usescaffold-cli, which hands off to autoship for the first release).
The Release Loop
One workflow, two successive runs. Misreading it as two workflows causes most autoship mistakes.
- Push a commit containing a pending
.changeset/*.mdfile to the default branch. - The release workflow runs:
changesets/actionsees pending changesets, runschangeset versionin CI, and opens or updates a PR titled “Version Packages” on branchchangeset-release/mainwith thepackage.jsonbump andCHANGELOG.mdupdates. - Merge that PR once every check is green.
- The same workflow runs again. With no pending changesets left, the action runs its
publish:script (changeset publish), pushing tags and publishing to npm.
The local job ends at “push the changeset file”. CI owns versioning and publishing; anything versioned locally breaks the loop (see Gotchas).
Reference Files
| File | Read when |
|---|---|
references/changeset-and-commit.md |
Writing the changeset file and running each quality gate non-interactively (Steps 1-2) |
references/ci-polling.md |
Monitor scripts, CI failures, Changeset Status check (Steps 4-5) |
references/version-pr-and-publish.md |
Finding/merging the Version Packages PR, watching publish (Steps 4-5) |
Intent Map
| Intent | Steps | Notes |
|---|---|---|
| Full autoship (ship / release / publish) | 1-5 | Default entry point. End-to-end through publish, no intermediate prompts |
| Create changeset only | 1 | Stage a release without pushing |
| Fix quality and push | 1-2 | Changeset + fixes + commit, no CI watch |
| Watch CI only | 3-5 | Changes already pushed |
| Merge version PR only | 4-5 | CI already passed; auto-merges once preconditions are met |
| Fix compiler only | 2 | Inside an autoship/release flow only; no changeset needed |
If the user says “ship it” without explicit npm release context, route to pr-creator.
Safety Tiers
Invoking autoship is standing consent for the full release flow. Do not pause mid-flow to re-confirm; gate risky steps with objective preconditions instead.
- Green (execute directly): any read, including CI and PR state,
npm view, pending changesets,package.jsonscripts, and git history or status. - Yellow (announce, then execute): writing changeset files, running lint/typecheck/test/format fixers,
git add/commit/push, startingMonitorbackground watches, andgh pr mergeof the Version Packages PR once its identity is confirmed and all checks are green. - Red (explicit confirmation required): force-pushing, history rewrites, any destructive git operation.
Workflow
Copy this checklist to track progress:
Autoship progress:
- [ ] Step 1: Create changeset (default patch)
- [ ] Step 2: Fix lint, types, tests, format
- [ ] Step 3: Commit + push changeset (do NOT run `changeset version`)
- [ ] Step 4: Monitor CI and find/merge the Version Packages PR
- [ ] Step 5: Watch the publish run, verify on npmStep 1: Create changeset (default patch)
- Load
references/changeset-and-commit.md. - Check for pending changesets:
ls .changeset/*.md 2>/dev/null | grep -v README.md. If any exist, ask the user whether to add another or skip. - Default to
patch; useminorormajoronly on explicit user instruction. - Write the changeset file directly (non-interactive agent mode); infer the summary from
git log --oneline -10.
Step 2: Fix lint, types, tests, format
- Load
references/changeset-and-commit.md(skip the changeset sections for the “Fix compiler only” intent). - Discover commands from
package.jsonscripts (build,typecheck,tsc,type-check,lint,test,format); in non-npm repos checkMakefile,Cargo.toml,pyproject.toml,go.mod. - Run gates in order: lint, typecheck, test, format.
- Scope auto-fixers (
lint --fix,format) to changed files where supported. After any fixer, checkgit status: broad scripts routinely reformat files outside your change (MDX is a frequent casualty). Revert unrelated churn withgit restore <path>before continuing. - On failure, parse output for file, line, code, and message. Fix syntax errors first, then type errors, then lint errors. Fix one root cause at a time when errors cascade.
- Retry each gate up to 5 fix iterations, reporting the remaining error count each pass. After 5 failures, stop and report (see Failure Recovery).
Step 3: Commit + push changeset
- Stage the changeset file and in-scope fixes only:
git add <paths>, nevergit add -A. Sweepgit status --porcelainfor stray generated artifacts (e.g. a rootschema.gqlfrom a pre-commit hook) and unrelated fixer churn before committing. - Commit (
chore: add <type> changeset for <package>) and push. - Do NOT run
npx changeset versionlocally. The pushed commit must still contain the pending.changeset/*.mdfile so CI’s “Changeset Status” check passes and the Version Packages PR opens.
Step 4: Monitor CI and find/merge the Version Packages PR
- Load
references/ci-polling.mdandreferences/version-pr-and-publish.md. - Start a
Monitorwatch scoped to the pushed commit SHA, emitting state changes and aTERMINAL:line when every workflow run completes. Do not stop on an idle first poll; runs take time to queue. - On failure, classify via logs (
gh run view <id> --log-failed): flaky/infra failures getgh run rerun <id> --failedup to 3 times; real failures get a fix, commit, push, and a fresh Monitor. - Once green, find the open PR titled “Version Packages” on branch
changeset-release/main. If absent, start a second Monitor that polls for it, capped at 10 minutes. - Verify ALL merge preconditions:
- PR title is exactly “Version Packages” OR head branch is
changeset-release/main. Never merge any other PR. - Every check reports
bucket: passviagh pr checks <number> --json name,bucket. gh pr view <number> --json mergeablereportsMERGEABLE(notCONFLICTINGorUNKNOWN; onUNKNOWN, wait briefly and re-query).
- PR title is exactly “Version Packages” OR head branch is
- Announce in one line (“Merging Version Packages PR #N:
@ ”), then gh pr merge <number> --squash --delete-branch. No confirmation pause; invoking autoship is the consent. - If any precondition fails, stop and report. Do not merge.
Step 5: Watch the publish run, verify on npm
- Load
references/version-pr-and-publish.mdandreferences/ci-polling.md. - Merging the PR triggers the SAME workflow again; with no pending changesets it publishes (see The Release Loop).
- Identify the workflow file in
.github/workflows/(commonlyrelease.yml,npm-publish.yml,publish.yml) andMonitorits latest run on the default branch. - On failure: report with logs and stop. Never auto-retry; publish failures are real (npm auth, registry, OIDC/provenance, tag conflict).
- On success: verify
npm view <package> versionagainst the mergedpackage.json, stop all Monitors, report the version. Thenpm viewoutput is the completion evidence; never report success without it.
Failure Recovery
| Failure point | Response |
|---|---|
| Quality gate still failing after 5 iterations | Stop. Report the gate, remaining error count, last error output |
| CI fails after the changeset push | Classify per references/ci-polling.md: flaky/infra gets gh run rerun <id> --failed (max 3); real failures get fix + push + fresh Monitor |
| “Changeset Status” check fails | Missing changeset: add one (Step 1). Consumed (a local changeset version ran): revert the version bump and CHANGELOG.md edit, re-add the changeset file. Rerunning CI cannot fix consumed state |
| Version Packages PR absent after 10 minutes | Check pending changesets exist on the default branch, the workflow file exists, and the action ran (gh run list) |
| Merge precondition fails | Stop and report. Never override failing checks or resolve conflicts in the bot PR |
| Publish run fails | Never auto-retry. Report with logs; causes: npm auth, OIDC/provenance, tag conflict, registry outage |
Gotchas
- Never run
npx changeset versionlocally. It consumes the.changeset/*.mdfile, so the pushed commit has no pending changeset, the “Changeset Status” check fails, and no Version Packages PR opens. Recovery means reverting the bump, not rerunning CI. - Never run
npm publishdirectly. It bypasses changesets, skips the changelog and tags, and leaves the Version Packages PR describing an already-shipped version. - Never hand-edit
CHANGELOG.mdorpackage.jsonversion. CI generates both in the Version Packages PR; local edits create conflicts that make the bot PR unmergeable. gh pr list --json headBranchandgh pr checks --json conclusionare invalid fields and error. UseheadRefNameandbucket.- Do not stop CI monitoring on a first empty poll; workflows take time to queue. Stop only on the Monitor’s
TERMINAL:line. - Keep Monitor
sleepat 30s or more. Tighter polling burns GitHub API rate limit (gh api rate_limit) and can throttle the flow. - A broad
format/fixscript riding into the release commit ships unrelated reformatting. Scope fixers to changed files;git restorethe rest first. git add -Asilently commits pre-commit-hook artifacts (e.g. a rootschema.gql). Stage explicit paths only.- Selecting
majorwithout explicit user instruction signals breaking changes to every consumer. Default topatch.
Related Skills
scaffold-cli: scaffolds a new TypeScript package, hands off to autoship for its first release.pr-creator: opens feature PRs. Autoship only merges the bot-opened Version Packages PR.pr-babysitter: watches feature PRs (reviews, conflicts, CI). Autoship watches release CI only.