azure-cosmos-ts

Perform CRUD, query, and bulk operations on Azure Cosmos DB with TypeScript.

Updated Apr 12, 2026
One-click install
npx skills add https://github.com/davidrrowley/CortexYouV3 --skill azure-cosmos-ts
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: azure-cosmos-ts
Source: https://github.com/davidrrowley/CortexYouV3/tree/main/.agents/skills/azure-cosmos-ts
Command: npx skills add https://github.com/davidrrowley/CortexYouV3 --skill azure-cosmos-ts

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides clear, production-oriented guidance and patterns to perform data-plane operations on Azure Cosmos DB using the @azure/cosmos TypeScript SDK, removing uncertainty and boilerplate for developers who need reliable CRUD, query, and bulk workflows.

Core Features & Use Cases

  • Document CRUD & Patch: Examples and patterns for create, read, replace, upsert, delete, and patch operations with partition key usage.
  • Queries & Pagination: Parameterized queries, continuation token pagination, cross-partition queries, projections, and aggregate patterns.
  • Bulk & Chunked Workflows: Bulk create/upsert/replace/delete/patch patterns, chunking strategies, and retry-on-429 with exponential backoff.
  • Auth, Concurrency & Error Handling: AAD and key-based authentication examples, ETag optimistic concurrency, and explicit error handling for 404/409/412/429.
  • Use Case: Implement a TypeScript service layer that upserts product documents in batches and safely queries per-customer partitions with retries for rate limits.

Quick Start

Create a CosmosClient with DefaultAzureCredential, create-or-get database my-database and container my-container with partition key /category, then insert a sample product document and run a parameterized query to return it.

Frequently Asked Questions about azure-cosmos-ts

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle Azure Cosmos DB rate limiting (429 errors) in TypeScript?

Handle Cosmos DB rate limiting in TypeScript by implementing bulk execution with retry-on-429 logic and exponential backoff. This Skill provides patterns for chunking operations and retrying throttled requests to ensure reliable data-plane workflows.

What's the best way to perform bulk upsert operations on Cosmos DB documents using TypeScript?

Perform bulk upsert operations on Cosmos DB documents in TypeScript using chunked bulk execution patterns. This Skill provides guidance on chunking strategies and bulk create, upsert, replace, delete, and patch workflows using the @azure/cosmos SDK.

How do I use parameterized queries and pagination with the Cosmos DB TypeScript SDK?

Use parameterized queries and continuation token pagination with the Cosmos DB TypeScript SDK to retrieve documents safely. This Skill demonstrates cross-partition queries, projections, aggregate patterns, and continuation token pagination for efficient data retrieval.

Does this Cosmos DB TypeScript Skill support Azure Active Directory (AAD) authentication?

Yes, Azure Cosmos DB TypeScript operations support Azure Active Directory (AAD) authentication. This Skill includes authentication examples using DefaultAzureCredential alongside key-based authentication for secure container and partition management.

How do I implement ETag optimistic concurrency for Cosmos DB document updates?

Implement ETag optimistic concurrency for Cosmos DB document updates by handling HTTP 412 Precondition Failed errors during replacement. This Skill provides explicit error handling patterns for 404, 409, 412, and 429 responses during document patching and replacement.

Can I manage container creation and partition key configuration using TypeScript?

Yes, you can manage container creation and partition key configuration using TypeScript. This Skill covers programmatic creation of databases and containers with specific partition keys like /category, alongside document CRUD and partition management workflows.