Dev & Engineering ✓ Microsoft · Official

Azure Cosmos DB for Python

A practical guide for building reliable Python applications on Azure Cosmos DB’s NoSQL API.

54/ 100
Use with care

Useful, but reliability, evidence or controls still have material gaps.

See how it was scored ↓
Works as-is in
Codex · Claude Code
Stars
★ 2.7k
Last updated
3mo ago
License
MIT
azure-cosmos-dbpython-sdknosqldocument-crud
+2partition-keyparameterized-query

What does this skill do, and when should you use it?

This skill targets the Azure Cosmos DB NoSQL API and covers client lifecycle, databases, containers, document CRUD, queries, partition keys, and throughput. It includes both synchronous and asynchronous Python examples and recommends DefaultAzureCredential for authentication. The guidance emphasizes context managers for clients and async credentials, plus explicit partition-key usage for efficient operations. It is a good fit for developers integrating Cosmos DB into Python services or scripts.

Provides the installation command for azure-cosmos and azure-identity; documents COSMOS_ENDPOINT, COSMOS_DATABASE, COSMOS_CONTAINER, and production AZURE_TOKEN_CREDENTIALS settings; explains CosmosClient, DatabaseProxy, and ContainerProxy; demonstrates database and container creation, item creation, point reads, replacement, upserts, deletion, parameterized queries, cross-partition queries, projections, throughput reads and updates; and includes synchronous, asynchronous, and CosmosHttpResponseError handling examples.

Good fit
  • A Python developer needs to create or retrieve a Cosmos DB database and a partitioned container.
  • A backend engineer needs document create, point-read, replace, upsert, and delete operations.
  • A service developer needs parameterized queries within a partition or an explicitly controlled cross-partition query.
  • A high-throughput Python application needs the asynchronous Cosmos client and async DefaultAzureCredential.
  • An application or operations developer needs to inspect or change provisioned container throughput.

How do you install this skill?

Before you use it
  • Before executing writes, deletes, throughput changes, or transaction examples, confirm the target account, database, container, permissions, and recovery plan with the user.
  • The core database/container example omits the PartitionKey import; do not assume every advanced example is compatible with the installed azure-cosmos version.
  • Add SDK version constraints, skill-specific tests, troubleshooting, sensitive-data guidance, and Chinese/mainland-China reachability notes.
Before you start
Your agent needs
  • Shell / CLI
  • Network access
Install first
  • Python
  • azure-cosmos
  • azure-identity

Run pip install azure-cosmos azure-identity. To install the broader Agent Skills collection, run npx skills add microsoft/skills and select the required skill in the wizard; the collection is installed into the selected agent directory, such as .github/skills/. The source does not document a dedicated command for installing only azure-cosmos-py.

Generic route: install into Claude Code manually (macOS / Linux)
tmp="$(mktemp -d)"
git clone --depth 1 https://github.com/microsoft/skills.git "$tmp"
mkdir -p ~/.claude/skills
cp -R "$tmp/.github/plugins/azure-sdk-python/skills/azure-cosmos-py" ~/.claude/skills/
rm -rf "$tmp"

Generated from the source repository and skill path; it copies only this skill's folder. If the author's install steps above differ, follow those first. To scope it to one project, replace ~/.claude/skills with that project's .claude/skills.

How do you use this skill?

Try saying

Once installed, send your agent any of these to trigger it:

  • Use azure-cosmos and azure-identity to implement document CRUD and parameterized queries for a Cosmos DB NoSQL container with a partition key.

In an Agent Skills-compatible coding agent, ask: “Use azure-cosmos and azure-identity to implement document CRUD and parameterized queries for a Cosmos DB NoSQL container with a partition key.” Before running the generated code, configure COSMOS_ENDPOINT, COSMOS_DATABASE, and COSMOS_CONTAINER; for production DefaultAzureCredential usage, also set AZURE_TOKEN_CREDENTIALS=prod or a specific credential name.

What are this skill's strengths and limitations?

Pros
  • Covers both synchronous and asynchronous clients with practical common-operation examples.
  • Clearly promotes DefaultAzureCredential, context managers, and parameterized queries.
  • Addresses partition keys, cross-partition queries, throughput, and 404/429 handling.
  • Points to reference material for partitioning and query patterns, plus a container setup script.
Limitations
  • Focused on Python and the Azure Cosmos DB NoSQL API rather than other languages or API models.
  • It identifies cross-partition queries as more expensive but provides no concrete cost or performance benchmarks.
  • The source does not provide skill-specific test results or test scenarios.
  • The async pattern requires azure.identity.aio and separate context managers for the async client and credential.

