agentleFS
Microsoft AzureKnown publisherAzure/azure-sdk-for-rust/sdk/cosmos/.github/skills/cosmos-pre-commit-validation/SKILL.md

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.

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
  1. Distinctive:

    Use this skill when:

    line 42
  2. Distinctive:

    Follow these steps strictly:

    line 50
  3. Very specific:

    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, …

    line 53
  4. Very specific:

    If changed-only is true (the default), restrict scanning to .rs files that differ between the current local branch and main.

    line 57
  5. Very specific:

    If changed-only is false, scan all .rs files under the target path(s).

    line 58
  6. Very specific:

    Run clippy with RUSTFLAGS=-D warnings set:

    line 65
  7. Very specific:

    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 …

    line 68
  8. Very specific:

    If auto-fix is true and unknown words are legitimate (e.g., API type names, technical terms), add them to ignoreWords in …

    line 75
  9. Very specific:

    If scope targets a specific crate other than azure_data_cosmos, skip these checks.

    line 85
  10. Very specific:

    Do NOT auto-fix unless auto-fix argument is true

    line 90
  11. Very specific:

    Never run repo-wide checks outside sdk/cosmos

    line 94
  12. Distinctive:

    Avoid long-running integration tests unless explicitly requested

    line 95

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

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

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:

  1. Determine the target path:
    • 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, if scope is azure_data_cosmos, use sdk/cosmos/azure_data_cosmos as the target path).
    • Otherwise, set the target path to sdk/cosmos.
  2. Determine file scope:
    • If 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.
    • If changed-only is false, scan all .rs files under the target path(s).
    • In both modes, skip files in generated/ subdirectories — these are produced by external tools and must never be modified.
  3. 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 with RUSTFLAGS=-D warnings set:
      • 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
    • 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 auto-fixed code is properly formatted (e.g., cargo clippy --fix can 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 in ignoreWords in sdk/cosmos/.cspell.json. Run locally with: npx cspell lint --config sdk/cosmos/.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 ignoreWords in sdk/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 via RUSTFLAGS. This means cargo check --tests and cargo test will compile these tests without any special flags, so build errors are caught locally. RUSTFLAGS is 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 --tests
      • RUSTFLAGS='--cfg test_category="multi_write"' cargo test -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 test command, and clear it afterwards with $env:RUSTFLAGS=$null. These tests require a live Cosmos DB emulator or multi-region account to run. If scope targets a specific crate other than azure_data_cosmos, skip these checks.
  4. Report results:
    • Summarize failures concisely
    • Include exact file paths and commands to reproduce
    • Do NOT auto-fix unless auto-fix argument is true

Notes

  • Never run repo-wide checks outside sdk/cosmos
  • Avoid long-running integration tests unless explicitly requested

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.