Azure SDK .NET 代码审查
code-review
必须对每一次 Azure SDK for .NET 代码审查使用本技能。适用场景:审查此 PR 或拉取请求;审查我的更改、diff、patch 或提交;API 审查;PR 前审查;GitHub Copilot 自动审查。执行开放式的 bug、安全、正确性、可靠性与可维护性分析,以及 Azure SDK API 设计、分析器、打包、测试、文档和生成代码检查。根据所属库应用管理平面(management-plane)指导原则。
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 6.1k
- Forks
- 5.2k
01 前言 Front Matter
- name
- code-review
- description
- MUST USE for every Azure SDK for .NET code review. WHEN: review this PR or pull request; review my changes, diff, patch, or commit; API review; pre-PR review; automatic GitHub Copilot review. Performs open-ended bug, security, correctness, reliability, and maintainability analysis plus Azure SDK API design, analyzer, packaging, testing, documentation, and generated-code checks. Applies management-plane guidance per owning library.
02 资源文件 6
- 参考文档evals/management.eval.yaml30.7 KB
- 参考文档evals/precision.eval.yaml37.3 KB
- 参考文档evals/trigger.eval.yaml2.5 KB
- 参考文档references/naming-rules.md17.4 KB
- 参考文档references/repository-rules.md51.2 KB
- 参考文档references/review-quality.md13.3 KB
03 SKILL.md 正文
Azure SDK for .NET Code Review
Perform a comprehensive code review using both the review agent's normal open-ended analysis and the Azure SDK for .NET-specific rules in this skill.
The rules are additional minimum checks, not an exhaustive checklist. Never narrow the review to only the cases named in the references.
Package Context
For library-owned changes, identify the shipping library from project/package metadata and
established repository naming. Apply the management-specific clauses when its package ID is
Azure.ResourceManager or starts with Azure.ResourceManager.. A matching namespace, dependency,
or PR title alone does not establish ownership.
Review shared tooling and configuration by their affected libraries rather than forcing a single package owner.
Classify each library independently. Associate tests and samples with their owning
library, but review them in their own roles rather than as additional shipping API surfaces.
For the Azure.ResourceManager framework package, judge the actual framework role rather than
assuming every type is a service-specific resource or request model.
Non-Negotiable Review Quality
- Review changed code and consequences caused by it. Do not mine unrelated, unchanged code.
- Read the PR description, linked issues, existing reviews, and resolved or outdated threads before commenting. Do not duplicate feedback or relitigate a settled decision without new evidence.
- Establish the local convention from surrounding code and repository configuration before judging a diff hunk.
- Every finding needs direct evidence, a concrete consequence, and a recommended correction.
- Check every documented exception and allowed case. Try to disprove a candidate finding before reporting it.
- Do not repeat a diagnostic that normal CI or analyzers will already report unless the PR changes the enforcement or adds an opt-out, suppression, baseline, allow-list entry, or equivalent escape hatch.
- Omit generic advice, speculative concerns, and observations that do not require a change.
- It is valid to return no findings.
Read references/review-quality.md for the portable hard rules and general evidence checks.
Rule Layers
Apply the following layers. A more-specific repository rule wins over a general rule, but never
relaxes the hard breaking-change or Framework Design Guideline rules in review-quality.md.
- Open-ended review: bugs, security, correctness, reliability, concurrency, resource lifetime, tests, performance, and maintainability.
- Hard rules:
references/review-quality.md. - Azure SDK repository rules: relevant sections of
references/repository-rules.mdandreferences/naming-rules.md, including management-specific clauses for the owning library. - Derived convention: local project, then repository, then ecosystem practice.
Do not emit duplicate findings when multiple layers identify the same problem.
Workflow
1. Identify the change and gather context
Determine the changed files and the intended behavior. For a PR, read its description, linked issues, prior review submissions, and all review threads before forming findings.
On a re-review, focus on commits and replies added since the previous review. Do not re-report old findings or narrate fixes.
Released baselines are comparison evidence; novelty since a release alone does not put an API in scope. Recover existing or prior baseline metadata when an in-scope comparison needs it. If that evidence is unavailable, state the limitation rather than inventing a baseline or a finding.
2. Load only the relevant repository-rule sections
Use the changed paths and symbols to select sections from references/repository-rules.md and references/naming-rules.md:
| Changed area | Sections to consult |
|---|---|
Root configuration, eng/**, shared props/targets |
Authoritative Guidelines; Shared Configuration; Analyzer Warnings and Suppressions; Packaging, Versioning, Dependencies |
.github/CODEOWNERS*, labels, ownership files |
CODEOWNERS and Labels |
api/*.cs, new or changed public/protected API |
Breaking Changes; Client Design; Naming; Semantic Value Types; Commonly Overlooked; Generated Code; Packaging, Versioning, Dependencies |
Client or model implementation under src/** |
Client Design; Naming; Semantic Value Types; Analyzer Warnings and Suppressions; Implementation; Packaging, Versioning, Dependencies |
| Client or credential construction: a new constructor, parameter, options property, or credential type, or new supported values, identity kinds, or hosts — also when only the changelog or PR description shows it | Client Design; Testing |
| Management library | Applicable sections above; management clauses in Naming and Packaging, Versioning, Dependencies |
| Tests, test projects, test infrastructure | Analyzer Warnings and Suppressions; Testing |
.csproj, package versions, references, feeds, CPM files |
Shared Configuration; Packaging, Versioning, Dependencies |
CHANGELOG.md |
Packaging, Versioning, Dependencies |
| README, samples, snippets, doc settings, links | Docs & Samples; Broken-Link Ignores |
| Generated output, TypeSpec/AutoRest configuration | Generated Code; Breaking Changes; Naming; Semantic Value Types |
Consult additional sections whenever the diff crosses concerns. Do not load an unrelated section merely to manufacture findings.
3. Perform three passes
- Open-ended pass: inspect the change without using the rule list as a boundary. Look for incorrect behavior and risks the written rules did not anticipate.
- Repository-rule pass: apply the relevant Azure SDK checks systematically.
- Falsification pass: challenge every candidate finding against surrounding code, CI/analyzer coverage, prior discussion, documented exceptions, and legitimate allowed cases.
4. Filter and report
Report only findings that survive all three passes.
For every finding:
- Prefer the most specific changed source or generator-input line that causes the issue. Use an API-listing line when it is the only suitable changed anchor; identify the real fix location and never recommend hand-editing the listing.
- State what can concretely go wrong.
- Recommend the smallest correct change.
- Use 🔴 for correctness, security, or breaking changes; 🟡 for actionable non-critical repository violations; ℹ️ only for a question that must be answered before correctness can be determined. A marker on a rule in the reference files overrides this; an unmarked rule is graded by this rubric and never defaults to ℹ️.
- Do not narrate the review process.
When no candidate survives the evidence filter, leave no comments.
References
04 同仓库更多 Skills
WebPubSub Chat API 基线维护
update-chat-api
使用场景:在公共 API 发生变更后,更新、导出、刷新或验证 Azure.Messaging.WebPubSub.Chat 的公共 API 基线。
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。
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` 枚举值,以及便捷方法降级为协议方法等问题。
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。
掷骰子技能文件测试
test-skill_file
使用随机数生成器掷骰子。
随机数掷骰子
roll-dice
使用随机数生成器掷骰子。当用户要求掷单个骰子(d6、d20 等)、掷骰子或生成随机掷骰结果时使用。