Communitygithub.com

withastro/astro

为 Astro 单体仓库创建 changeset。当需要在 PR 中添加 changeset 文件、编写更新日志条目或记录包版本升级时,请使用此技能。

astro 是什么?

该技能专为 Astro 单体仓库的贡献者设计,用于创建和管理 changeset 文件。当用户提出“添加 changeset”、“编写 changeset”或“创建 changeset”等指令,或其他技能要求创建 changeset 时,它会自动触发。它的核心作用是确保每个修改包的 PR 都附带正确的版本号变更声明和面向用户的更新日志条目。该技能自动处理文件的创建(使用 pnpm changeset --empty 命令),并指导用户以标准 YAML 格式填写包名、语义化版本类型(patch/minor/major)以及用户友好的变更消息。它不仅规范了更新日志的写作方式(如使用现在时动词开头、重点描述用户影响),还针对不同变更类型(补丁、新特性、破坏性变更)提供了详细的模板和示例,包括如何编写迁移指南、展示代码示例以及格式化多段落的更新说明。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/withastro/astro/tree/HEAD/.agents/skills/changeset

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Changeset

为 Astro 单体仓库创建 changeset 文件。Changeset 声明哪些包发生了变更,semver 版本升级类型,以及面向用户的、会成为 CHANGELOG 条目的消息。

每个修改包的 PR 都需要一个 changeset。仅有 examples/* 的变更可以豁免。

创建文件

在仓库根目录运行 pnpm changeset --empty。这会在 .changeset/ 目录下创建一个名称随机的 .md 文件,其中包含空的前置元数据——无需自己发明文件名或检查目录。然后编辑生成的文件,添加包版本升级信息和消息。

格式

---
'<package-name>': patch
---

<changeset message>
  • 包名必须与包的 package.json 中的 name 字段完全匹配(例如 'astro'、'@astrojs/node')
  • 版本升级类型:patch、minor 或 major
  • 单个 changeset 文件可以覆盖多个包
  • 对核心 astro 包的 major 和 minor 版本升级会被 CI 阻止,需要维护者审核

编写消息

Changeset 消息是公开的 CHANGELOG 条目。请面向 Astro 用户 编写,而不是面向代码审查者。

以 现在时动词 开头,补全句子“此 PR...”:

  • Adds, Removes, Fixes, Updates, Refactors, Improves, Deprecates

从 构建 Astro 网站的用户将会体验到什么 的角度来描述变更,而不是在内部如何实现:

// 过于关注实现
Logs helpful errors if content is invalid

// 更好——面向用户的影响
Adds logging for content collections configuration errors.

补丁更新

一行通常就足够了。除非写多个句子,否则不需要结尾标点。

---
'astro': patch
---

Fixes a bug where the toolbar audit would incorrectly flag images as above the fold
---
'astro': patch
---

Refactors internal handling of styles and scripts for content collections to improve build performance

帮助读者判断变更是否与他们相关。如果变更与某个可识别的选项或函数相关,请包含具体的 API 名称(使用反引号格式化)。当 API 不是面向用户的时,请改而描述使用案例或最终结果:

// 模糊
Improves automatic fallbacks generation

// 清晰——读者可以判断是否影响他们
Improves automatic `fallbacks` generation for the experimental Fonts API

新特性(次要版本)

以 "Adds" 开头,命名新的 API,并描述用户现在可以做什么。如果对读者有帮助,请包含代码示例:

---
'astro': minor
---

Adds a new, optional property `timeout` for the `client:idle` directive

This value allows you to specify a maximum time to wait, in milliseconds, before hydrating a UI framework component.

```astro
<Button client:idle={{ timeout: 500 }} />
```

新特性是编写更丰富描述的契机,这些描述可以用于博客文章。关于更长条目的指导,请参阅 Astro changeset 文档。

破坏性变更(主版本)

使用 "Removes"、"Changes" 或 "Deprecates" 等动词。必须包含迁移指南。适时使用 diff 代码示例:

---
'astro': major
---

Removes support for Shiki custom language's `path` property. The language JSON file must now be imported and passed to the option instead.

```diff
// astro.config.js
+ import customLang from './custom.tmLanguage.json'

export default defineConfig({
  markdown: {
    shikiConfig: {
      langs: [
-       { path: './custom.tmLanguage.json' },
+       customLang,
      ],
    },
  },
})
```

更改默认值时必须提到旧默认值、新默认值以及如何恢复之前的行为。

较长的 Changeset

对于较长的描述,使用 #### 和更深层的标题(绝不使用 ## 或 ###)来划分章节。当你的条目被整合时,这能使 CHANGELOG 保持可读性:

---
'astro': minor
---

Adds a new Sessions API to store user state between requests for on-demand rendered pages.

#### Configuring session storage

<!-- ... -->

#### Using sessions

<!-- ... -->

相关技能