AGENT SKILL

Azure SDK 本地生成与测试

azsdk-common-generate-sdk-locally

基于 TypeSpec 在本地生成、构建和测试 Azure SDK,并自动应用自定义定制。适用场景:"本地生成 SDK"、"构建 SDK"、"运行 SDK 测试"、"运行 CI 检查"、"验证包"、"运行检查"、"更新 changelog"、"修复 SDK 构建错误"、"修复破坏性变更"、"解决 SDK 生成错误"、"定制 TypeSpec"、"重命名 SDK 客户端"、"重命名 SDK 模型"、"在 SDK 中隐藏操作"、"修复分析器错误"、"解决定制漂移"、"创建子客户端"、"更新元数据"、"更新版本"。不适用于:发布到包注册表、CI 流水线配置、API 设计评审。调用:azsdk_verify_setup、azsdk_package_generate_code、azsdk_package_build_code、azsdk_package_run_check、azsdk_package_run_tests、azsdk_customized_code_update、azsdk_package_update_changelog_content、azsdk_package_update_metadata、azsdk_package_update_version。

使用场景代码实现
License 许可
MIT
最近更新
2026-11-14
Stars
★ 6.1k
Forks
5.2k

01 前言 Front Matter

name
azsdk-common-generate-sdk-locally
license
MIT
metadata
{ "version": "1.1.0", "distribution": "shared" }
description
Generate, build, and test Azure SDKs locally from TypeSpec with automatic customization. WHEN: "generate SDK locally", "build SDK", "run SDK tests", "run CI checks", "validate package", "run checks", "update changelog", "fix SDK build errors", "fix breaking changes", "resolve SDK generation errors", "customize TypeSpec", "rename SDK client", "rename SDK model", "hide operation from SDK", "fix analyzer errors", "resolve customization drift", "create subclient", "update metadata", "update version". DO NOT USE FOR: publishing to package registries, CI pipeline configuration, API design review. INVOKES: azsdk_verify_setup, azsdk_package_generate_code, azsdk_package_build_code, azsdk_package_run_check, azsdk_package_run_tests, azsdk_customized_code_update, azsdk_package_update_changelog_content, azsdk_package_update_metadata, azsdk_package_update_version.
compatibility
azure-sdk-mcp server, local azure-sdk-for-{language} clone, language build tools

02 资源文件 6

03 SKILL.md 正文

Generate SDK Locally

This skill generates, builds, and tests Azure SDKs locally from TypeSpec with automatic customization support, covering the end-to-end workflow for fixing generation issues, applying SDK-specific updates, and refreshing package metadata when needed.

Triggers

USE FOR: generate, build, and test Azure SDKs locally from TypeSpec with automatic customization; update changelog; fix SDK build errors; fix breaking changes; resolve SDK generation errors; customize TypeSpec; rename SDK client or model; hide operation from SDK; fix analyzer errors; resolve customization drift; create subclient; update metadata; update version WHEN: "generate SDK locally", "build SDK", "run SDK tests", "update changelog", "fix SDK build errors", "fix breaking changes", "resolve SDK generation errors", "customize TypeSpec", "rename SDK client", "rename SDK model", "hide operation from SDK", "fix analyzer errors", "resolve customization drift", "create subclient", "update metadata", "update version" DO NOT USE FOR: publishing to package registries, CI pipeline configuration, API design review

Rules

  • Requires the azure-sdk-mcp server for the MCP workflow; without MCP, use npm exec --prefix eng/common/tsp-client -- tsp-client CLI.
  • Verify the target language repo and the correct TypeSpec configuration file before generation.
  • After generation or customization, run the check and test steps before updating metadata or finalizing changes.

MCP Tools

