azure-cosmos-rust
A Rust client library for interacting with Azure Cosmos DB NoSQL databases.
Install
mkdir -p .claude/skills/azure-cosmos-rust-anhvu1107 && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/9705" && unzip -o skill.zip -d .claude/skills/azure-cosmos-rust-anhvu1107 && rm skill.zipInstalls to .claude/skills/azure-cosmos-rust-anhvu1107
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
ALWAYS use this when the request matches Azure Cosmos Rust: Azure Cosmos DB SDK for Rust (NoSQL API).Key capabilities
- →CRUD operations on Cosmos DB
- →Account-level client management
- →Database and container client operations
- →Azure identity authentication
How it works
It provides a Rust SDK interface to interact with Cosmos DB NoSQL API using thread-safe clients and Azure identity authentication.
Inputs & outputs
When to use azure-cosmos-rust
- →Interacting with NoSQL data in Rust
- →Creating items in Cosmos DB containers
- →Authenticating with Azure services in Rust
About this skill
Azure Cosmos DB SDK for Rust
Selective Reading Rule
Start with:
references/senior-master-standard.mdreferences/usage-routing.mdreferences/quality-checklist.md
Then load only the inherited docs, scripts, assets, or examples that match the user's actual task.
Client library for Azure Cosmos DB NoSQL API — globally distributed, multi-model database.
Installation
cargo add azure_data_cosmos azure_identity
Environment Variables
COSMOS_ENDPOINT=https://<account>.documents.azure.com:443/
COSMOS_DATABASE=mydb
COSMOS_CONTAINER=mycontainer
Authentication
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
let database = client.database_client("myDatabase");
let container = database.container_client("myContainer");
Create Item
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
let response = container.read_item("partition1", "1", None).await?;
let item: Item = response.into_model()?;
Replace Item
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
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
container.delete_item("partition1", "1", None).await?;
Key Auth (Optional)
Enable key-based authentication with feature flag:
cargo add azure_data_cosmos --features key_auth
Best Practices
- Always specify partition key — required for point reads and writes
- Use
into_model()?— to deserialize responses into your types - Derive
SerializeandDeserialize— for all document types - Use Entra ID auth — prefer
DeveloperToolsCredentialover key auth - 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.
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
When not to use it
- →Non-NoSQL database operations
- →Applications without Azure identity access
Prerequisites
Limitations
- →Requires partition key for all point reads and writes
- →Thread-safe clients must be reused
How it compares
It offers a native Rust-based approach to Cosmos DB operations compared to other language SDKs.
Compared to similar skills
azure-cosmos-rust side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| azure-cosmos-rust (this skill) | 0 | 3mo | Review | Intermediate |
| qdrant-vector-search | 18 | 8mo | Review | Advanced |
| backend-development | 17 | 4mo | No flags | Intermediate |
| laravel-specialist | 12 | 3mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by Anhvu1107
View all by Anhvu1107 →You might also like
qdrant-vector-search
zechenzhangAGI
High-performance vector similarity search engine for RAG and semantic search. Use when building production RAG systems requiring fast nearest neighbor search, hybrid search with filtering, or scalable vector storage with Rust-powered performance.
backend-development
skillcreatorai
Backend API design, database architecture, microservices patterns, and test-driven development. Use for designing APIs, database schemas, or backend system architecture.
laravel-specialist
Jeffallan
Use when building Laravel 10+ applications requiring Eloquent ORM, API resources, or queue systems. Invoke for Laravel models, Livewire components, Sanctum authentication, Horizon queues.
writing-hashql-jexpr
hashintel
HashQL J-Expr syntax for writing queries. Use when writing J-Expr code, using #literal/#struct/#list constructs, understanding function call syntax, or working with HashQL query files (.jsonc).
supabase-python
alinaqi
FastAPI with Supabase and SQLAlchemy/SQLModel
pagination
dadbodgeoff
Implement cursor-based and offset pagination for APIs. Covers efficient database queries, stable sorting, and pagination metadata.