mcpField
C
cosmosdb-best-practices

cosmosdb-best-practices

github.com/clineData & databases39917 installsUpdated 15w ago
Repository

About cosmosdb-best-practices

A rule-based guidance skill for developers building and optimizing Azure Cosmos DB applications. It organizes performance advice by topic and impact, with separate rule files for targeted code review and refactoring.

Key features

  1. 0173+ rules across 10 categories
  2. 02Prioritized performance guidance
  3. 03Separate files for each rule
  4. 04Examples of incorrect and correct code
  5. 05Coverage of vector search and RAG

Use cases

  1. 01Choosing a Cosmos DB partition key
  2. 02Optimizing data models and queries
  3. 03Reviewing SDK usage for performance
  4. 04Planning throughput and global distribution

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/cline/skills --skill cosmosdb-best-practices

After installing, type/cosmosdb-best-practicesin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

rules/
_sections.md
_template.md
global-conflict-resolution.md
global-consistency.md
global-failover.md
global-multi-region.md
global-read-regions.md
global-zone-redundancy.md
index-composite.md
index-exclude-unused.md
index-lazy-consistent.md
index-range-vs-hash.md
index-spatial.md
model-avoid-2mb-limit.md
model-denormalize-reads.md
model-embed-related.md
model-id-constraints.md
model-json-serialization.md
model-nesting-depth.md
model-numeric-precision.md
model-reference-large.md
model-relationship-references.md
model-schema-versioning.md
model-type-discriminator.md
monitoring-azure-monitor.md
monitoring-diagnostic-logs.md
monitoring-latency.md
monitoring-ru-consumption.md
monitoring-throttling.md
partition-20gb-limit.md

Details

From the project README

Azure Cosmos DB Best Practices

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

73 individual rule files are in the rules/ directory, one file per rule, synced from the AzureCosmosDB/cosmosdb-agent-kit. Load only the relevant rule file(s) when answering a question — do NOT load all files at once.

When to Apply

Reference these guidelines when:

  • Designing data models for Cosmos DB
  • Choosing partition keys
  • Writing or optimizing queries
  • Implementing SDK patterns
  • Reviewing code for performance issues
  • Configuring throughput and scaling
  • Building globally distributed applications
  • Implementing vector search and RAG patterns

Rule Index

Rules are grouped by category prefix. For a given question, load files matching the relevant prefix (e.g., model-*.md for data modeling, sdk-*.md for SDK usage). See rules/_sections.md for category descriptions.

1. Data Modeling — CRITICAL (prefix: model-)
2. Partition Key Design — CRITICAL (prefix: partition-)
3. Query Optimization — HIGH (prefix: query-)
4. SDK Best Practices — HIGH (prefix: sdk-)
5. Indexing Strategies — MEDIUM-HIGH (prefix: index-)
6. Throughput & Scaling — MEDIUM (prefix: throughput-)
7. Global Distribution — MEDIUM (prefix: global-)
8. Monitoring & Diagnostics — LOW-MEDIUM (prefix: monitoring-)
9. Design Patterns — HIGH (prefix: pattern-)
10. Vector Search — HIGH (prefix: vector-)

How to Use

Each rule is a separate file under rules/. When answering a Cosmos DB question, read only the relevant rule file(s) based on the prefix matching the topic:

  • Data modeling question → read rules/model-*.md files
  • Partition key question → read rules/partition-*.md files
  • SDK/client question → read rules/sdk-*.md files
  • etc.

Each rule file contains:

  • Brief explanation of why it matters
  • Incorrect code example with explanation
  • Correct code example with explanation
  • Additional context and references

Source: AzureCosmosDB/cosmosdb-agent-kit

Comments

Markdown supported