Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Build globally distributed apps with Azure Cosmos DB. Work with multiple data models (document, key-value, graph), configure global replication with tunable consistency levels, manage throughput with RU/s, and query with SQL API.
.claude/skills/terminalskills-azure-cosmos-db/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-03 | ✗→✓ | ▲ Improved | 163% | 0% |
| case-15 | ✗→✓ | ▲ Improved | 77% | 0% |
| case-17 | ✗→✓ | ▲ Improved | 129% | 0% |
| case-06 | ✓→✓ | = Same ✓ | 126% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 121% | 0% |
Azure Cosmos DB is a globally distributed, multi-model database with guaranteed single-digit millisecond latency at the 99th percentile. It supports document (NoSQL), key-value, graph, and column-family data models with five tunable consistency levels.
bash# Create a Cosmos DB account with global replication az cosmosdb create \ --name my-app-cosmos \ --resource-group my-app-rg \ --kind GlobalDocumentDB \ --default-consistency-level Session \ --locations regionName=eastus failoverPriority=0 \ --locations regionName=westeurope failoverPriority=1 \ --enable-automatic-failover true
bash# Create a database with shared throughput az cosmosdb sql database create \ --account-name my-app-cosmos \ --resource-group my-app-rg \ --name app-db \ --throughput 400
bash# Create a container with partition key and autoscale az cosmosdb sql container create \ --account-name my-app-cosmos \ --resource-group my-app-rg \ --database-name app-db \ --name orders \ --partition-key-path /customerId \ --max-throughput 4000 \ --idx '{"indexingMode":"consistent","automatic":true,"includedPaths":[{"path":"/*"}],"excludedPaths":[{"path":"/payload/*"}]}'
python# Initialize client and perform CRUD from azure.cosmos import CosmosClient, PartitionKey client = CosmosClient( url="https://my-app-cosmos.documents.azure.com:443/", credential="your-key-here" ) database = client.get_database_client("app-db") container = database.get_container_client("orders") # Create an item order = { "id": "order-001", "customerId": "customer-123", "items": [ {"name": "Widget", "qty": 2, "price": 29.99}, {"name": "Gadget", "qty": 1, "price": 49.99} ], "total": 109.97, "status": "pending", "createdAt": "2024-01-15T10:30:00Z" } container.create_item(body=order)
python# Read an item (requires partition key) item = container.read_item(item="order-001", partition_key="customer-123") print(f"Order: {item['status']}, Total: ${item['total']}")
python# Replace (full update) item['status'] = 'shipped' item['shippedAt'] = '2024-01-16T14:00:00Z' container.replace_item(item=item['id'], body=item)
python# Partial update with patch operations container.patch_item( item="order-001", partition_key="customer-123", patch_operations=[ {"op": "set", "path": "/status", "value": "delivered"}, {"op": "add", "path": "/deliveredAt", "value": "2024-01-17T09:00:00Z"}, {"op": "incr", "path": "/updateCount", "value": 1} ] )
python# Delete an item container.delete_item(item="order-001", partition_key="customer-123")
python# SQL queries on Cosmos DB # Query orders for a customer orders = container.query_items( query="SELECT * FROM c WHERE c.customerId = @customerId AND c.status = @status", parameters=[ {"name": "@customerId", "value": "customer-123"}, {"name": "@status", "value": "pending"} ], partition_key="customer-123" ) for order in orders: print(f"{order['id']}: ${order['total']}")
python# Cross-partition query (more expensive, use sparingly) all_pending = container.query_items( query="SELECT c.id, c.customerId, c.total FROM c WHERE c.status = 'pending' ORDER BY c.total DESC", enable_cross_partition_query=True, max_item_count=50 )
python# Aggregation query result = container.query_items( query="SELECT VALUE COUNT(1) FROM c WHERE c.status = 'shipped'", enable_cross_partition_query=True ) count = list(result)[0]
bash# Update default consistency level az cosmosdb update \ --name my-app-cosmos \ --resource-group my-app-rg \ --default-consistency-level BoundedStaleness \ --max-staleness-prefix 100 \ --max-interval 5
| Level | Guarantee | RU Cost | Use Case | |-------|-----------|---------|----------| | Strong | Linearizable reads | Highest | Financial transactions | | Bounded Staleness | Reads lag by ≤K versions or T time | High | Leaderboards, counters | | Session | Read-your-writes per session | Medium | Default — most apps | | Consistent Prefix | Reads never see out-of-order writes | Low | Social feeds | | Eventual | No ordering guarantee | Lowest | Non-critical analytics |
python# Process change feed for event-driven architecture from azure.cosmos import CosmosClient container = CosmosClient(url, credential).get_database_client("app-db").get_container_client("orders") # Read changes from beginning change_feed = container.query_items_change_feed( is_start_from_beginning=True, partition_key_range_id="0" ) for change in change_feed: print(f"Changed item: {change['id']}, status: {change.get('status')}")
bash# Add a read region az cosmosdb update \ --name my-app-cosmos \ --resource-group my-app-rg \ --locations regionName=eastus failoverPriority=0 \ --locations regionName=westeurope failoverPriority=1 \ --locations regionName=southeastasia failoverPriority=2
bash# Enable multi-region writes az cosmosdb update \ --name my-app-cosmos \ --resource-group my-app-rg \ --enable-multiple-write-locations true
bash# Enable autoscale on a container az cosmosdb sql container throughput migrate \ --account-name my-app-cosmos \ --resource-group my-app-rg \ --database-name app-db \ --name orders \ --throughput-type autoscale
bash# Check current throughput and usage az cosmosdb sql container throughput show \ --account-name my-app-cosmos \ --resource-group my-app-rg \ --database-name app-db \ --name orders
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-06 | pass→pass | 7,574 | 6,481 | -14% | 1 | 1 | 0% | 1,485 | 3,361 | +126% | 0 | 0 | — |
case-01 | fail→fail | 7,369 | 5,796 | -21% | 1 | 1 | 0% | 1,612 | 3,244 | +101% | 0 | 0 | — |
case-02 | fail→fail | 9,972 | 5,955 | -40% | 1 | 1 | 0% | 2,161 | 3,224 | +49% | 0 | 0 | — |
case-03 | fail→pass | 4,728 | 3,325 | -30% | 1 | 1 | 0% | 1,018 | 2,674 | +163% | 0 | 0 | — |
case-04 | pass→pass | 6,059 | 3,219 | -47% | 1 | 1 | 0% | 1,200 | 2,646 | +121% | 0 | 0 | — |
case-05 | pass→pass | 5,092 | 3,122 | -39% | 1 | 1 | 0% | 1,020 | 2,671 | +162% | 0 | 0 | — |
case-07 | pass→pass | 6,286 | 5,691 | -9% | 1 | 1 | 0% | 1,357 | 3,083 | +127% | 0 | 0 | — |
case-08 | pass→pass | 6,956 | 3,982 | -43% | 1 | 1 | 0% | 1,342 | 2,735 | +104% | 0 | 0 | — |
case-09 | pass→pass | 5,472 | 3,711 | -32% | 1 | 1 | 0% | 1,159 | 2,600 | +124% | 0 | 0 | — |
case-10 | pass→pass | 7,171 | 4,623 | -36% | 1 | 1 | 0% | 1,406 | 2,885 | +105% | 0 | 0 | — |
case-11 | pass→pass | 3,542 | 3,074 | -13% | 1 | 1 | 0% | 673 | 2,515 | +274% | 0 | 0 | — |
case-12 | pass→pass | 3,719 | 2,924 | -21% | 1 | 1 | 0% | 726 | 2,560 | +253% | 0 | 0 | — |
case-13 | pass→pass | 9,927 | 5,283 | -47% | 1 | 1 | 0% | 1,656 | 2,857 | +73% | 0 | 0 | — |
case-14 | pass→pass | 7,717 | 6,687 | -13% | 1 | 1 | 0% | 1,400 | 3,224 | +130% | 0 | 0 | — |
case-15 | fail→pass | 8,304 | 4,279 | -48% | 1 | 1 | 0% | 1,585 | 2,806 | +77% | 0 | 0 | — |
case-16 | pass→pass | 7,483 | 4,592 | -39% | 1 | 1 | 0% | 1,279 | 2,911 | +128% | 0 | 0 | — |
case-17 | fail→pass | 6,472 | 6,520 | +1% | 1 | 1 | 0% | 1,358 | 3,114 | +129% | 0 | 0 | — |
case-18 | pass→pass | 7,503 | 4,858 | -35% | 1 | 1 | 0% | 1,317 | 2,749 | +109% | 0 | 0 | — |
case-19 | pass→pass | 11,239 | 9,590 | -15% | 1 | 1 | 0% | 1,943 | 3,690 | +90% | 0 | 0 | — |
case-20 | pass→pass | 6,524 | 4,856 | -26% | 1 | 1 | 0% | 1,366 | 2,999 | +120% | 0 | 0 | — |
case-21 | pass→pass | 9,711 | 5,361 | -45% | 1 | 1 | 0% | 1,607 | 2,978 | +85% | 0 | 0 | — |
case-22 | pass→pass | 4,039 | 3,849 | -5% | 1 | 1 | 0% | 800 | 2,748 | +244% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +14 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.