MR
Mayur Rathi
@mayurrathi
⭐ 40.7k GitHub stars

Azure Cosmos Rust

Azure Cosmos Rust is an code AI skill with a core value of |. It helps developers solve real-world problems in the code domain, boosting efficiency, automating repetitive tasks, and optimizing workflows.

|

Last verified on: 2026-07-08

Quick Facts

Category code
Works With Claude
Source sickn33/antigravity-awesome-skills
Stars ⭐ 40.7k
Last Verified 2026-07-08
Risk Level Low
mkdir -p ./skills/azure-cosmos-rust && curl -sfL https://raw.githubusercontent.com/sickn33/antigravity-awesome-skills/main/skills/azure-cosmos-rust/SKILL.md -o ./skills/azure-cosmos-rust/SKILL.md

Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).

Skill Content

# Azure Cosmos DB SDK for Rust


Client library for Azure Cosmos DB NoSQL API — globally distributed, multi-model database.


Installation


sh
cargo add azure_data_cosmos azure_identity

Environment Variables


bash
COSMOS_ENDPOINT=https://<account>.documents.azure.com:443/
COSMOS_DATABASE=mydb
COSMOS_CONTAINER=mycontainer

Authentication


rust
use azure_identity::DeveloperToolsCredential;
use azure_data_cosmos::CosmosClient;

let credential = DeveloperToolsCredential::new(None)?;
let client = CosmosClient::new(
    "https://<account>.documents.azure.com:443/",
    credential.clone(),
    None,
)?;

Client Hierarchy


| Client | Purpose | Get From |

|--------|---------|----------|

| `CosmosClient` | Account-level operations | Direct instantiation |

| `DatabaseClient` | Database operations | `client.database_client()` |

| `ContainerClient` | Container/item operations | `database.container_client()` |


Core Workflow


Get Database and Container Clients


rust
let database = client.database_client("myDatabase");
let container = database.container_client("myContainer");

Create Item


rust
use serde::{Serialize, Deserialize};

#[derive(Serialize, Deserialize)]
struct Item {
    pub id: String,
    pub partition_key: String,
    pub value: String,
}

let item = Item {
    id: "1".into(),
    partition_key: "partition1".into(),
    value: "hello".into(),
};

container.create_item("partition1", item, None).await?;

Read Item


rust
let response = container.read_item("partition1", "1", None).await?;
let item: Item = response.into_model()?;

Replace Item


rust
let mut item: Item = container.read_item("partition1", "1", None).await?.into_model()?;
item.value = "updated".into();

container.replace_item("partition1", "1", item, None).await?;

Patch Item


rust
use azure_data_cosmos::models::PatchDocument;

let patch = PatchDocument::default()
    .with_add("/newField", "newValue")?
    .with_remove("/oldField")?;

container.patch_item("partition1", "1", patch, None).await?;

Delete Item


rust
container.delete_item("partition1", "1", None).await?;

Key Auth (Optional)


Enable key-based authentication with feature flag:


sh
cargo add azure_data_cosmos --features key_auth

Best Practices


1. **Always specify partition key** — required for point reads and writes

2. **Use `into_model()?`** — to deserialize responses into your types

3. **Derive `Serialize` and `Deserialize`** — for all document types

4. **Use Entra ID auth** — prefer `DeveloperToolsCredential` over key auth

5. **Reuse client instances** — clients are thread-safe and reusable


Reference Links


| Resource | Link |

|----------|------|

| API Reference | https://docs.rs/azure_data_cosmos |

| Source Code | https://github.com/Azure/azure-sdk-for-rust/tree/main/sdk/cosmos/azure_data_cosmos |

| crates.io | https://crates.io/crates/azure_data_cosmos |


When to Use

This skill is applicable to execute the workflow or actions described in the overview.

🎯 Best For

  • Claude users
  • Software engineers
  • Development teams
  • Tech leads

💡 Use Cases

  • Code quality improvement
  • Best practice enforcement

📖 How to Use This Skill

  1. 1

    Install the Skill

    Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.

  2. 2

    Load into Your AI Assistant

    Open Claude and reference the skill. Paste the SKILL.md content or use the system prompt tab.

  3. 3

    Apply Azure Cosmos Rust to Your Work

    Open your project in the AI assistant and ask it to apply the skill. Start with a small module to verify the output quality.

  4. 4

    Review and Refine

    Review AI suggestions before committing. Run tests, check for regressions, and iterate on the skill output.

❓ Frequently Asked Questions

Is Azure Cosmos Rust compatible with Cursor and VS Code?

Yes — this skill works with any AI coding assistant including Cursor, VS Code with Copilot, and JetBrains IDEs.

Do I need specific dependencies for Azure Cosmos Rust?

Check the install command and Works With section. Most code skills only require the AI assistant and your codebase.

How do I install Azure Cosmos Rust?

Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/azure-cosmos-rust/SKILL.md, ready to use.

Can I customize this skill for my team?

Absolutely. Edit the SKILL.md file to add team-specific instructions, examples, or workflows.

⚠️ Common Mistakes to Avoid

Skipping validation

Always test AI-generated code changes, even for simple refactors.

Missing dependency updates

Check if the skill requires updated dependencies or new packages.

🔗 Related Skills