mitigate-breaking-changes
Skill6.1k starsChanged 8 months agoMITView on GitHub
Patterns and techniques for mitigating breaking changes in Azure management-plane SDKs. Covers SDK-side customizations (partial classes, CodeGenType, CodeGenSuppress) and TypeSpec decorator customizations (clientName, access, markAsPageable, alternateType, hierarchyBuilding).
Trending
Quiet this year.thin dataabout the whole repository
Who's talking about Azure/azure-sdk-for-net
- Azure/Azurite“Add support for Blob Batch operations”GitHub · Nov 26, 2019 · 33 reactions
- microsoft/DockerTools“Cannot authenticate using DefaultAzureCredential when running in container”GitHub · Jul 5, 2022 · 27 reactions
- NixOS/nixpkgs“.NET Core tooling stops working due to `ñ` in release codename and lack of HTTP headers sanitization”GitHub · May 29, 2024 · 15 reactions
- dotnet/msbuild“Using ValueTuple with PackageReference on Azure Cloud Services”GitHub · Jul 27, 2018 · 15 reactions
- A Hacker News story“DocumentDB as not a service”Hacker News · Mar 9, 2015 · 2 points
The biggest 5 of 9 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 9
Talked about on GitHub, Bluesky and Hacker News (9 times).
On GitHub · 4
- Nov 26, 2019Add support for Blob Batch operations — Azure/Azurite33 reactions · 15 comments
- Jul 5, 2022Cannot authenticate using DefaultAzureCredential when running in container — microsoft/DockerTools27 reactions · 12 comments
- May 29, 2024.NET Core tooling stops working due to `ñ` in release codename and lack of HTTP headers sanitization — NixOS/nixpkgs15 reactions · 29 comments
- Jul 27, 2018Using ValueTuple with PackageReference on Azure Cloud Services — dotnet/msbuild15 reactions · 8 comments
On Bluesky · 4
- Nov 27, 2024📦 Azure / azure-sdk-for-net ⭐ 5,492 (+1) 🗒 C# This repository is for active development of the Azure SDK for .NET. For consumers of the… — @github-trending.bsky.social1 likes and repost
- Oct 26, 2024📦 Azure / azure-sdk-for-net ⭐ 5,378 (+2) 🗒 C# This repository is for active development of the Azure SDK for .NET. For consumers of the… — @github-trending.bsky.social1 likes and repost
- Jun 14, 2024📦 Azure / azure-sdk-for-net ⭐ 5,089 (+2) 🗒 C# This repository is for active development of the Azure SDK for .NET. For consumers of the… — @github-trending.bsky.social1 likes and repost
- Apr 30, 2024📦 Azure / azure-sdk-for-net ⭐ 4,985 (+2) This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we… — @github-trending.bsky.social1 likes and repost
On Hacker News · 1
- Mar 9, 2015DocumentDB as not a service2 points
In this repository20 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- agentic-workflowsSkill
- analyze-ci-failuresSkill
- auto-build-repairSkill
- azsdk-common-apiview-feedback-resolutionSkill
- azsdk-common-generate-sdk-locallySkill
- azsdk-common-pipeline-analysisSkill
- azsdk-common-pipeline-fixerSkill
- azsdk-common-prepare-release-planSkill
- azsdk-common-sdk-releaseSkill
- azure-sdk-mgmt-pr-reviewSkill
- csharp-azure-spector-coverage-gapsSkill
- dpg-migrationSkill
- find-package-skillSkill
- mgmt-review-comment-resolutionSkill
- ownersSkill
- pre-commit-checksSkill
- provisioning-library-generationSkill
- refresh-arm-sdk-releaseSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
19 rules. About 0 are common, 5 are distinctive, and 14 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
14
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
When invoked from azsdk-common-sdk-breaking-change, use the .NET pattern catalog and the original azsdk_package_detect_breaking_change …
- Distinctive: line 36
After a change, regenerate and compile fresh artifacts as needed, rerun the standalone detector, then run ordinary builds, analyzers, and …
- Distinctive: line 38
Do not treat a missing GA baseline, stale artifact, or detector failure as a compatibility pass.
- Distinctive: line 43
Use Custom/*.cs or Customization/*.cs partial classes (follow the package's existing structure) for .NET-side fixes.
- Distinctive: line 46
Keep custom code types split into separate files:
- Very specific: line 47
Put each custom type/partial type in its own .cs file.
- Very specific: line 50
Do not group multiple compatibility types in a single broad file such as Compatibility.cs.
- Very specific: line 65
When a generated type is internal and @@access in client.tsp doesn't work (common for nested/wrapper types), use [CodeGenType] in Custom …
- Very specific: line 111
Add using Azure.ClientGenerator.Core.Legacy.
- Very specific: line 112
Add #suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "migration" before each @@markAsPageable call
- Very specific: line 113
After adding the decorator, regenerate and remove any custom [CodeGenSuppress] + SinglePagePageable wrapper code
- Very specific: line 116
When the spec uses older common types that generate incorrect C# types (e.g., string instead of ResourceIdentifier for ID properties), use …
- Very specific: line 122
Do not use @@hierarchyBuilding for C# base-model/base-type compatibility.
- Distinctive: line 148
After adding the decorator, regenerate the SDK code
- Very specific: line 165
When the previous SDK version included WirePathAttribute on model properties (used by Azure.Provisioning libraries), regeneration may …
- Very specific: line 174
Add enable-wire-path-attribute: true to the mgmt emitter options in tspconfig.yaml (in the spec repo):
- Very specific: line 186
If the remaining ApiCompat diff is only WirePathAttribute removal, it is acceptable to add targeted entries to the centralized baseline …
- Very specific: line 188
Do not create a local ApiCompatBaseline.txt, do not baseline unrelated ApiCompat errors, and do not disable ApiCompat.
- Very specific: line 198
When a sub-resource operation (e.g., getting a report under an assignment) uses Read<> or Extension.Read<> templates, the ARM library …
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Skill: mitigate-breaking-changes
Patterns and techniques for mitigating breaking changes when regenerating Azure management-plane .NET SDKs. Use these to preserve backward compatibility in the generated SDK surface.
When Invoked
Trigger phrases: "mitigate breaking changes", "fix breaking change", "customization patterns", "how to keep backward compat", "CodeGenType", "CodeGenSuppress", "markAsPageable", "hierarchyBuilding", "base type change".
Common breaking-change workflow
When invoked from azsdk-common-sdk-breaking-change, use the
.NET pattern catalog and the original
azsdk_package_detect_breaking_change result. Preserve the ApiCompat diagnostics,
previous signatures, additions, and originBreaks; a removal/addition pair is
not proof of a rename.
- For a user-selected
mitigation: generatorchange, verify the documented preconditions and matching previous contract. Reuse the management generator's existing conditional-header and model-factory compatibility overload support. Regenerate; do not write a second synthesizer or patch generated files. - For
mitigation: client customization, useazsdk_customized_code_updatewith the user's selected change and permitted edit scope.CustomCodecannot edit TypeSpec inputs or change the pinned spec commit;SpecChangeRequiredrequires a spec-owner handoff, not an automatic retry with broader scope. - For
mitigation: manual, missing evidence, or unsupported generator output, explain the decision needed and stop automatic mitigation.
This skill's ARM patterns are management-specific. Do not apply resource hierarchy, ARM identifier, or conditional-header transformations to data-plane libraries without separately verified support.
After a change, regenerate and compile fresh artifacts as needed, rerun the standalone detector, then run ordinary builds, analyzers, and tests separately. Do not treat a missing GA baseline, stale artifact, or detector failure as a compatibility pass. Never add suppressions without explicit owner approval.
SDK-Side Customizations (in SDK repo)
Use Custom/*.cs or Customization/*.cs partial classes (follow the package's existing structure) for .NET-side fixes.
Custom code file organization
Keep custom code types split into separate files:
- Put each custom type/partial type in its own
.csfile. - Name the file after the class it contains, for example
src/Custom/Models/MyModel.csforpublic partial class MyModel. - Align the custom code folder structure with the generated code structure, such as using
Models/for model customizations andExtensions/for extension customizations when those folders exist. - Do not group multiple compatibility types in a single broad file such as
Compatibility.cs; split them so each file name aligns with the class name.
Partial class (add members, suppress generated members)
// src/Custom/Models/MyModel.cs (or src/Customization/Models/MyModel.cs — follow the package's existing convention)
namespace Azure.ResourceManager.<Service>.Models
{
public partial class MyModel
{
// Add computed properties, rename via [CodeGenMember], etc.
}
}[CodeGenType] — Override accessibility or rename a generated type
When a generated type is internal and @@access in client.tsp doesn't work (common for nested/wrapper types), use [CodeGenType] in Custom code to make it public:
// src/Custom/Models/MyPublicModel.cs
using Microsoft.TypeSpec.Generator.Customizations;
namespace Azure.ResourceManager.<Service>.Models
{
[CodeGenType("OriginalTypeSpecModelName")]
public partial class MyPublicModel
{
}
}The [CodeGenType("...")] attribute takes the original TypeSpec model name (not the C# renamed name). This links the Custom partial class to the generated internal type and overrides its accessibility to public.
TypeSpec Decorator Customizations (in spec repo)
These decorators are added to client.tsp in the spec repo.
// Rename parameter
@@clientName(Operations.create::parameters.resource, "content");
// Rename path parameter
@@Azure.ResourceManager.Legacy.renamePathParameter(Resources.list, "fooName", "name");
// Mark a non-pageable list operation as pageable (returns Pageable<T> instead of Response<ListType>)
// Requires: using Azure.ClientGenerator.Core.Legacy;
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "migration"
@@markAsPageable(InterfaceName.operationName, "csharp");
// Suppress warning
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "migration"When to use @@markAsPageable
When the old SDK returned Pageable<T> / AsyncPageable<T> for a list operation, but the TypeSpec spec defines the operation as non-pageable (returns a wrapper list type like FooList), use @@markAsPageable to make the generator produce pageable methods. This is preferred over writing custom SinglePagePageable<T> wrapper code because:
- It reduces custom code that must be maintained
- The generated pageable implementation handles diagnostics, cancellation, and error handling correctly
- It keeps the SDK surface consistent with other generated methods
Do NOT use @@markAsPageable if the operation is already marked with @list — the @list decorator already makes the operation pageable, and adding @@markAsPageable will cause a compile error. Check the spec's operation definition before adding the decorator.
Requirements:
- Add
using Azure.ClientGenerator.Core.Legacy;to theclient.tspimports - Add
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "migration"before each@@markAsPageablecall - After adding the decorator, regenerate and remove any custom
[CodeGenSuppress]+SinglePagePageablewrapper code
@@alternateType Decorator
When the spec uses older common types that generate incorrect C# types (e.g., string instead of ResourceIdentifier for ID properties), use @@alternateType:
@@alternateType(MyModel.resourceId, Azure.ResourceManager.CommonTypes.ArmResourceIdentifier, "csharp");@@hierarchyBuilding Decorator — Legacy base-type override
Do not use @@hierarchyBuilding for C# base-model/base-type compatibility. First verify resource-hierarchy parity, fix structural resource hierarchy issues in the TypeSpec resource shape, and use SDK-side custom code only for C# base-model/base-type compatibility after the generated surface is stable.
@@hierarchyBuilding is a legacy escape hatch. Use it only with explicit owner approval when no TypeSpec resource-shape fix or SDK-side customization is appropriate.
Syntax:
// Requires: using Azure.ClientGenerator.Core.Legacy;
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "Change the base type back to <TargetBase> for backward compatibility"
@@Azure.ClientGenerator.Core.Legacy.hierarchyBuilding(MyResource,
Azure.ResourceManager.Foundations.TrackedResource,
"csharp"
);Common target base types:
Azure.ResourceManager.Foundations.TrackedResource— generatesTrackedResourceData(for resources with location and tags)Azure.ResourceManager.Foundations.ProxyResource— generatesResourceData(for proxy/child resources)Azure.ResourceManager.Foundations.Resource— generatesResourceData(ARM resource base)
Legacy-only scenarios that require explicit approval:
- The old SDK had
MyData : ResourceDataorMyData : TrackedResourceData, the regenerated SDK producesMyData : SomeOtherType(e.g., a service-localResourcemodel), and the owner has explicitly rejected the normal resource-shape and SDK-customization fixes. - The
CannotRemoveBaseTypeOrInterfaceAPI compatibility violation remains after verifying resource-hierarchy parity and attempting the normal SDK-side customization approach.
Requirements:
- Add
using Azure.ClientGenerator.Core.Legacy;to theclient.tspimports - Add
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "..."before each@@hierarchyBuildingcall - After adding the decorator, regenerate the SDK code
Legacy-approved example (from Key Vault):
import "@azure-tools/typespec-client-generator-core";
using Azure.ClientGenerator.Core.Legacy;
// Fix Vault resource to generate VaultData : TrackedResourceData
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "Change the base type back to TrackedResource for backward compatibility"
@@Azure.ClientGenerator.Core.Legacy.hierarchyBuilding(Vault,
Azure.ResourceManager.Foundations.TrackedResource,
"csharp"
);WirePathAttribute Breaking Changes
When the previous SDK version included WirePathAttribute on model properties (used by Azure.Provisioning libraries), regeneration may produce ApiCompat CannotRemoveAttribute errors for the missing attribute because the emitter defaults to not generating it.
How to detect
- ApiCompat
CannotRemoveAttributeerrors referencingWirePathAttributeon model properties - These errors appear during
dotnet pack --no-restorewhen the previous SDK release hadWirePathAttributeon properties but the new generation does not
Fix
Add enable-wire-path-attribute: true to the mgmt emitter options in tspconfig.yaml (in the spec repo):
options:
"@azure-typespec/http-client-csharp-mgmt":
emitter-output-dir: "{output-dir}/{service-dir}/{namespace}"
namespace: "Azure.ResourceManager.<Service>"
enable-wire-path-attribute: trueThen regenerate the SDK.
If the remaining ApiCompat diff is only WirePathAttribute removal, it is acceptable to add targeted entries to the centralized baseline file under eng/apicompatbaselines/<Project>.xml. Do not add SDK custom code just to restore WirePathAttribute; the maintenance cost is not worth it for this compatibility diff.
Do not create a local ApiCompatBaseline.txt, do not baseline unrelated ApiCompat errors, and do not disable ApiCompat.
Extension Resources
Extension resources (deployed onto parent resources from different providers) require special handling.
Parameterized Scopes
When the same resource type can be deployed onto multiple parent types (e.g., VM, HCRP, VMSS), use OverrideResourceName with parameterized scopes. Each scope generates a separate SDK resource type. The generator may produce duplicate GetXxxResource() methods in MockableArmClient when multiple entries exist for the same resource — this is a known generator bug requiring deduplication.
Sub-Resource Operations: Avoid Read<> / Extension.Read<> for Non-Lifecycle Ops
When a sub-resource operation (e.g., getting a report under an assignment) uses Read<> or Extension.Read<> templates, the ARM library treats it as a lifecycle read operation. This causes:
- The resource's
resourceTypeandresourceIdPatternto be set to the sub-resource path - Collections using the wrong REST client
- Compile errors: CS1729 (wrong constructor), CS0029 (type mismatch), CS1503 (wrong argument)
Fix: Change sub-resource Get operations from Read<> to ActionSync<> (or Extension.ActionSync<> for extension resources) with a @get decorator:
// WRONG — ARM library treats this as lifecycle Read
reportGet is Ops.Read<Resource, Response = ArmResponse<Report>, ...>;
// CORRECT — ActionSync with @get avoids lifecycle misclassification
@get reportGet is Ops.ActionSync<Resource, void, Response = ArmResponse<Report>, ...>;Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

