agentleFS
Microsoft AzureKnown publisherAzure/azure-sdk-for-net/.github/skills/pre-commit-checks/SKILL.md

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

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 0 mentionsApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 0 mentionsSep 2026: 0 mentionsOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the Azure/azure-sdk-for-net repository that our weekly crawl found: only 9 in all, so this is a hint, not a trend. There is no adoption data for this file yet.

Who's talking about Azure/azure-sdk-for-net

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

On Bluesky · 4

On Hacker News · 1

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
  1. Very specific:

    Run these checks after making changes to SDK packages under sdk/ and before staging, committing, or pushing.

    line 8
  2. Distinctive:

    Trigger condition — for each affected package's src csproj: Run this if ANY of the following files are in the changed file list:

    line 36
  3. Very specific:

    Important: Do not manually edit files under src/Generated/.

    line 43
  4. Distinctive:

    Trigger condition — per ServiceDirectory: Run this if ANY of the following are true for ANY affected package within this ServiceDirectory:

    line 55
  5. Distinctive:

    Trigger condition — for each affected ServiceDirectory: Run this if ANY of the following are true:

    line 84
  6. Distinctive:

    After running all applicable steps for all affected projects and ServiceDirectories, check for new/modified files with git status.

    line 101
  7. Distinctive:

    All changes produced by these steps must be included in the commit.

    line 102
  8. Distinctive:

    Do NOT commit if any of the above steps failed.

    line 103
  9. Distinctive:

    Run the following steps in this order, respecting their scope (per package vs per ServiceDirectory):

    line 107
  10. Distinctive:

    When multiple packages/ServiceDirectories are affected, run steps 1–2 for each affected package, then steps 3–4 once per affected …

    line 114

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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 combining git diff --name-only HEAD with git 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.yaml
  • sdk/{service}/{package}/src/autorest.md
  • Any .cs file under sdk/{service}/{package}/src/ where a CodeGen* 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:GenerateCode

This 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 .cs files under sdk/{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 public or protected types (class, interface, struct, enum, record).
    • New, removed, or changed signatures of public or protected members (methods, properties, constructors, events, fields).
    • Visibility changes (e.g., internal → public).
    • Changes to base classes or implemented interfaces on public types.
    • New .cs files under src/ that contain public types.

Skip Export-API if changes are limited to:

  • Method body implementations (no signature changes).
  • internal or private members only.
  • XML doc comments or code comments.
  • .csproj configuration 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 *.md files under sdk/{service}/ contain snippet references (```C# Snippet: markers).
  • Changed .cs files 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):

  1. dotnet format first — run on all changed csproj files (src, tests, etc.) for each affected package.
  2. GenerateCode second — per src csproj, regenerates from specs (may override format changes in Generated/) for each affected package.
  3. Export-API third — run once per affected ServiceDirectory, after all GenerateCode runs for packages in that ServiceDirectory are complete; captures the final public API surface after generation.
  4. Update-Snippets fourth — 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.