azure-cosmos-rust
Azure Cosmos DB SDK for Rust (NoSQL API). Use for document CRUD, queries, containers, and globally distributed data.
About this skill
This skill provides AI agents with direct programmatic access to Azure Cosmos DB's NoSQL API through a Rust SDK. It empowers agents to perform essential database operations such as creating, reading, updating, and deleting documents (CRUD), executing complex queries, and managing data containers. Designed for applications requiring high availability and and low-latency access to structured and semi-structured data, this skill facilitates seamless integration of AI agent logic with globally distributed Azure Cosmos DB instances, enhancing data persistence and retrieval capabilities.
Best use case
Managing application data within Azure Cosmos DB; Retrieving specific documents or collections based on queries; Persisting AI-generated insights, user profiles, or transactional data; Building scalable, globally distributed data backends for AI-powered applications.
Azure Cosmos DB SDK for Rust (NoSQL API). Use for document CRUD, queries, containers, and globally distributed data.
Successful execution of database operations (e.g., document creation, retrieval, updates, deletions). Accurate and timely data persistence or retrieval from Azure Cosmos DB. Seamless integration of AI agent functionalities with a globally distributed NoSQL database backend.
Practical example
Example input
Retrieve the top 5 most recent customer orders from the 'orders' container, including their item details.
Example output
```json
[
{ "orderId": "ORD001", "customerId": "cust123", "orderDate": "2023-10-26", "items": [...] },
{ "orderId": "ORD002", "customerId": "cust124", "orderDate": "2023-10-25", "items": [...] }
]
```
(Or a confirmation message like 'Document updated successfully' for write operations.)When to use this skill
- When an AI agent needs to directly manipulate or query data stored in an Azure Cosmos DB instance. When developing Rust-based applications that require robust integration with Azure Cosmos DB. When performance, global distribution, and flexible schema of NoSQL data are critical for the agent's tasks.
When not to use this skill
- When working with relational databases (e.g., SQL Server, PostgreSQL); When the AI agent does not have access to a Rust execution environment or a pre-built tool leveraging this SDK; When a simpler, higher-level data storage abstraction is sufficient and direct database interaction is not necessary.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/azure-cosmos-rust/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How azure-cosmos-rust Compares
| Feature / Agent | azure-cosmos-rust | Standard Approach |
|---|---|---|
| Platform Support | Claude | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | easy | N/A |
Frequently Asked Questions
What does this skill do?
Azure Cosmos DB SDK for Rust (NoSQL API). Use for document CRUD, queries, containers, and globally distributed data.
Which AI agents support this skill?
This skill is designed for Claude.
How difficult is it to install?
The installation complexity is rated as easy. You can find the installation instructions above.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
ChatGPT vs Claude for Agent Skills
Compare ChatGPT and Claude for AI agent skills across coding, writing, research, and reusable workflow execution.
SKILL.md Source
# 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.Related Skills
azure-cosmos-py
Azure Cosmos DB SDK for Python (NoSQL API). Use for document CRUD, queries, containers, and globally distributed data.
azure-cosmos-db-py
Build production-grade Azure Cosmos DB NoSQL services following clean code, security best practices, and TDD principles.
database-optimizer
Expert database optimizer specializing in modern performance tuning, query optimization, and scalable architectures.
database-migrations-sql-migrations
SQL database migrations with zero-downtime strategies for PostgreSQL, MySQL, and SQL Server. Focus on data integrity and rollback plans.
database-migration
Master database schema and data migrations across ORMs (Sequelize, TypeORM, Prisma), including rollback strategies and zero-downtime deployments.
claimable-postgres
Provision instant temporary Postgres databases via Claimable Postgres by Neon (pg.new). No login or credit card required. Use for quick Postgres environments and throwaway DATABASE_URL for prototyping.
microsoft-azure-webjobs-extensions-authentication-events-dotnet
Microsoft Entra Authentication Events SDK for .NET. Azure Functions triggers for custom authentication extensions.
azure-web-pubsub-ts
Real-time messaging with WebSocket connections and pub/sub patterns.
azure-storage-queue-ts
Azure Queue Storage JavaScript/TypeScript SDK (@azure/storage-queue) for message queue operations. Use for sending, receiving, peeking, and deleting messages in queues.
azure-storage-queue-py
Azure Queue Storage SDK for Python. Use for reliable message queuing, task distribution, and asynchronous processing.
azure-storage-file-share-ts
Azure File Share JavaScript/TypeScript SDK (@azure/storage-file-share) for SMB file share operations.
azure-storage-file-share-py
Azure Storage File Share SDK for Python. Use for SMB file shares, directories, and file operations in the cloud.