How does this skill compare with similar options?

Side by side with related skills; every score comes from the same FSRS standard.

Skill FS score Stars Last updated License
Azure Cosmos DB for Python this page ✓ Microsoft · Official 54 · Use with care ★ 2.7k 3mo ago MIT
Azure Cosmos DB for Rust ✓ Microsoft · Official 44 · Not recommended ★ 2.7k 3mo ago MIT
Azure Cosmos DB TypeScript Skill ✓ Microsoft · Official 52 · Use with care ★ 2.7k 3mo ago MIT
Azure Cosmos DB Python Service Builder ✓ Microsoft · Official 47 · Use with care ★ 2.7k 3mo ago MIT
Azure Cosmos DB Java Skill ✓ Microsoft · Official 45 · Not recommended ★ 2.7k 3mo ago MIT

Compared with connection strings, account keys, or API keys, the skill favors DefaultAzureCredential so the same code can work across local development and Azure environments while preserving Entra auditing and credential rotation practices.

How did FollowSkills review this skill?

FollowSkills review · FSRS-2.0
Use with care
54/ 100 5-point scale 2.7 / 5
1Trust18 / 25 · 3.6/5

The skill recommends DefaultAzureCredential, discourages keys, uses parameterized queries, and emphasizes deterministic client cleanup, providing partial least-privilege and data-flow safety guidance. However, create, replace, delete, and throughput-changing operations lack user confirmation, rollback, or recovery guidance; sensitive-data handling, dependency security, and complete source attribution are also missing, so points are deducted.

2Reliability8 / 20 · 2.0/5

It covers sync/async lifecycle management, common HTTP statuses, and retry feedback, making the happy path plausible. However, the core setup omits the PartitionKey import, several advanced examples have insufficient concurrency/API-compatibility/edge-case treatment, and no skill-specific execution evidence is supplied; the static cap keeps this at 8.

3Adaptability9 / 15 · 3.0/5

Triggers and scenarios for Python SDK CRUD, queries, and partition keys are reasonably clear, and cross-partition queries are identified as a costly non-preferred case. Input prerequisites, non-fit boundaries, compatibility ranges, and conditional fallback guidance remain incomplete; the documentation is English-only and gives no Chinese-language or mainland-China reachability guidance, so points are deducted.

4Convention9 / 15 · 3.0/5

The document has installation, environment variables, authentication, workflows, references, and a script entry, plus MIT licensing, author metadata, and version 1.0.0. It lacks a skill-specific changelog, explicit maintenance/update path, FAQ, and systematic troubleshooting; the referenced files and script are not included in the supplied evidence, preventing a full score.

5Effectiveness6 / 15 · 2.0/5

The material covers CRUD, queries, pagination, aggregations, transactions, change feed, and partition design, offering useful direct guidance for common Cosmos DB coding tasks. However, the examples are not a complete runnable implementation and require checking imports, permissions, service prerequisites, and potentially unsafe advanced patterns; static evidence supports only 6.

6Verifiability4 / 10 · 2.0/5

The skill, repository README, license, security policy, and CI files are auditable primary repository materials, and the repository reports evaluation and testing workflows. There are no path-specific committed tests, real execution results, or independent corroboration in the supplied files, so this remains 4.

1 2 3 4 5 6

Open a dimension to read why it scored that way

Reviewed Jul 20, 2026 Reviewed revision 9ccaf7c3704a Review evidence[1][2][3][4][5][6][7][8][9][10][11][12]

Evidence confidence:Low — Mostly static review, author material or a limited demo; useful for discovery, not high-risk decisions.

See the full review method →

FAQ

Which environment variables are required?
COSMOS_ENDPOINT, COSMOS_DATABASE, and COSMOS_CONTAINER are required for all authentication methods. AZURE_TOKEN_CREDENTIALS is required only when DefaultAzureCredential is used in production.
Do operations always need a partition key?
Point reads and efficient queries should specify one. The skill recommends always specifying partition keys for point operations and queries and warns that cross-partition queries are more expensive.
Does the skill support asynchronous Cosmos DB code?
Yes. It includes azure.cosmos.aio.CosmosClient, azure.identity.aio.DefaultAzureCredential, asynchronous CRUD operations, and asynchronous query iteration.
How should missing items and throttling be handled?
The example catches CosmosHttpResponseError, checks for 404 and 429, reads x-ms-retry-after-ms for throttling, and re-raises other status codes.

More skills from this repository

All from microsoft/agent-skills

