Mode d’emploi
- Copiez la commande et examinez le paquet avant de l’installer dans votre environnement agent.
- Consultez le document original pour les outils, identifiants et environnements requis.
- Décrivez les entrées et le livrable souhaité ; comparez la sortie aux sources.
npx skills add https://github.com/TerminalSkills/skills --skill changesetsAvant de commencer
- L’installation n’inclut ni abonnement au modèle, ni quota API, ni accès aux fichiers.
- Étoiles et installations reflètent l’activité, pas un test indépendant de qualité ou de sécurité.
Rendu depuis le dépôt source en conservant titres, exemples, code, tableaux, liens et images.
Changesets
Overview
Changesets is a versioning and changelog management tool for JavaScript/TypeScript monorepos. Developers add changeset files describing their changes, then CI consumes them to bump package versions, generate changelogs, and publish to npm with coordinated releases across interdependent packages.
Instructions
- Install and initialize:
npm install -D @changesets/cli, thennpx changeset init(interactive; it asks whether to use the GitHub changelog integration) which creates.changeset/config.json. Set"access": "public"for public npm packages,"baseBranch"to your default branch, and for GitHub links in changelogs install@changesets/changelog-githuband set"changelog": ["@changesets/changelog-github", { "repo": "acme-corp/design-system" }]. - Add a change:
npx changeset(pick packages, bump type, summary) writes a file such as.changeset/swift-things-double.md; commit it with the PR. Non-interactive form for scripts and agents:npx changeset -m "Add retry option to the core client" --minor @acme/core(also--major/--patch, comma-separated package lists,--emptyfor PRs that need no release). - Version:
npx changeset versionconsumes pending changesets, bumpspackage.jsonversions, rewrites changelogs, and patch-bumps internal dependents. Since v3 it exits with code 1 when there are no changesets, so a pipeline step fails instead of silently doing nothing. - Publish:
npx changeset publishpublishes packages whose version is not on the registry yet and creates git tags (--no-git-tagto skip them,--tag betafor a dist-tag). Since v3 you can also split it:changeset pack --out-dir ./tarballswrites tarballs andchangeset publish --from-pack-dir ./tarballspublishes them.changeset status --since=mainlists what would be released and fails in CI when required changesets are missing. - Automation:
changesets/action@v2(the line compatible with CLI v3) opens or updates a "Version Packages" pull request and publishes when it is merged. Inputs arepublish-script(the command that builds and publishes),version-script,commit-messageandgithub-token; the job needscontents: writeandpull-requests: write(plusid-token: writefor npm trusted publishing), and the repository setting "Allow GitHub Actions to create and approve pull requests" must be on. - Keeping packages in step:
fixedgroups always get the same version and are bumped together whenever one of them changes;linkedgroups share a version number only for the packages released together in a given release. - Snapshots and pre-releases:
npx changeset version --snapshot previewsets versions to0.0.0-preview-<timestamp>; publish them withchangeset publish --tag previewsolatestis untouched. For-next.Nreleases usenpx changeset pre enter next, run version/publish as usual, and finish withnpx changeset pre exit.
Examples
Example 1: Set up automated releases for a monorepo
User request: "Configure Changesets for automated versioning and publishing in my Turborepo monorepo"
npm install -D @changesets/cli @changesets/changelog-github
npx changeset init# .github/workflows/release.yml
name: Release
on:
push:
branches: [main]
permissions:
contents: write
pull-requests: write
id-token: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 24 }
- run: npm ci
- uses: changesets/action@v2
with:
publish-script: npm run release # "release": "turbo build && changeset publish"Result: every merge to main with pending changesets updates a "Version Packages" PR; merging that PR publishes the packages to npm and tags them.
Example 2: Coordinate a breaking change across packages
User request: "Release a major version of @acme/core and make sure dependents are updated"
$ npx changeset -m "Rename client options" --major @acme/core
$ npx changeset version
$ grep version packages/*/package.json
packages/cli/package.json:{"name":"@acme/cli","version":"1.0.1","dependencies":{"@acme/core":"^2.0.0"}}
packages/core/package.json:{"name":"@acme/core","version":"2.0.0"}Result: core goes to 2.0.0, @acme/cli is patch-bumped to 1.0.1 with its dependency range moved to ^2.0.0, and both changelogs list the change. If @acme/cli should also change its public API, add its own changeset with the right bump type.
Guidelines
- Require a changeset on every PR that changes a published package; enforce it with
changeset status --since=mainin CI. - Write summaries for users of the package ("Fixed button hover state"), not for maintainers ("Refactored CSS modules").
- A CI job that runs
changeset versionfails when nothing is pending (v3); guard it withchangeset statusor letchangesets/actiondecide. - Never publish a snapshot without
--tag, or it can land onlatest. - Private packages are neither versioned nor tagged by default; set
privatePackagestotruein the config to opt in. .changeset/config.jsonlives in the repo root and is committed; theformatoption ("auto"by default,falseto disable) controls how changesets and changelogs are formatted.

