cosmos-pre-commit-validation
Skill887 starsChanged 29 days agoMITView on GitHub
Run pre-commit checks for a specific set of crates. Use this when validating changes under sdk/cosmos before committing or during code review.
In this repository22 other files it gives its agents.
- AGENTS.mdAGENTS.md
- eng/tools/generate_api/AGENTS.mdAGENTS.md
- samples/AGENTS.mdAGENTS.md
- sdk/core/AGENTS.mdAGENTS.md
- sdk/cosmos/AGENTS.mdAGENTS.md
- sdk/cosmos/azure_data_cosmos_emulator/AGENTS.mdAGENTS.md
- sdk/cosmos/docs/AGENTS.mdAGENTS.md
- agentic-workflowsSkill
- analyze-codeSkill
- check-spellingSkill
- create-crateSkill
- create-hotfixSkill
- create-perf-testSkill
- create-recorded-testSkill
- document-cratesSkill
- export-apiSkill
- lint-markdownSkill
- prepare-releaseSkill
- review-doc-commentsSkill
- update-emitterSkill
- update-rustSkill
- cosmos-design-structSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 3 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 42
Use this skill when:
- Distinctive: line 50
Follow these steps strictly:
- Very specific: line 53
If the scope argument is specified and is not equal (case-insensitive) to all or *, set the target path to sdk/cosmos/<scope> (for example, …
- Very specific: line 57
If changed-only is true (the default), restrict scanning to .rs files that differ between the current local branch and main.
- Very specific: line 58
If changed-only is false, scan all .rs files under the target path(s).
- Very specific: line 65
Run clippy with RUSTFLAGS=-D warnings set:
- Very specific: line 68
Re-run formatting: after any auto-fix: if auto-fix is true and clippy or other tools modified files, re-run cargo fmt to ensure the …
- Very specific: line 75
If auto-fix is true and unknown words are legitimate (e.g., API type names, technical terms), add them to ignoreWords in …
- Very specific: line 85
If scope targets a specific crate other than azure_data_cosmos, skip these checks.
- Very specific: line 90
Do NOT auto-fix unless auto-fix argument is true
- Very specific: line 94
Never run repo-wide checks outside sdk/cosmos
- Distinctive: line 95
Avoid long-running integration tests unless explicitly requested
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
Cosmos SDK Pre-Commit Checks
When to use this skill
Use this skill when:
- Reviewing or validating changes in the Cosmos SDK
- Running pre-commit checks locally before pushing
- Performing focused code review on
sdk/cosmos/**
Behavior
Follow these steps strictly:
- Determine the target path:
- If the
scopeargument is specified and is not equal (case-insensitive) toallor*, set the target path tosdk/cosmos/<scope>(for example, ifscopeisazure_data_cosmos, usesdk/cosmos/azure_data_cosmosas the target path). - Otherwise, set the target path to
sdk/cosmos.
- If the
- Determine file scope:
- If
changed-onlyistrue(the default), restrict scanning to.rsfiles that differ between the current local branch andmain. Usegit diff --name-only main -- <target path>(and include per-cratetests/directories) to obtain the list. Only.rsfiles in the result set are scanned; all other files are skipped. - If
changed-onlyisfalse, scan all.rsfiles under the target path(s). - In both modes, skip files in
generated/subdirectories — these are produced by external tools and must never be modified.
- If
- Validate using the Pre-Completion Validation Checklist in
sdk/cosmos/AGENTS.md:- Formatting checks
- Build succeeds for affected crates
- Clippy lints pass for affected crates, with warnings treated as errors (
-D warnings) to match CI behavior. Run clippy withRUSTFLAGS=-D warningsset:- Bash:
RUSTFLAGS='-D warnings' cargo clippy -p <crate> --all-features --all-targets - PowerShell:
$env:RUSTFLAGS='-D warnings'; cargo clippy -p <crate> --all-features --all-targets; $env:RUSTFLAGS=$null
- Bash:
- Re-run formatting after any auto-fix: if
auto-fixis true and clippy or other tools modified files, re-runcargo fmtto ensure the auto-fixed code is properly formatted (e.g.,cargo clippy --fixcan leave trailing blank lines when removing unused imports). - Documentation builds successfully where applicable
- Spell check (cspell): CI runs cspell on all changed files using the root config at
.vscode/cspell.json; Cosmos-specific words are managed inignoreWordsinsdk/cosmos/.cspell.json. Run locally with:npx cspell lint --config sdk/cosmos/.cspell.json --no-must-find-files <target path>/**Ifauto-fixis true and unknown words are legitimate (e.g., API type names, technical terms), add them toignoreWordsinsdk/cosmos/.cspell.json. - Unit and emulator tests relevant to the touched modules and crates
- CI-gated tests: Tests gated by
test_category(e.g., emulator, multi-write) are always compiled but are ignored at runtime unless the corresponding cfg is set viaRUSTFLAGS. This meanscargo check --testsandcargo testwill compile these tests without any special flags, so build errors are caught locally.RUSTFLAGSis only needed when you want to actually run the tests:RUSTFLAGS='--cfg test_category="emulator"' cargo test -p azure_data_cosmos --features fault_injection,key_auth --testsRUSTFLAGS='--cfg test_category="multi_write"' cargo test -p azure_data_cosmos --features fault_injection,key_auth --testsOn Windows (PowerShell), set the env var first:$env:RUSTFLAGS='--cfg test_category="emulator"'then run thecargo testcommand, and clear it afterwards with$env:RUSTFLAGS=$null. These tests require a live Cosmos DB emulator or multi-region account to run. Ifscopetargets a specific crate other thanazure_data_cosmos, skip these checks.
- Report results:
- Summarize failures concisely
- Include exact file paths and commands to reproduce
- Do NOT auto-fix unless
auto-fixargument istrue
Notes
- Never run repo-wide checks outside
sdk/cosmos - Avoid long-running integration tests unless explicitly requested
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.