Dev & Engineering ✓ Microsoft · Official

Azure Cosmos DB for Rust

A practical guide to building Rust applications with the official Azure Cosmos DB NoSQL client.

★ 2.7k FS 44 Not recommended 3mo ago
Dev & Engineering ✓ Microsoft · Official

Azure Cosmos DB TypeScript Skill

Gives TypeScript and JavaScript coding agents practical Cosmos DB data-access patterns.

★ 2.7k FS 52 Use with care 3mo ago
Dev & Engineering ✓ Microsoft · Official

Azure Cosmos DB Python Service Builder

Build secure, testable Azure Cosmos DB NoSQL services for Python and FastAPI applications.

★ 2.7k FS 47 Use with care 3mo ago
Dev & Engineering ✓ Microsoft · Official

Azure Cosmos DB Java Skill

Guides Java developers in building globally distributed, partitioned, and reactive Azure Cosmos DB applications.

★ 2.7k FS 45 Not recommended 3mo ago
Dev & Engineering ✓ Microsoft · Official

Azure Tables Java Skill

Build Java applications for Azure Table Storage and the Cosmos DB Table API.

★ 2.7k FS 48 Use with care 3mo ago
Dev & Engineering ✓ Microsoft · Official

Azure Tables for Python

A practical guide to building authenticated Azure Tables applications with Python entity CRUD, queries, and partition-scoped batch operations.

★ 2.7k FS 57 Use with care 3mo ago
Dev & Engineering ✓ Microsoft · Official

Azure Key Vault SDK for Python

Gives Python coding agents practical guidance for securely managing Azure Key Vault secrets, keys, and certificates.

★ 2.7k FS 54 Use with care 3mo ago
Dev & Engineering ✓ Microsoft · Official

Azure Monitor Query for Python

Generate Python code for querying Azure Monitor logs and metrics.

★ 2.7k FS 54 Use with care 3mo ago
Dev & Engineering ✓ Microsoft · Official

Azure Document Translation for Python

Batch-translate Azure Blob Storage documents in Python while preserving their original formats.

★ 2.7k FS 52 Use with care 3mo ago
Dev & Engineering ✓ Microsoft · Official

Azure AI Search for Python

Helps Python developers build vector, hybrid, and semantic search applications with Azure AI Search.

★ 2.7k FS 50 Use with care 3mo ago
Dev & Engineering ✓ Microsoft · Official

Azure Identity for Python

A practical skill for securing Python Azure applications with Microsoft Entra ID credentials.

★ 2.7k FS 60 Recommended 3mo ago
Dev & Engineering ✓ Microsoft · Official

Azure AI Vision Image Analysis

Guides Python coding agents in implementing Azure AI Vision image understanding.

★ 2.7k FS 55 Use with care 3mo ago
Dev & Engineering ✓ Microsoft · Official

Azure Blob Storage for Python

Guides secure, production-minded Blob Storage operations in Python.

★ 2.7k FS 55 Use with care 3mo ago
Dev & Engineering ✓ Microsoft · Official

Azure Queue Storage for Python

Gives coding agents reliable Python patterns for secure Azure Queue Storage messaging and asynchronous task processing.

★ 2.7k FS 55 Use with care 3mo ago
Dev & Engineering ✓ Microsoft · Official

Azure API Management for Python

Gives coding agents practical Python SDK patterns for managing Azure API Management services, APIs, products, subscriptions, and policies.

★ 2.7k FS 54 Use with care 3mo ago
Dev & Engineering ✓ Microsoft · Official

Azure Cosmos DB ARM for .NET

Provision and manage Azure Cosmos DB resources from .NET through ARM.

★ 2.7k FS 54 Use with care 3mo ago
Dev & Engineering ✓ Microsoft · Official

Azure AI Content Safety for Python

Guides Python applications in detecting harmful text and images and enforcing custom blocklists.

★ 2.7k FS 53 Use with care 3mo ago
Dev & Engineering ✓ Microsoft · Official

Azure App Configuration for Python

Centralize Python application settings, feature flags, and dynamic configuration in Azure.

★ 2.7k FS 53 Use with care 3mo ago
Dev & Engineering ✓ Microsoft · Official

Azure Container Registry for Python

Manage Azure container images, artifacts, and repositories from Python.

★ 2.7k FS 53 Use with care 3mo ago
Dev & Engineering ✓ Microsoft · Official

Azure Monitor Custom Log Ingestion

Guides Python agents to send custom logs to Log Analytics through the Logs Ingestion API.

★ 2.7k FS 53 Use with care 3mo ago

Related skills