azure-cosmos-db-py
Skill by sickn33
Builds Azure Cosmos DB NoSQL services in Python with clean code, security practices and TDD. It suits developers who want a structured starting point for Cosmos-backed services.
Install azure-cosmos-db-py
Built from the published package, never by AI.
git clone --depth 1 https://github.com/sickn33/agentic-awesome-skills /tmp/agentic-awesome-skills && mkdir -p ~/.claude/skills && cp -r /tmp/agentic-awesome-skills/skills/azure-cosmos-db-py ~/.claude/skills/azure-cosmos-db-pyRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/sickn33/agentic-awesome-skills /tmp/agentic-awesome-skills && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/agentic-awesome-skills/skills/azure-cosmos-db-py ~/.gemini/antigravity-cli/skills/azure-cosmos-db-pyAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
The azure-cosmos-db-py skill gives an AI assistant guidance for building Azure Cosmos DB NoSQL services in Python. It covers a client module that uses DefaultAzureCredential for Azure and a key-based connection for a local emulator. It also describes a five-tier Pydantic model pattern, a service layer, and pytest tests written with mocks before implementation.
The source says its snippets are incomplete starters that have not been verified against live Cosmos behavior. It advises enforcing tenant authorization separately from partition routing, rejecting caller-supplied SQL fragments, and using ETag conditional writes to prevent lost updates. The examples use a FastAPI router and service layer, so the skill is aimed at developers building Cosmos-backed APIs.
Written from the project's SKILL.md and checked against it.
What it can do
- Cosmos client setupCreates a singleton client with DefaultAzureCredential for Azure or an emulator key for local work.
- Pydantic model hierarchyDefines a five-tier model pattern with base, create, update, API and internal document models.
- Service layer patternShows a service class with get-by-id logic and conversion between documents and models.
- Pytest mockingProvides pytest fixtures and an example test that mock the Cosmos container.
- Partition key guidancePoints to a reference file on choosing partition keys and cross-partition move operations.
- Error handling guidancePoints to a reference file on not-found errors, logging and HTTP error mapping.
What you need
- Python
- An Azure Cosmos DB account or the Cosmos emulator for local development
- azure-cosmos and azure-identity Python packages
Try asking
- Set up a Cosmos DB client using DefaultAzureCredential for my Python app
- Write pytest tests for a Cosmos DB project service before I implement it
- Create a five-tier Pydantic model set for a Cosmos DB project entity
Good to know
- Snippets are incomplete starters and the templates do not verify live Cosmos behavior.
- The integration fixture connects to a Cosmos endpoint, so use only an isolated test container with test-only records.
- The older graceful-default examples are a policy the source says to avoid for authoritative reads.
- The bundled client assumes /workspaceId as the partition key.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: skills/azure-cosmos-db-py/SKILL.md, skills/azure-cosmos-db-py/assets/conftest_template.py, skills/azure-cosmos-db-py/assets/cosmos_client_template.py, skills/azure-cosmos-db-py/assets/service_template.py. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md11 KB -
UPSTREAM-LICENSE.txt1 KB -
UPSTREAM-NOTICE.md3 KB -
assets/conftest_template.py10 KB -
assets/cosmos_client_template.py7 KB
Show all 11 files
-
assets/service_template.py10 KB -
references/client-setup.md7 KB -
references/error-handling.md11 KB -
references/partitioning.md8 KB -
references/service-layer.md9 KB -
references/testing.md15 KB
Alternatives to azure-cosmos-db-py
All alternatives →Creates, configures and manages datasets on the Hugging Face Hub, including SQL-based querying and transformation. Built for people who edit dataset content and metadata directly, alongside the HF MCP server.
Diagnoses and repairs gbrain's Postgres access when a command or MCP result shows a GBRAIN_DB_ACCESS marker, or when the operator reports the brain database is down. It runs the hardcoded gbrain db-repair ladder and verifies the result with a re-probe.
Manages clusters, instances, and backups for AlloyDB for PostgreSQL. Built for creating, configuring, and administering AlloyDB databases, not general PostgreSQL or Cloud SQL instances.
Writes, reviews and migrates Supabase logs queries against the ClickHouse logs table served by the logs.all.otel endpoint. Built for developers who write Logs Explorer SQL or convert older BigQuery logs queries.
Diagnoses and fixes slow Paperclip PostgreSQL queries using Cloud and Neon evidence, local benchmarks, regression tests, and a pull request with passing checks. Built for engineers working on Paperclip.
Guides AI assistants through Prisma 8 projects built on @prisma/orm-postgres, @prisma/orm-sqlite, or @prisma/orm-mongo. It covers data contracts, migrations, typed queries and runtime setup for developers on Prisma 8.
Compare with hugging-face-datasets, db-repair or alloydb-basics
azure-cosmos-db-py: common questions
Does this skill connect to my Cosmos DB account?
Copying the template does not connect to Cosmos. The integration fixture in the conftest template does connect to the configured endpoint, so the source says to use only a disposable test container.
How should I authenticate to Cosmos DB with this skill?
The source prefers DefaultAzureCredential in Azure and says never to store keys in code. The emulator key is shown only for local development.
Does this skill prevent lost updates and duplicate records?
The source says to use ETag conditional writes to prevent lost updates and to enforce uniqueness atomically. It notes that read-then-upsert or read-then-delete is not atomic.
How do I install azure-cosmos-db-py?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is azure-cosmos-db-py free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is azure-cosmos-db-py safe to use?
It scores 92 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to azure-cosmos-db-py?
Similar skills: hugging-face-datasets, db-repair, alloydb-basics, clickhouse-logs-queries.
