pre-commit-checks
Skill6.1k starsChanged 8 months agoMITView on GitHub
Pre-commit validation checks for azure-sdk-for-net. Use this before committing or pushing changes to SDK packages. Runs dotnet format, exports public API listings, updates snippets, and regenerates code as needed.
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
- mitigate-breaking-changesSkill
- ownersSkill
- provisioning-library-generationSkill
- refresh-arm-sdk-releaseSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 8 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 8
Run these checks after making changes to SDK packages under sdk/ and before staging, committing, or pushing.
- Distinctive: line 36
Trigger condition — for each affected package's src csproj: Run this if ANY of the following files are in the changed file list:
- Very specific: line 43
Important: Do not manually edit files under src/Generated/.
- Distinctive: line 55
Trigger condition — per ServiceDirectory: Run this if ANY of the following are true for ANY affected package within this ServiceDirectory:
- Distinctive: line 84
Trigger condition — for each affected ServiceDirectory: Run this if ANY of the following are true:
- Distinctive: line 101
After running all applicable steps for all affected projects and ServiceDirectories, check for new/modified files with git status.
- Distinctive: line 102
All changes produced by these steps must be included in the commit.
- Distinctive: line 103
Do NOT commit if any of the above steps failed.
- Distinctive: line 107
Run the following steps in this order, respecting their scope (per package vs per ServiceDirectory):
- Distinctive: line 114
When multiple packages/ServiceDirectories are affected, run steps 1–2 for each affected package, then steps 3–4 once per affected …
≈ “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
Pre-Commit Validation Checks
Run these checks after making changes to SDK packages under sdk/ and before staging, committing, or pushing. These steps may produce additional file changes that must be included in the commit.
General rule: Steps 3–5 are conditional to save time, but if you are unsure whether a step is needed, always run it. It is better to run an unnecessary script than to miss a required regeneration.
1. Determine scope from changed files
- Derive the changed file list from
git status --porcelain(or by combininggit diff --name-only HEADwithgit ls-files -o --exclude-standard) so that untracked (new) files are included. - From the changed file list, extract all unique ServiceDirectories — the first path segment after
sdk/(e.g.,sdk/storage/...→storage,sdk/ai/...→ai). - For each ServiceDirectory, identify all affected packages = distinct
sdk/{ServiceDirectory}/{PackageName}/paths. - For each affected package, identify:
- All csproj files that had changes beneath them (src, tests, samples, perf, stress, or any other project type).
- The src csproj specifically =
sdk/{service}/{package}/src/{Package}.csproj— this is used for GenerateCode.
- The remaining steps must be run for each affected project/ServiceDirectory. If changes span multiple ServiceDirectories or packages, run for each one.
2. Run dotnet format (for every changed csproj)
For every csproj that had files change beneath it — src, tests, samples, perf, stress, or any other project type — run:
dotnet format <path-to-changed.csproj>Identify affected csproj files by looking at the full changed file list: include any project where either (a) there is a changed .cs file with that .csproj as its nearest parent, or (b) the .csproj itself changed, or files such as .props, .targets, or .md changed under that project. This fixes style/formatting issues and may modify .cs files.
3. Conditionally run dotnet build /t:GenerateCode (per src csproj)
Exclusion: Skip this step entirely for the provisioning service directory. Provisioning libraries use their own generator and are not generated via TypeSpec/AutoRest.
Trigger condition — for each affected package's src csproj: Run this if ANY of the following files are in the changed file list:
- Any file matching
sdk/{service}/{package}/src/Generated/** sdk/{service}/{package}/tsp-location.yamlsdk/{service}/{package}/src/autorest.md- Any
.csfile undersdk/{service}/{package}/src/where aCodeGen*attribute was added, removed, or modified (e.g.,CodeGenType,CodeGenModel,CodeGenClient,CodeGenMember,CodeGenSuppress,CodeGenSerialization,CodeGenVisibility). These attributes in custom (non-generated) code influence the generated output.
Important: Do not manually edit files under src/Generated/. Changes to generated code should only come from running the GenerateCode target.
Command:
dotnet build sdk/{service}/{package}/src/{Package}.csproj /t:GenerateCodeThis regenerates code from TypeSpec/AutoRest specs. It may modify files under src/Generated/.
4. Conditionally run Export-API.ps1 (per ServiceDirectory)
Trigger condition — per ServiceDirectory: Run this if ANY of the following are true for ANY affected package within this ServiceDirectory:
- Step 3 above ran for any package in this ServiceDirectory (generated code may affect public API).
- Changed
.csfiles undersdk/{service}/{package}/src/for any package in this ServiceDirectory contain public API surface changes. To determine this, inspect the diffs for:- New, removed, or renamed
publicorprotectedtypes (class,interface,struct,enum,record). - New, removed, or changed signatures of
publicorprotectedmembers (methods, properties, constructors, events, fields). - Visibility changes (e.g.,
internal→public). - Changes to base classes or implemented interfaces on public types.
- New
.csfiles undersrc/that containpublictypes.
- New, removed, or renamed
Skip Export-API if changes are limited to:
- Method body implementations (no signature changes).
internalorprivatemembers only.- XML doc comments or code comments.
.csprojconfiguration changes.
Command:
eng\scripts\Export-API.ps1 {ServiceDirectory}This regenerates API listing files under sdk/{service}/{package}/api/*.cs. Uses dotnet build /t:ExportApi internally.
Note: Export-API operates at the ServiceDirectory level (not per-csproj), so run it once per affected ServiceDirectory.
5. Conditionally run Update-Snippets.ps1 (per ServiceDirectory)
Trigger condition — for each affected ServiceDirectory: Run this if ANY of the following are true:
- Changed
*.mdfiles undersdk/{service}/contain snippet references (```C# Snippet:markers). - Changed
.csfiles contain snippet regions (#region Snippet:).
Command:
eng\scripts\Update-Snippets.ps1 {ServiceDirectory}Note: Update-Snippets operates at the ServiceDirectory level (not per-csproj), so run it once per affected ServiceDirectory.
This runs snippet-generator to sync code snippets into markdown files. May modify *.md and *.cs files.
6. Verify and include all changes
- After running all applicable steps for all affected projects and ServiceDirectories, check for new/modified files with
git status. - All changes produced by these steps must be included in the commit.
- Do NOT commit if any of the above steps failed.
Execution order
Run the following steps in this order, respecting their scope (per package vs per ServiceDirectory):
dotnet formatfirst — run on all changed csproj files (src, tests, etc.) for each affected package.GenerateCodesecond — per src csproj, regenerates from specs (may override format changes in Generated/) for each affected package.Export-APIthird — run once per affected ServiceDirectory, after all GenerateCode runs for packages in that ServiceDirectory are complete; captures the final public API surface after generation.Update-Snippetsfourth — run once per affected ServiceDirectory, after Export-API; captures any snippet changes from all prior steps.
When multiple packages/ServiceDirectories are affected, run steps 1–2 for each affected package, then steps 3–4 once per affected ServiceDirectory. Step 6 (verify) runs once at the end.
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.