Tool Purpose
azure-sdk-mcp:azsdk_verify_setup Verify environment
azure-sdk-mcp:azsdk_package_generate_code Generate SDK
azure-sdk-mcp:azsdk_package_build_code Build package
azure-sdk-mcp:azsdk_package_run_check Validate package
azure-sdk-mcp:azsdk_package_run_tests Run tests
azure-sdk-mcp:azsdk_customized_code_update Apply customizations (includes regeneration and build)
azure-sdk-mcp:azsdk_package_update_changelog_content Update changelog
azure-sdk-mcp:azsdk_package_update_metadata Update metadata including ci.yml
azure-sdk-mcp:azsdk_package_update_version Update version

Prerequisites: azure-sdk-mcp server must be running. Without MCP, use npx tsp-client CLI.

Steps

  1. Select language — Confirm target language: .NET, Java, JavaScript, Python, Go, or Rust.
  2. Verify repo — Ensure the user has a local clone of the correct SDK repo. If not cloned, instruct user to clone it.
  3. Identify config file — Determine the path to the TypeSpec configuration file. See config file details.
    • From azure-rest-api-specs repo: use path to tspconfig.yaml.
    • From an SDK language repo: use path to tsp-location.yaml.
  4. Verify setup — Run azure-sdk-mcp:azsdk_verify_setup to confirm environment.
  5. Generate — Run azure-sdk-mcp:azsdk_package_generate_code with the config file path.
  6. Build — Run azure-sdk-mcp:azsdk_package_build_code. If build succeeds, proceed to step 8.
  7. Customize — If build fails, or if user requests SDK modifications, run azure-sdk-mcp:azsdk_customized_code_update with the build errors or user request. The tool handles the full workflow internally: it classifies the issue, applies TypeSpec decorators and/or code patches, regenerates the SDK, and builds — all in one call. See customization workflow.
  8. Commit checkpoint — Prompt the user to commit generated changes before proceeding. See commit checkpoint details.
  9. Validate — Run azure-sdk-mcp:azsdk_package_run_check and azure-sdk-mcp:azsdk_package_run_tests.
  10. Metadata — Run azure-sdk-mcp:azsdk_package_update_changelog_content, azure-sdk-mcp:azsdk_package_update_metadata, and azure-sdk-mcp:azsdk_package_update_version. (Note: For .NET data plane, skip this step — metadata, changelog, and version updates are per-commit tasks, not part of the generate/build/test workflow.)
  11. Final commit — Prompt the user to commit final changes (changelog, metadata, version). See commit checkpoint details.

SDK repos | Customization workflow | Detailed workflow

Guardrails

  • NEVER modify generated SDK code files directly for customizations. Always use azure-sdk-mcp:azsdk_customized_code_update. It handles classification, TypeSpec decorators, code patches, regeneration, and build as a single atomic workflow.
  • If azure-sdk-mcp:azsdk_customized_code_update fails or times out, report the error to the user and suggest retrying. Do not attempt to replicate its behavior by editing files manually.
  • Only the customization tool understands the correct layering of TypeSpec decorators vs code patches and ensures regenerated code stays consistent.

Examples

  • "Generate the SDK locally for my TypeSpec service"
  • "Build and test the Python SDK package"
  • "Run CI checks for my SDK package"
  • "Fix the SDK build errors on this PR"
  • "The SDK generation has breaking changes, resolve them"
  • "Rename FooClient to BarClient for .NET"
  • "Hide the internal polling operation from the Python SDK"
  • "Fix .NET analyzer errors AZC0030 and AZC0012"
  • "The build is failing because a customization references a renamed property"
  • "Create a subclient architecture for the Python SDK"
  • "Apply TypeSpec customizations to fix compilation errors"
  • "Update the changelog for this SDK package"
  • "Update the package version"
  • "Update the package metadata and ci.yml"

Troubleshooting

  • Run azure-sdk-mcp:azsdk_verify_setup to confirm MCP and tools.
  • If build fails with type conflicts, breaking changes, analyzer errors, or customization drift, use azure-sdk-mcp:azsdk_customized_code_update to apply customizations.
  • The customization tool uses a two-phase approach: TypeSpec decorators first (Phase A), then code repairs if needed (Phase B).
  • If azure-sdk-mcp:azsdk_customized_code_update fails or times out, report the error and retry. Do not manually edit generated SDK code — manual edits will be overwritten on the next regeneration.
  • Without MCP, use npx tsp-client CLI.

