mcpField
C
cosmosdb-best-practices

cosmosdb-best-practices

github.com/cline数据与数据库39917 次安装15 周前更新
代码仓库

关于 cosmosdb-best-practices

面向 Azure Cosmos DB 应用开发者的规则指南,按主题和影响程度整理性能建议。独立规则文件便于针对性地进行代码审查、重构和代码生成。

主要功能

  1. 01涵盖 10 类的 73 多条规则
  2. 02按优先级整理性能建议
  3. 03每条规则单独成文
  4. 04提供正误代码示例
  5. 05涉及向量搜索与 RAG

适用场景

  1. 01选择 Cosmos DB 分区键
  2. 02优化数据模型与查询
  3. 03审查 SDK 性能实践
  4. 04规划吞吐量与全球分布

安装

复制下面的命令,在终端中运行。

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

安装后在 Claude Code 中输入/cosmosdb-best-practices确认已加载。

包含的文件

除 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

详细介绍

Azure Cosmos DB 最佳实践

Azure Cosmos DB 应用的综合性能优化指南,包含 10 个类别中的 73 条以上规则,并按影响程度排序,以指导自动重构和代码生成。

73 个独立规则文件位于 rules/ 目录中,每条规则对应一个文件, 同步自 AzureCosmosDB/cosmosdb-agent-kit。 回答问题时,只加载相关规则文件,切勿一次性加载所有文件。

适用场景

在以下情况下参考这些指南:

  • 设计 Cosmos DB 数据模型
  • 选择分区键
  • 编写或优化查询
  • 实现 SDK 模式
  • 审查代码中的性能问题
  • 配置吞吐量和扩展
  • 构建全球分布式应用
  • 实现向量搜索和 RAG 模式

规则索引

规则按类别前缀分组。针对具体问题,加载匹配相关前缀的文件(例如,数据建模使用 model-*.md,SDK 用法使用 sdk-*.md)。 类别说明请参阅 rules/_sections.md。

1. 数据建模 — 严重(前缀:model-)
2. 分区键设计 — 严重(前缀:partition-)
3. 查询优化 — 高(前缀:query-)
4. SDK 最佳实践 — 高(前缀:sdk-)
5. 索引策略 — 中高(前缀:index-)
6. 吞吐量与扩展 — 中(前缀:throughput-)
7. 全球分布 — 中(前缀:global-)
8. 监控与诊断 — LOW-MEDIUM(前缀:monitoring-)
9. 设计模式 — HIGH(前缀:pattern-)
10. 向量搜索 — HIGH(前缀:vector-)

使用方法

每条规则都位于 rules/ 下的独立文件中。回答 Cosmos DB 问题时, 请根据与主题匹配的前缀,只阅读相关规则文件:

  • 数据建模问题 → 阅读 rules/model-*.md 文件
  • 分区键问题 → 阅读 rules/partition-*.md 文件
  • SDK/客户端问题 → 阅读 rules/sdk-*.md 文件
  • 等等

每个规则文件包含:

  • 简要说明规则的重要性
  • 错误代码示例及说明
  • 正确代码示例及说明
  • 补充背景信息和参考资料

来源:AzureCosmosDB/cosmosdb-agent-kit

评论

支持 Markdown