nosql-expert
它能做什么
这个智能体可以帮你设计 Cassandra、DynamoDB 等分布式 NoSQL 数据库。它不是按照传统数据库的方式组织数据,而是根据你将来要提出的查询来组织数据。
适用场景
- ✓规划一个需要处理海量数据和大量用户的系统时。
- ✓在不同类型的 NoSQL 数据库之间做选择时。
- ✓想要解决现有 NoSQL 数据库运行缓慢的问题时。
技能链接
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/nosql-expert/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我需要设计一个 DynamoDB 表来存储用户信息和他们的订单,重点是能通过用户 ID 快速查询。”
每周 5 个新技能,1 分钟读完。
工作原理
它会先引导你思考将要执行的查询,然后组织数据,让这些查询尽可能快,即使这意味着要重复存储一些信息。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
NoSQL Expert Patterns (Cassandra & DynamoDB)
Overview
This skill provides professional mental models and design patterns for distributed wide-column and key-value stores (specifically Apache Cassandra and Amazon DynamoDB).
Unlike SQL (where you model data entities), or document stores (like MongoDB), these distributed systems require you to model your queries first.
When to Use
- Designing for Scale: Moving beyond simple single-node databases to distributed clusters.
- Technology Selection: Evaluating or using Cassandra, ScyllaDB, or DynamoDB.
- Performance Tuning: Troubleshooting "hot partitions" or high latency in existing NoSQL systems.
- Microservices: Implementing "database-per-service" patterns where highly optimized reads are required.
The Mental Shift: SQL vs. Distributed NoSQL
| Feature | SQL (Relational) | Distributed NoSQL (Cassandra/DynamoDB) |
|---|---|---|
| Data modeling | Model Entities + Relationships | Model Queries (Access Patterns) |
| Joins | CPU-intensive, at read time | Pre-computed (Denormalized) at write time |
| Storage cost | Expensive (minimize duplication) | Cheap (duplicate data for read speed) |
| Consistency | ACID (Strong) | BASE (Eventual) / Tunable |
| Scalability | Vertical (Bigger machine) | Horizontal (More nodes/shards) |
The Golden Rule: In SQL, you design the data model to answer any query. In NoSQL, you design the data model to answer specific queries efficiently.
Core Design Patterns
1. Query-First Modeling (Access Patterns)
You typically cannot "add a query later" without migration or creating a new table/index.
Process:
- List all Entities (User, Order, Product).
- List all Access Patterns ("Get User by Email", "Get Orders by User sorted by Date").
- Design Table(s) specifically to serve those patterns with a single lookup.
2. The Partition Key is King
Data is distributed across physical nodes based on the Partition Key (PK).
- Goal: Even distribution of data and traffic.
- Anti-Pattern: Using a low-cardinality PK (e.g.,
status="active"orgender="m") creates Hot Partitions, limiting throughput to a single node's capacity. - Best Practice: Use high-cardinality keys (User IDs, Device IDs, Composite Keys).
3. Clustering / Sort Keys
Within a partition, data is sorted on disk by the Clustering Key (Cassandra) or Sort Key (DynamoDB).
- This allows for efficient Range Queries (e.g.,
WHERE user_id=X AND date > Y). - It effectively pre-sorts your data for specific retrieval requirements.
4. Single-Table Design (Adjacency Lists)
Primary use: DynamoDB (but concepts apply elsewhere)
Storing multiple entity types in one table to enable pre-joined reads.
| PK (Partition) | SK (Sort) | Data Fields... |
|---|---|---|
USER#123 |
PROFILE |
{ name: "Ian", email: "..." } |
USER#123 |
ORDER#998 |
{ total: 50.00, status: "shipped" } |
USER#123 |
ORDER#999 |
{ total: 12.00, status: "pending" } |
- Query:
PK="USER#123" - Result: Fetches User Profile AND all Orders in one network request.
5. Denormalization & Duplication
Don't be afraid to store the same data in multiple tables to serve different query patterns.
- Table A:
users_by_id(PK: uuid) - Table B:
users_by_email(PK: email)
Trade-off: You must manage data consistency across tables (often using eventual consistency or batch writes).
Specific Guidance
Apache Cassandra / ScyllaDB
- Primary Key Structure:
((Partition Key), Clustering Columns) - No Joins, No Aggregates: Do not try to
JOINorGROUP BY. Pre-calculate aggregates in a separate counter table. - Avoid
ALLOW FILTERING: If you see this in production, your data model is wrong. It implies a full cluster scan. - Writes are Cheap: Inserts and Updates are just appends to the LSM tree. Don't worry about write volume as much as read efficiency.
- Tombstones: Deletes are expensive markers. Avoid high-velocity delete patterns (like queues) in standard tables.
AWS DynamoDB
- GSI (Global Secondary Index): Use GSIs to create alternative views of your data (e.g., "Search Orders by Date" instead of by User).
- Note: GSIs are eventually consistent.
…
常见问题
对初学者来说,SQL 和 NoSQL 的主要区别是什么?
在 SQL 中,你把数据组织成带有关联关系的表,然后可以提出任何问题。在 NoSQL(如 Cassandra/DynamoDB)中,你要围绕具体的查询来组织数据,这样得到答案的速度会非常快。
什么是“热分区”?
指大量数据或访问请求集中在数据库的某一个点上,形成瓶颈,导致系统变慢。目标是让负载尽量均匀分布。
这个智能体能用于 MongoDB 这类数据库吗?
这个智能体主要针对 Cassandra 和 DynamoDB 这类宽列和键值型 NoSQL 数据库。MongoDB 属于另一种类型(文档型),可能需要不同的方法。
详情
作者的原始描述
Expert guidance for distributed NoSQL databases (Cassandra, DynamoDB). Focuses on mental models, query-first modeling, single-table design, and avoiding hot partitions in high-scale systems.
热度
- GitHub 星标
- 48k
- 排名
- #5310
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
00-andruia-consultant
48k帮你的智能体启动或改进 AI 项目。它可以分析代码、推荐工具,并用西班牙语制定行动计划。
007
48k让你的智能体执行安全审计和威胁建模。它有助于保护项目免受攻击和漏洞的威胁。
10-andruia-skill-smith
48k帮你的智能体创建或改进 AI 工具。它可以定义工具的工作方式、编写文档,并验证其结构。
20-andruia-niche-intelligence
48k让你的智能体创建某个特定行业的摘要。它有助于借助可靠的信息来源,了解项目的背景、规则、使用模式和风险。