Dev & Engineering ✓ Microsoft · Official azure-cosmos-dbpythonfastapipydanticpartition-keyparameterized-queriestdd

Azure Cosmos DB Python Service Builder

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

FollowSkills review · FSRS-2.0
Not recommended
47/ 100 5-point scale 2.4 / 5
Trust13 / 25 · 2.6/5

The evidence favors DefaultAzureCredential, avoids production keys, limits emulator keys to local use, and requires parameterized queries. However, delete operations lack user confirmation, rollback, or recovery guidance; partition-key authorization is stated as a principle but not implemented; client-lifecycle examples are inconsistent; and error logging may expose endpoint and internal details, so points are deducted.

Reliability7 / 20 · 1.8/5

The material supplies client, service-layer, error-handling, retry, and testing templates with an understandable happy path. Static evidence also shows inconsistencies between synchronous Cosmos clients, threadpool wrapping, and async context-manager guidance, many TODO placeholders, unpinned dependencies, and silent None/empty-list/False failure conventions. No execution results are provided, so the static ceiling and deductions apply.

Adaptability8 / 15 · 2.7/5

The intended audience, Cosmos DB Python/FastAPI scenarios, and major triggers are fairly clear, covering authentication, CRUD, partitioning, and tests. However, triggers such as NoSQL database and add persistence are broad, the templates assume a specific FastAPI project structure and models, and non-fit boundaries, Chinese support, and mainland-China network reachability are not documented, so points are deducted.

Convention9 / 15 · 3.0/5

The evidence includes installation, environment variables, layered references, templates, MIT licensing, author metadata, and version 1.0.0, providing a reasonably usable information architecture. It lacks a compatibility matrix, dependency pinning, changelog, explicit maintenance owner, and update path; the repository README also describes the project as work in progress, so points are deducted.

Effectiveness6 / 15 · 2.0/5

The templates theoretically cover client setup, CRUD, queries, partitioning, error handling, and tests, so they can support the core implementation task. However, substantial renaming, model work, and project configuration are required; production-grade quality and representative outputs are not statically verified; and some examples require correction. The static effectiveness ceiling therefore limits the score.

Verifiability4 / 10 · 2.0/5

The evidence is versioned and auditable and includes test templates, integration-test patterns, and repository CI indicators. It does not provide executed results, a complete key-path test suite, or independent corroboration for this skill. Repository badges alone do not verify coverage of this skill, so only limited credit is warranted.

Evidence confidence:Low Reviewed Jul 20, 2026 Reviewed revision 9ccaf7c3704a
Before you use it
  • Do not treat the templates as production-ready without reconciling the sync/async client strategy and adding explicit client and credential shutdown.
  • Add authorization, user confirmation, auditing, and failure-recovery controls before deletes, cross-partition moves, or cross-tenant access.
  • Constrain extra_filter callers and review exception logging and configuration loading to reduce query-fragment injection and sensitive-data exposure.
  • The material does not establish Azure service reachability in mainland-China network or regional environments; verify this separately before deployment.
See the full review method →

What it does & when to use it

This skill is for developers implementing Azure Cosmos DB NoSQL services with Python and FastAPI. It covers client setup, DefaultAzureCredential and emulator authentication, service-layer CRUD, partition keys, parameterized queries, and test-driven development. It also defines Pydantic model tiers, graceful degradation, singleton container initialization, and client or credential lifecycle management. It fits Azure application teams seeking production-oriented implementation patterns, but it does not provision Cosmos DB infrastructure.

It guides coding agents through installing azure-cosmos and azure-identity, reading Cosmos endpoint, database, container, and credential settings, creating clients with DefaultAzureCredential or emulator keys, structuring FastAPI routers and Cosmos service classes, implementing CRUD and document-model conversion, validating partition-key access, writing parameterized queries, and creating pytest tests with mocked containers.

  1. A Python backend developer adding Cosmos DB persistence to a FastAPI project or workspace.
  2. A team that needs emulator authentication locally and managed identity or another Entra credential in Azure production.
  3. An application developer designing partition-key isolation, authorized data access, and low-scan query patterns.
  4. A team that wants tests written before implementation and needs a mockable Cosmos container dependency.
  5. A backend project separating Cosmos documents, Pydantic API models, and business logic through a service layer.

Pros & cons

Pros
  • Covers authentication, lifecycle management, service layers, models, partitioning, queries, and testing in one implementation guide.
  • Clearly prioritizes DefaultAzureCredential and limits keys to emulator or local authentication scenarios.
  • Includes concrete FastAPI, Pydantic, and pytest patterns.
  • Emphasizes parameterized queries, authorization-aware partition validation, and graceful degradation.
  • The repository is MIT-licensed and supports collection installation through npx skills add.
Limitations
  • Focuses on Cosmos DB NoSQL service implementation and does not cover resource provisioning or full infrastructure setup.
  • It depends on Python, Azure SDK packages, FastAPI, Pydantic, and pytest, but the source does not specify supported versions.
  • The source provides no independent test coverage or execution results for this specific skill.
  • Developers must integrate asynchronous execution, singleton lifetime, and context-manager handling into their own application structure.

How to install

Run npx skills add microsoft/skills in the target project and select azure-cosmos-db-py in the installation wizard. The README also documents copying a selected skill into an agent directory. The source file for this skill is .github/plugins/azure-sdk-python/skills/azure-cosmos-db-py/SKILL.md; the installer determines the target agent directory.

How to use

In an Agent Skills-compatible coding agent, ask for something such as “Add Azure Cosmos DB NoSQL persistence to this FastAPI app using DefaultAzureCredential, partition keys, a service-layer CRUD design, and pytest tests.” Trigger phrases include “Cosmos DB,” “Python Cosmos SDK,” and “database service layer.” Configure COSMOS_ENDPOINT, COSMOS_DATABASE_NAME, and COSMOS_CONTAINER_ID; add COSMOS_KEY for emulator scenarios.

FAQ

Should production applications use Cosmos DB keys?
The skill recommends DefaultAzureCredential and constraining the production credential chain with `AZURE_TOKEN_CREDENTIALS=prod` or a specific credential. Keys are primarily shown for the emulator or key-based local authentication.
Can development proceed without an Azure Cosmos DB resource?
Yes. The skill includes a local emulator example using `https://localhost:8081`, an emulator key, and `connection_verify=False`.
Does the skill document Azure service pricing?
No. The source identifies the repository as MIT-licensed but does not provide Cosmos DB pricing or cost guidance.
What happens when Cosmos DB is unavailable?
The recommended service-layer pattern returns `None` or an empty list when Cosmos is unavailable, with exponential-backoff retry logic for transient failures.

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 Cosmos DB for Python

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

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.

Related skills