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
Use with care
47/ 100 5-point scale 2.4 / 5
1 2 3 4 5 6
1Trust13 / 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.

2Reliability7 / 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.

3Adaptability8 / 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.

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

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

6Verifiability4 / 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 does this skill do, and when should you 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.

What are this skill's strengths and limitations?

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 do you install this skill?

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 do you use this skill?

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

Pydantic Multi-Model Architecture

Build consistent, reusable Pydantic data contracts with a structured multi-model pattern.

Dev & Engineering ✓ Microsoft · Official

FastAPI Router Builder

Create consistent FastAPI CRUD routes with authentication and typed responses.

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 Cosmos DB TypeScript Skill

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

Dev & Engineering ✓ Microsoft · Official

Azure Cosmos DB Java Skill

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

Dev & Engineering ✓ Microsoft · Official

Azure Cosmos DB for Rust

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

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 PostgreSQL TypeScript Connector

A practical pg-based guide for secure, pooled Azure PostgreSQL access in Node.js and TypeScript.

Automation & Ops ✓ Microsoft · Official

Azure Python App Service Deployer

Deploy Flask, Django, FastAPI, or other Python apps to Azure App Service Linux.

Dev & Engineering ✓ Microsoft · Official

Azure AI Text Analytics for Python

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

Dev & Engineering ✓ Microsoft · Official

Azure Data Lake Gen2 for Python

Guides Python developers through hierarchical file-system and large-file operations on Azure Data Lake Storage Gen2.

Dev & Engineering ✓ Microsoft · Official

Azure AI Transcription for Python

Guides Python applications through Azure AI real-time and batch speech-to-text transcription.

Dev & Engineering ✓ Microsoft · Official

Azure Monitor OpenTelemetry Exporter

Build a controlled Python OpenTelemetry pipeline that exports traces, metrics, and logs to Application Insights.

Dev & Engineering ✓ Microsoft · Official

Azure Short-Audio Speech-to-Text REST

Transcribe audio up to 60 seconds with Python HTTP requests.

Dev & Engineering ✓ Microsoft · Official

MCP Server Development Guide

A practical guide to building clear, testable MCP servers that let LLMs work with external APIs.

Dev & Engineering ✓ Microsoft · Official

Azure Content Understanding for Python

Extract structured multimodal content from documents, images, audio, and video with Python.

Dev & Engineering ✓ Microsoft · Official

Azure Fabric Capacity Manager

Manage Microsoft Fabric capacities and their lifecycle with the Azure Python SDK.

Dev & Engineering ✓ Microsoft · Official

Azure Monitor OpenTelemetry for Python

Connect Python applications to Application Insights with one-line OpenTelemetry setup.

Dev & Engineering ✓ Microsoft · Official

Azure Realtime Podcast Studio

Turn text into playable podcast-style audio with Azure OpenAI Realtime API.

Dev & Engineering ✓ Microsoft · Official

Microsoft Entra Agent ID Provisioning

Provision OAuth2-capable identities for AI agents through Microsoft Graph beta.

Related skills