Dev & Engineering ✓ Microsoft · Official azure-cosmos-dbpython-sdknosqldocument-crudpartition-keyparameterized-query

Azure Cosmos DB for Python

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

FollowSkills review · FSRS-2.0
Not recommended
54/ 100 5-point scale 2.7 / 5
Trust18 / 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.

Reliability8 / 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.

Adaptability9 / 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.

Convention9 / 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.

Effectiveness6 / 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.

Verifiability4 / 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.

Evidence confidence:Low Reviewed Jul 20, 2026 Reviewed revision 9ccaf7c3704a
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.
See the full review method →

What it does & when to 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.

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

Pros & cons

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 to install

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.

How to use

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.

Compared to similar skills

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.

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 Identity for Python

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

Dev & Engineering ✓ Microsoft · Official

Azure Event Hubs Java Skill

Build production-oriented Java event streaming applications on Azure Event Hubs.

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.

Dev & Engineering ✓ Microsoft · Official

Azure Identity for TypeScript

Configure secure, flexible Microsoft Entra ID authentication for TypeScript Azure applications.

Automation & Ops ✓ Microsoft · Official

Azure Reliability Advisor

Assess and improve reliability for Azure Functions and App Service.

Dev & Engineering ✓ Microsoft · Official

Azure Cloud Architect

Guides coding agents through production-grade Azure architecture design and review using Azure Architecture Center practices.

Dev & Engineering ✓ Microsoft · Official

Azure AI Text Analytics for Python

Guides Python developers through Azure-powered text analysis and NLP workflows.

Automation & Ops ✓ Microsoft · Official

Azure Resource Architecture Visualizer

Analyze Azure resource groups and turn their dependencies into detailed Mermaid architecture diagrams.

Dev & Engineering ✓ Microsoft · Official

Azure Maps for .NET

Build .NET location features for search, routing, maps, geolocation, and weather.

Dev & Engineering ✓ Microsoft · Official

Azure AI Vision Image Analysis

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

Dev & Engineering ✓ Microsoft · Official

Azure Blob Storage for Python

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

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.

Automation & Ops ✓ Microsoft · Official

Azure AI Gateway Governance

Use Azure API Management to govern traffic across AI models, MCP tools, and agents.

Automation & Ops ✓ Microsoft · Official

AKS Automatic Readiness

Assess Kubernetes workloads for AKS Automatic compatibility and identify migration blockers before you switch.

Dev & Engineering ✓ Microsoft · Official

Azure Cosmos DB ARM for .NET

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

Dev & Engineering ✓ Microsoft · Official

Azure Playwright Workspace Manager

Provision and manage Microsoft Playwright Testing workspaces with .NET and Azure Resource Manager.

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.

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.

Dev & Engineering ✓ Microsoft · Official

Azure Monitor Query for Python

Generate Python code for querying Azure Monitor logs and metrics.

Dev & Engineering ✓ Microsoft · Official

Azure Queue Storage for Rust

A focused guide for building secure Azure Queue Storage messaging workflows in Rust.

Related skills