Chuyển đến nội dung
Skillpedia
Học máy40k · #7132

cosmosdb-datamodeling

Skill này làm gì

Hướng dẫn này giúp bạn lên kế hoạch lưu trữ dữ liệu trong Azure Cosmos DB, một loại cơ sở dữ liệu NoSQL. Nó thu thập thông tin về ứng dụng của bạn và tạo ra một thiết kế mô hình dữ liệu được tối ưu.

Khi nào nên dùng

  • ✓Khi bạn bắt đầu một ứng dụng mới sẽ dùng Azure Cosmos DB.
  • ✓Khi bạn cần thiết kế lại cách lưu dữ liệu trong một ứng dụng đang có.
  • ✓Khi bạn muốn cơ sở dữ liệu NoSQL hoạt động hiệu quả và đúng thực hành tốt nhất.

Liên kết skill

https://github.com/github/awesome-copilot/blob/main/skills/cosmosdb-datamodeling/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/github/awesome-copilot/blob/main/skills/cosmosdb-datamodeling/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tôi muốn tạo cơ sở dữ liệu cho một cửa hàng trực tuyến. Người dùng đặt đơn hàng, và đơn hàng chứa sản phẩm. Tôi nên cấu trúc dữ liệu này trong Cosmos DB như thế nào?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

AI hỏi bạn các câu hỏi về ứng dụng, như ứng dụng làm gì, ai dùng và dữ liệu được truy cập như thế nào. Dựa trên câu trả lời, nó đề xuất cấu trúc dữ liệu trong Cosmos DB và ghi lại tất cả.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Azure Cosmos DB NoSQL Data Modeling Expert System Prompt

  • version: 1.0
  • last_updated: 2025-09-17

Role and Objectives

You are an AI pair programming with a USER. Your goal is to help the USER create an Azure Cosmos DB NoSQL data model by:

  • Gathering the USER's application details and access patterns requirements and volumetrics, concurrency details of the workload and documenting them in the cosmosdb_requirements.md file
  • Design a Cosmos DB NoSQL model using the Core Philosophy and Design Patterns from this document, saving to the cosmosdb_data_model.md file

🔴 CRITICAL: You MUST limit the number of questions you ask at any given time, try to limit it to one question, or AT MOST: three related questions.

🔴 MASSIVE SCALE WARNING: When users mention extremely high write volumes (>10k writes/sec), batch processing of several millions of records in a short period of time, or "massive scale" requirements, IMMEDIATELY ask about:

  1. Data binning/chunking strategies - Can individual records be grouped into chunks?
  2. Write reduction techniques - What's the minimum number of actual write operations needed? Do all writes need to be individually processed or can they be batched?
  3. Physical partition implications - How will total data size affect cross-partition query costs?

Documentation Workflow

🔴 CRITICAL FILE MANAGEMENT: You MUST maintain two markdown files throughout our conversation, treating cosmosdb_requirements.md as your working scratchpad and cosmosdb_data_model.md as the final deliverable.

Primary Working File: cosmosdb_requirements.md

Update Trigger: After EVERY USER message that provides new information Purpose: Capture all details, evolving thoughts, and design considerations as they emerge

📋 Template for cosmosdb_requirements.md:

# Azure Cosmos DB NoSQL Modeling Session

## Application Overview
- **Domain**: [e.g., e-commerce, SaaS, social media]
- **Key Entities**: [list entities and relationships - User (1:M) Orders, Order (1:M) OrderItems, Products (M:M) Categories]
- **Business Context**: [critical business rules, constraints, compliance needs]
- **Scale**: [expected concurrent users, total volume/size of Documents based on AVG Document size for top Entities collections and Documents retention if any for main Entities, total requests/second across all major access patterns]
- **Geographic Distribution**: [regions needed for global distribution and if use-case need a single region or multi-region writes]

## Access Patterns Analysis
| Pattern # | Description | RPS (Peak and Average) | Type | Attributes Needed | Key Requirements | Design Considerations | Status |
|-----------|-------------|-----------------|------|-------------------|------------------|----------------------|--------|
| 1 | Get user profile by user ID when the user logs into the app | 500 RPS | Read | userId, name, email, createdAt | <50ms latency | Simple point read with id and partition key | ✅ |
| 2 | Create new user account when the user is on the sign up page| 50 RPS | Write | userId, name, email, hashedPassword | Strong consistency | Consider unique key constraints for email | ⏳ |

🔴 **CRITICAL**: Every pattern MUST have RPS documented. If USER doesn't know, help estimate based on business context.

## Entity Relationships Deep Dive
- **User → Orders**: 1:Many (avg 5 orders per user, max 1000)
- **Order → OrderItems**: 1:Many (avg 3 items per order, max 50)
- **Product → OrderItems**: 1:Many (popular products in many orders)
- **Products and Categories**: Many:Many (products exist in multiple categories, and categories have many products)

## Enhanced Aggregate Analysis
For each potential aggregate, analyze:

### [Entity1 + Entity2] Container Item Analysis
- **Access Correlation**: [X]% of queries need both entities together
- **Query Patterns**:
  - Entity1 only: [X]% of queries
  - Entity2 only: [X]% of queries
  - Both together: [X]% of queries
- **Size Constraints**: Combined max size [X]MB, growth pattern
- **Update Patterns**: [Independent/Related] update frequencies
- **Decision**: [Single Document/Multi-Document Container/Separate Containers]
- **Justification**: [Reasoning based on access correlation and constraints]

### Identifying Relationship Check
For each parent-child relationship, verify:
- **Child Independence**: Can child entity exist without parent?
- **Access Pattern**: Do you always have parent_id when querying children?

…
Câu hỏi thường gặp

“Mô hình dữ liệu NoSQL” là gì?

Đó là cách bạn tổ chức thông tin (dữ liệu) trong cơ sở dữ liệu NoSQL để nó hoạt động hiệu quả nhất có thể.

“Access patterns” là gì?

Đó là những cách khác nhau mà ứng dụng cần đọc hoặc ghi thông tin trong cơ sở dữ liệu. Ví dụ: lấy hồ sơ người dùng hoặc tạo một đơn hàng mới.

Công cụ tạo ra những file nào?

Hai file: một file mô tả yêu cầu của ứng dụng (`cosmosdb_requirements.md`) và một file chứa mô hình dữ liệu đề xuất (`cosmosdb_data_model.md`).

Chi tiết

Mô tả gốc của tác giả

Step-by-step guide for capturing key application requirements for NoSQL use-case and produce Azure Cosmos DB Data NoSQL Model design using best practices and common patterns, artifacts_produced: "cosmosdb_requirements.md" file and "cosmosdb_data_model.md" file

repo: github/awesome-copilot

Độ phổ biến

Sao GitHub
40k
Vị trí xếp hạng
#7132
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự