360 Secure SkillHub
360 安全技能中心

cosmosdb-best-practices

该 Skill 是面向 Azure Cosmos DB 的性能优化与最佳实践参考集,按数据建模、分区键、查询、SDK、索引、吞吐、全球分布、监控、设计模式和向量搜索拆分规则文件,供编写、审查或重构 Cosmos DB 代码时按主题加载,提供错误与正确示例及说明。

cline
热度 0.00
最近更新 2026-10-19 02:12:30
分类:开发依赖:读写文件应用场景:代码审查 / 代码生成 / API 集成

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add cline/skills/cosmosdb-best-practices
Metadata
name
cosmosdb-best-practices
license
MIT
description
Azure Cosmos DB performance optimization and best practices guidelines for NoSQL, partitioning, queries, SDK usage, and vector search. Use when writing, reviewing, or refactoring code that interacts with Azure Cosmos DB, designing data models, optimizing queries, or implementing high-performance database operations.
metadata
{"author":"cosmosdb-agent-kit","version":"1.0.0"}

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