AGENT SKILL

Emitter 变更 PR 准备

emitter-prep-for-pr

为语言 emitter 变更准备 PR:验证(构建、格式化、lint 检查)、添加 changeset 并推送。本技能专用于语言 emitter 包(http-client-python、http-client-csharp、http-client-java),不适用于核心 TypeSpec 包,如 compiler、http、openapi3 等。当用户希望完成 emitter 变更,或说出诸如“准备提交 PR”“验证并推送”“添加 changeset”“完成变更”等指令时使用。

License 许可
MIT
所属仓库
microsoft/typespec
最近更新
2026-11-14
Stars
★ 5.9k
Forks
423

01 前言 Front Matter

name
emitter-prep-for-pr
description
Prepare language emitter changes for PR: validate (build, format, lint), add a changeset, and push. This skill is specifically for the language emitter packages (http-client-python, http-client-csharp, http-client-java) - NOT for core TypeSpec packages like compiler, http, openapi3, etc. Use when the user wants to finalize emitter changes, says things like "prep for pr", "prepare for PR", "validate and push", "add changeset", or "finalize changes".

03 SKILL.md 正文

Emitter Prep for PR

Prepares language emitter changes for pull request by running build/format/lint, checking for a changeset, and pushing to the remote branch.

This skill is for language emitter packages only:

  • http-client-python
  • http-client-csharp
  • http-client-java

Do NOT use this skill for core TypeSpec packages (compiler, http, openapi3, etc.).

Workflow

Step 1: Determine the emitter package

Figure out which emitter package the user is working on from context (cwd, recent changes, or ask). The package will be under packages/<package-name>/.

Step 2: Build, format, and lint the emitter package

cd ~/Desktop/github/typespec/packages/PACKAGE_NAME

# Build
npm run build

# Format (includes both TypeScript and Python formatting)
npm run format

# Lint (emitter-only is fine for quick validation)
npm run lint -- --emitter

If any step fails, report the error and stop. Do not proceed.

Step 3: Run format at repo root

cd ~/Desktop/github/typespec
pnpm format

Important: pnpm format may touch files outside the emitter package (e.g., .devcontainer/, other packages). When staging changes in Step 6, only stage files within the emitter package directory (packages/PACKAGE_NAME/) and .chronus/changes/ and .github/skills/. Discard any formatting changes to unrelated files with git checkout -- <file>.

Step 4: Check for existing changeset

Check if a changeset already exists for the current branch:

cd ~/Desktop/github/typespec
BRANCH=$(git rev-parse --abbrev-ref HEAD)
ls .chronus/changes/ | grep -i "$BRANCH" || echo "NO_CHANGESET"
  • If a changeset exists: Skip to Step 6 (no need to create one).
  • If NO_CHANGESET: Proceed to Step 5 to create one.

Step 5: Create changeset (only if none exists)

Ask the user what kind of change this is, or infer from context:

  1. changeKind - one of: internal, fix, feature, deprecation, breaking, dependencies
  2. message - concise user-focused description

Then create the file:

cd ~/Desktop/github/typespec
BRANCH=$(git rev-parse --abbrev-ref HEAD)
TIMESTAMP=$(date +"%Y-%m-%d-%H-%M-%S")
FILENAME=".chronus/changes/${BRANCH}-${TIMESTAMP}.md"
---
changeKind: <KIND>
packages:
  - "<PACKAGE>"
---

<MESSAGE>

Step 6: Stage, commit, and push

cd ~/Desktop/github/typespec
git add -A
git status

Show the user what will be committed and ask for confirmation. Then:

BRANCH=$(git rev-parse --abbrev-ref HEAD)
git commit -m "<COMMIT_MESSAGE>

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>"

# Always push to origin (user's fork), never upstream
git push origin "$BRANCH"

Changeset Guidelines

changeKind reference

  • internal: Tests, CI/CD, refactoring, docs, skills — not user-facing
  • fix: Bug fixes users would notice
  • feature: New user-facing capabilities
  • deprecation: Marking something as deprecated
  • breaking: Removing or changing behavior incompatibly
  • dependencies: Dependency version bumps

Message examples

  • internal: "Improve CI pipeline performance and test infrastructure"
  • fix: "Fix incorrect deserialization of nullable enum properties"
  • feature: "Add support for XML serialization in request bodies"

Package names

Folder Package Name
http-client-python @typespec/http-client-python
http-client-csharp @typespec/http-client-csharp
http-client-java @typespec/http-client-java

04 同仓库更多 Skills

microsoft
microsoft/typespec

http-client-python Emitter 构建与测试

test-unbranded-emitter

构建并测试 @typespec/http-client-python emitter。当用户想要测试其对 emitter 的本地变更、运行生成器测试套件、检查其 http-client-python 变更是否通过,或验证某项修复时使用。触发短语包括“test the emitter”(测试 emitter)、“run tests”(运行测试)、“check if my changes pass”(检查我的变更是否通过)、“run test:generator”(运行 test:generator)、“run CI”(运行 CI),或在 emitter 包中提及任何测试/验证变更的表述。

软件开发工程师测试与质量保障
★ 5.9k
microsoft
microsoft/typespec

TypeSpec 生成 Python SDK 代码

generate-from-typespec

使用本地 emitter 从 TypeSpec 规范生成 Python SDK 代码。当用户想要从 TypeSpec 规范生成或重新生成 Python 客户端,提供了 TypeSpec 项目的 GitHub URL 或本地路径,或说出类似“generate from this spec”(从此规范生成)、“emit Python from this tsp”(从此 tsp 生成 Python)、“regenerate the SDK”(重新生成 SDK)、“compile this TypeSpec for Python”(将此 TypeSpec 编译为 Python)等表述时使用。

软件开发工程师代码实现
★ 5.9k
microsoft
microsoft/typespec

Emitter 生成代码与上游基线对比

diff-upstream

重新生成本地 emitter,并将生成的代码与已检入 autorest.python 的上游基线进行对比。当用户想查看其 emitter 变更对生成代码的影响(相较于当前生产环境的差异),或说出类似“diff upstream”(与上游对比)、“compare to baseline”(与基线比较)、“what changed vs production”(相较生产环境有哪些变化)、“show me the diff”(给我看差异)、“how does this affect generated code”(这如何影响生成代码)等表述,或希望验证其变更能产生预期的输出差异时使用。

软件开发工程师代码实现
★ 5.9k
microsoft
microsoft/typespec

Python SDK Spector 模拟 API 测试编写

writing-python-sdk-spector-mock-api-tests

根据 Spector 用例编写 TypeSpec http-client-python generator 的模拟 API 测试(azure/unbranded/shared)。当给定 Spector 用例链接,或修改 http-specs/azure-http-specs 下 Spector 用例的 PR 链接时使用。

测试工程师测试与质量保障
★ 5.9k
microsoft
microsoft/typespec

pnpm 代码格式化

pnpm-format

使用 pnpm 格式化代码库,并从常见的格式化失败中恢复。

软件开发工程师开发环境与工具链管理
★ 5.9k
microsoft
microsoft/typespec

TypeSpec Bug 最小复现构建

minimal-repro

帮助创建 TypeSpec 编译器或 emitter bug 的最小复现。当用户提供 TypeSpec 源码(粘贴的代码或 GitHub URL)并描述问题时使用。在本地复现并缩减为单文件复现。

软件开发工程师调试与故障排查
★ 5.9k