04 同仓库更多 Skills

Azure
Azure/azure-sdk-for-net

WebPubSub Chat API 基线维护

update-chat-api

使用场景:在公共 API 发生变更后,更新、导出、刷新或验证 Azure.Messaging.WebPubSub.Chat 的公共 API 基线。

软件开发工程师代码实现
★ 6.1k
Azure
Azure/azure-sdk-for-net

Azure 搜索文档 SDK 端到端工作流

search-documents

Azure.Search.Documents SDK 的端到端(E2E)工作流技能(TypeSpec + 大量定制)。处理完整发布周期和部分更新:SHA 更新;代码生成;构建;定制修复;ServiceVersion 同步;测试;API 导出;变更日志;版本;示例;格式化;发布元数据。使用场景:为 Azure.Search.Documents 创建新包版本;重新生成 Azure.Search.Documents;修复 Azure.Search.Documents 错误;发布 Azure.Search.Documents;更新 Azure.Search.Documents 规范。不适用于 Azure.ResourceManager.Search 或 Azure.Provisioning.Search。

软件开发工程师Microsoft 应用生命周期管理
★ 6.1k
Azure
Azure/azure-sdk-for-net

Search.Documents 版本差异检测

search-documents-version-diff

将当前 Azure.Search.Documents 公共 API 接口与之前发布的版本进行对比,检测因 TypeSpec 变更后 SDK 自定义层未向上传播而导致的预览版之间的回归。当用户要求比较 Azure.Search.Documents 各 beta 版本、确认 Azure.Search.Documents 预览功能未丢失、审计 Azure.Search.Documents 各版本间的回归、对 Azure.Search.Documents 发布分支进行健全性检查,或排查 Azure.Search.Documents 预览功能缺失时使用——即使用户没有提到“diff”一词。专门捕获丢失的包装器(QueryAnswer/QueryCaption/QueryRewrites 类型)、丢失的 SearchOptions 聚合重定向器、`@@access("internal")` 翻转、被直接删除而非通过条件门控的 `#if AZURE_SEARCH_PREVIEW` 代码块、丢失的 `ServiceVersion` 枚举值,以及便捷方法降级为协议方法等问题。

软件开发工程师测试与质量保障
★ 6.1k
Azure
Azure/azure-sdk-for-net

Search.Documents TypeSpec 一致性验证

search-documents-typespec-validation

面向 Azure.Search.Documents SDK 的 TypeSpec 验证技能。针对任意固定 commit 的 TypeSpec 定义,对全部操作、全部模型、全部枚举和全部属性执行完整验证。适用于任何 API 版本。生成完整的差距报告:缺失功能、多余功能、命名不匹配以及建议的修复位置。适用场景:“根据 TypeSpec 验证 Azure.Search.Documents SDK”、“检测 Azure.Search.Documents TypeSpec 功能差距”、“Azure.Search.Documents SDK 缺少哪些功能”、“将 Azure.Search.Documents SDK 与规范对比”、“对 Azure.Search.Documents 进行完整的规范覆盖审计”。请勿用于版本间差异对比或回归检测——此类情况请使用 search-documents-version-diff。

软件开发工程师测试与质量保障
★ 6.1k
Azure
Azure/azure-sdk-for-net

掷骰子技能文件测试

test-skill_file

使用随机数生成器掷骰子。

普通用户抽奖活动与随机抽取
★ 6.1k
Azure
Azure/azure-sdk-for-net

随机数掷骰子

roll-dice

使用随机数生成器掷骰子。当用户要求掷单个骰子(d6、d20 等)、掷骰子或生成随机掷骰结果时使用。

普通用户抽奖活动与随机抽取
★ 6.1k