Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
azurecosmosdb avatar

Cosmosdb Best Practices

  • 675 installs
  • 47 repo stars
  • Updated July 29, 2026
  • azurecosmosdb/cosmosdb-agent-kit

cosmosdb-best-practices is an agent skill that ensures Azure Cosmos DB code follows performance, cost, and scalability best practices across NoSQL data modeling, queries, partitioning, and SDK usage.

About

cosmosdb-best-practices is an agent skill from azurecosmosdb/cosmosdb-agent-kit that encodes Azure Cosmos DB performance optimization guidelines for NoSQL workloads. It applies when writing, reviewing, or refactoring Cosmos DB code, designing partition keys, optimizing RU consumption, enforcing point reads over cross-partition queries, configuring CosmosClient SDK singletons, modeling containers, and implementing change feed, bulk operations, vector search, full-text search, hierarchical partition keys, global distribution, autoscale throughput, and indexing policies. Developers reach for cosmosdb-best-practices during schema design, query tuning, or code review to avoid costly hot partitions and excessive request units. The skill explicitly excludes PostgreSQL and other non-Cosmos databases.

  • 100+ rules across 12 categories prioritized by impact
  • Guides partition key selection, RU optimization, and indexing policy
  • Covers SDK singleton usage, bulk operations, change feed, and vector search
  • Supports automated refactoring and code generation with Cosmos DB patterns
  • Hard-gate review before committing high-scale database code

Cosmosdb Best Practices by the numbers

  • 675 all-time installs (skills.sh)
  • Ranked #109 of 911 Databases skills by installs in the Skillselion catalog
  • Data as of Jul 30, 2026 (Skillselion catalog sync)
npx skills add https://github.com/azurecosmosdb/cosmosdb-agent-kit --skill cosmosdb-best-practices

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs675
repo stars47
Last updatedJuly 29, 2026
Repositoryazurecosmosdb/cosmosdb-agent-kit

How do you optimize Azure Cosmos DB performance and RU cost?

Ensure their Azure Cosmos DB code follows performance, cost, and scalability best practices across data modeling, queries, and SDK usage.

Who is it for?

Backend developers writing or reviewing Azure Cosmos DB NoSQL code who need partition design, RU optimization, and SDK performance guidance.

Skip if: Developers using PostgreSQL, MongoDB outside Cosmos, or projects with no Azure Cosmos DB dependency.

When should I use this skill?

The user writes, reviews, or refactors Azure Cosmos DB code involving partition keys, RU costs, queries, indexing, or CosmosClient SDK usage.

What you get

Partition key designs, optimized queries, SDK singleton configuration, indexing policies, and refactored Cosmos DB access patterns.

  • partition key design
  • optimized queries
  • indexing policy recommendations

Files

SKILL.mdMarkdownGitHub ↗

Azure Cosmos DB Best Practices

Comprehensive performance optimization guide for Azure Cosmos DB applications, containing 100+ rules across 12 categories, prioritized by impact to guide automated refactoring and code generation.

When to Apply

Reference these guidelines when:

  • Designing data models for Cosmos DB
  • Choosing partition keys
  • Writing or optimizing queries
  • Implementing SDK patterns
  • Using the Cosmos DB Emulator for local development
  • Inspecting or managing Cosmos DB data with developer tooling
  • Implementing vector search or RAG features on Cosmos DB
  • Reviewing code for performance issues
  • Configuring throughput and scaling
  • Building globally distributed applications

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Data ModelingCRITICALmodel-
2Partition Key DesignCRITICALpartition-
3Query OptimizationHIGHquery-
4SDK Best PracticesHIGHsdk-
5Indexing StrategiesMEDIUM-HIGHindex-
6Throughput & ScalingMEDIUMthroughput-
7Global DistributionMEDIUMglobal-
8Monitoring & DiagnosticsLOW-MEDIUMmonitoring-
9Design PatternsHIGHpattern-
10Developer ToolingMEDIUMtooling-
11Vector SearchHIGHvector-

Quick Reference

1. Data Modeling (CRITICAL)

  • model-embed-related - Embed related data retrieved together
  • model-reference-large - Reference data when items get too large
  • model-avoid-2mb-limit - Keep items well under 2MB limit
  • model-id-constraints - Follow ID value length and character constraints
  • model-nesting-depth - Stay within 128-level nesting depth limit
  • model-numeric-precision - Understand IEEE 754 numeric precision limits
  • model-denormalize-reads - Denormalize for read-heavy workloads including pre-computed aggregates
  • model-schema-versioning - Version your document schemas
  • model-type-discriminator - Use type discriminators for polymorphic data
  • model-json-serialization - Handle JSON serialization correctly for Cosmos DB documents
  • model-relationship-references - Use ID references with transient hydration for document relationships

2. Partition Key Design (CRITICAL)

  • partition-high-cardinality - Choose high-cardinality partition keys
  • partition-avoid-hotspots - Distribute writes evenly
  • partition-hierarchical - Use hierarchical partition keys for flexibility; order levels broad→narrow
  • [partition-query-patterns

Related skills

How it compares

Use cosmosdb-best-practices for Azure Cosmos DB-specific modeling and RU tuning rather than generic SQL or MongoDB guidance skills.

FAQ

What Cosmos DB topics does cosmosdb-best-practices cover?

cosmosdb-best-practices covers NoSQL data modeling, partition keys, RU optimization, point reads, cross-partition queries, CosmosClient singleton usage, change feed, bulk operations, vector and full-text search, hierarchical partition keys, global distribution, autoscale, and ind

When should cosmosdb-best-practices not be used?

cosmosdb-best-practices should not be used for PostgreSQL or other databases outside Azure Cosmos DB. The skill is scoped to Cosmos DB NoSQL performance, cost, and scalability patterns during code writing and review.

Databasesbackendintegrations

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.