azure-cosmos-db-py
Skill by henryalouf
Guides building production-grade Azure Cosmos DB NoSQL services in Python. It covers client setup, authentication, service layers, and pytest-based tests. Aimed at developers writing FastAPI backends on Azure.
Install azure-cosmos-db-py
Built from the published package, never by AI.
git clone --depth 1 https://github.com/henryalouf/ruflow /tmp/ruflow && mkdir -p ~/.claude/skills && cp -r /tmp/ruflow/.agents/skills/antigravity-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/henryalouf/ruflow /tmp/ruflow && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/ruflow/.agents/skills/antigravity-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
azure-cosmos-db-py is an agent skill that guides the building of Azure Cosmos DB NoSQL services in Python. It covers installing the azure-cosmos and azure-identity packages, setting up a singleton client module, and authenticating with DefaultAzureCredential in Azure or with a key for the local emulator. It also describes a service layer pattern, five-tier Pydantic models, and a test-first workflow with pytest.
The skill sets out a layered architecture with a FastAPI router, a service layer, and a Cosmos DB client module. It lists security rules such as never storing keys in code and using parameterized queries. Reference files cover partitioning, error handling, and testing. The source is aimed at developers building production-grade Cosmos DB services with clean code and TDD practices.
Written from the project's SKILL.md and checked against it.
What it can do
- Client module setupCreates a singleton Cosmos client with dual authentication for Azure and the emulator.
- Pydantic model hierarchyDefines a five-tier model pattern for shared, create, update, response and internal models.
- Service layer patternShows a service class with graceful degradation when Cosmos is unavailable.
- Test-first workflowGives pytest fixtures and an arrange-act-assert example that mock the Cosmos container.
- Partition key guidancePoints to a reference file on choosing partition keys and cross-partition queries.
- Error handling guidancePoints to a reference file on Cosmos resource errors, logging and HTTP error mapping.
What you need
- Python
- pip packages azure-cosmos and azure-identity
- An Azure Cosmos DB account
- Azure credentials for DefaultAzureCredential
- Cosmos DB emulator key for local development (optional)
- FastAPI
Try asking
- Set up a singleton Azure Cosmos DB client with DefaultAzureCredential
- Create a five-tier Pydantic model set for a Project entity
- Write pytest tests for a Cosmos service using a mocked container
Good to know
- Risk level is listed as unknown.
- The emulator key is for local development only, not production.
- Patterns assume a FastAPI and Starlette based service.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: .agents/skills/antigravity-awesome-skills/skills/azure-cosmos-db-py/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
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 work with the Cosmos DB emulator?
Yes. It shows a local emulator setup that uses COSMOS_KEY and an https://localhost:8081 endpoint with connection_verify set to False. The source says the emulator key is for local development only.
How does it handle authentication?
It uses DefaultAzureCredential in Azure so no keys are stored in code. The source recommends this over keys for production.
Does it include tests?
It describes a test-first approach and gives pytest fixtures that mock the Cosmos container. A full testing guide is listed as a reference file.
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 71 of 100. Grades: maintenance B, licence A, quality B. 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.
