sdk/cosmos/.github/skills/cosmos-pre-commit-validation/SKILL.md
Run pre-commit checks for a specific set of crates. Use this when validating changes under sdk/cosmos before committing or during code review.
npx skillsauth add azure/azure-sdk-for-rust cosmos-pre-commit-validationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill when:
sdk/cosmos/**Follow these steps strictly:
Determine the target path:
scope argument is specified and is not equal (case-insensitive) to all or *, set the target path to sdk/cosmos/<scope> (for example, if scope is azure_data_cosmos, use sdk/cosmos/azure_data_cosmos as the target path).sdk/cosmos.Determine file scope:
changed-only is true (the default), restrict scanning to .rs files that differ between the current local branch and main. Use git diff --name-only main -- <target path> (and include per-crate tests/ directories) to obtain the list. Only .rs files in the result set are scanned; all other files are skipped.changed-only is false, scan all .rs files under the target path(s).generated/ subdirectories — these are produced by external tools and must never be modified.Validate using the Pre-Completion Validation Checklist in sdk/cosmos/AGENTS.md:
-D warnings) to match CI behavior.
Run clippy with RUSTFLAGS=-D warnings set:
RUSTFLAGS='-D warnings' cargo clippy -p <crate> --all-features --all-targets$env:RUSTFLAGS='-D warnings'; cargo clippy -p <crate> --all-features --all-targets; $env:RUSTFLAGS=$nullauto-fix is true and clippy or other tools modified files,
re-run cargo fmt to ensure the auto-fixed code is properly formatted (e.g., cargo clippy --fix can
leave trailing blank lines when removing unused imports)..vscode/cspell.json
with the Cosmos-specific dictionary at sdk/cosmos/.dict.txt. Run locally with:
npx cspell lint --config .vscode/cspell.json --no-must-find-files <target path>/**
If auto-fix is true and unknown words are legitimate (e.g., API type names, technical terms),
add them to sdk/cosmos/.dict.txt.cfg flags that CI sets but local builds omit.
These tests will silently pass cargo test locally even if they contain build errors.
Run the following checks to catch regressions before CI does:
RUSTFLAGS='--cfg test_category="emulator"' cargo check -p azure_data_cosmos --features fault_injection,key_auth,allow_invalid_certificates --testsRUSTFLAGS='--cfg test_category="multi_write"' cargo check -p azure_data_cosmos --features fault_injection,key_auth --tests
On Windows (PowerShell), set the env var first: $env:RUSTFLAGS='--cfg test_category="emulator"' then run the cargo check command, and clear it afterwards with $env:RUSTFLAGS=$null.
These commands only compile the test targets — they do not run the emulator or multi-write tests (those require a live Cosmos DB emulator or multi-region account).
If scope targets a specific crate other than azure_data_cosmos, skip these checks.Report results:
auto-fix argument is truesdk/cosmosdevelopment
Enforce consistent struct design conventions across sdk/cosmos crates. Validates visibility modifiers, field privacy, #[non_exhaustive] usage, and construction API patterns (`Default`/`new` with `with_*` setters, or optional separate builders with `builder()`/`build()`), and construction correctness on public structs. Can auto-fix violations or report them as errors.
tools
Update the TypeSpec emitter for Rust and optionally regenerate all clients
tools
Check and fix formatting and other issues in markdown files using markdownlint-cli2.
development
Create a new Azure SDK crate from a TypeSpec specification.