New to Claude Skills? Learn how to install them →

jeremylongshore on GitHub

NoSQL Data Modeler

Free

Automate and optimize your NoSQL database design.

Get this skill

Free · Opens the source repo

What NoSQL Data Modeler does

The NoSQL Data Modeler skill provides a structured approach to designing data models specifically for NoSQL databases like MongoDB, DynamoDB, Redis, and Cassandra. Unlike traditional relational databases that focus on normalization, NoSQL modeling emphasizes access patterns and query requirements. This skill guides users through the process of creating efficient data models tailored to the specific needs of their applications, ensuring optimal performance and scalability.

To effectively use this skill, users must first gather a comprehensive list of application access patterns, expected data volumes, and consistency requirements. The skill then assists in cataloging these access patterns and translating them into appropriate data structures. For instance, it provides clear guidelines on when to embed or reference documents in MongoDB, and how to design partition and sort keys in DynamoDB to support primary access patterns.

Additionally, the skill offers valuable insights into denormalization trade-offs, schema evolution, and validation techniques. It encourages users to document their final data models with diagrams, sample documents, and access pattern mappings, which can be critical for maintaining clarity and facilitating future changes. With built-in scripts for generating sample data and migrating schemas, the NoSQL Data Modeler streamlines the modeling process, making it easier for developers and designers to adapt to NoSQL paradigms.

This skill is particularly beneficial for developers and data architects who are transitioning from relational databases to NoSQL solutions, as well as those looking to optimize existing NoSQL implementations. By following the structured approach provided by the skill, users can ensure that their data models are both efficient and aligned with application requirements.

When to use it

Use this skill when designing or optimizing data models for NoSQL databases based on specific application access patterns.

When not to use it

This skill may not be suitable for traditional relational database modeling or when working with simple data structures that do not require complex access patterns.

What you can build with it

E-commerce Application

Design a product catalog in MongoDB where products embed variant arrays for efficient access.

User Timeline in Social Media

Create a single-table design in DynamoDB to optimize user timelines and hashtag feeds.

IoT Sensor Data Management

Model sensor data in Cassandra with appropriate partitioning and clustering for time-series data.

How to install NoSQL Data Modeler

View source

1. Install with the skills CLI

npx skills add jeremylongshore/claude-code-plugins-plus-skills/modeling-nosql-data --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by jeremylongshore

NoSQL Data Modeler

Overview

Design data models for NoSQL databases including MongoDB (document), DynamoDB (key-value/wide-column), Redis (key-value), and Cassandra (wide-column). Unlike relational modeling where normalization drives design, NoSQL modeling starts from access patterns and query requirements, then shapes the data to serve those patterns efficiently.

Prerequisites

  • mongosh, aws dynamodb CLI, redis-cli, or cqlsh installed depending on target database
  • Documented list of application access patterns (read/write queries the application performs)
  • Expected data volumes (document count, average document size, growth rate)
  • Read/write ratio and latency requirements for each access pattern
  • Understanding of consistency requirements (strong vs. eventual consistency)

Instructions

  1. Catalog all application access patterns as a table with columns: pattern name, query description, frequency (queries/sec), latency requirement, and data fields accessed. This drives every modeling decision.

  2. For MongoDB document modeling, apply the embedding vs. referencing decision framework:

    • Embed when: data is always accessed together, child data has no independent lifecycle, cardinality is bounded (1:few), and updates are infrequent.
    • Reference when: data has independent access patterns, cardinality is unbounded (1:many/many:many), child documents are large, or data is shared across parents.
  3. Design document schemas that match query patterns. If the application needs "all orders for a customer with line items," embed line items inside the order document. If the application needs "all products across all orders," use references to a products collection.

  4. For DynamoDB, design the partition key and sort key to support the primary access pattern with a single-table design. Use composite sort keys (e.g., ORDER#2024-01-15#12345) for hierarchical data. Plan GSIs (Global Secondary Indexes) for secondary access patterns, keeping total GSI count under 5.

  5. Evaluate denormalization trade-offs: duplicating data across documents reduces read latency but increases write complexity and storage. Denormalize data that changes rarely (user names, product categories) but reference data that changes frequently (prices, inventory counts).

  6. Handle one-to-many relationships by choosing between embedding (small arrays), child referencing (parent stores child IDs), or parent referencing (child stores parent ID). For unbounded one-to-many, always use parent referencing to avoid document size limits (16MB in MongoDB).

  7. Model many-to-many relationships using an array of references in each document or a dedicated junction collection. For DynamoDB, use adjacency list patterns with inverted GSIs.

  8. Plan for schema evolution by using schema versioning fields (schemaVersion: 2), writing migration scripts that update documents in batches, and ensuring application code handles both old and new document shapes during rollout.

  9. Validate the model against access patterns by running sample queries with explain() in MongoDB or examining consumed capacity units in DynamoDB. Verify that primary access patterns require only single-partition reads.

  10. Document the final data model with sample documents, index definitions, and the access pattern mapping that justifies each modeling decision.

Output

  • Data model diagrams showing document/collection structure, embedded vs. referenced relationships
  • Sample documents in JSON format for each collection/table with realistic data
  • Index definitions including compound indexes, partial indexes, and TTL indexes
  • Access pattern mapping table linking each query to its supporting collection and index
  • Migration scripts for evolving schemas from existing relational models to NoSQL

Error Handling

ErrorCauseSolution
Document exceeds 16MB size limit (MongoDB)Unbounded array growth from embedding too many child documentsSwitch from embedding to referencing; use the bucket pattern to chunk large arrays into fixed-size sub-documents
Hot partition in DynamoDBPartition key with low cardinality causes uneven distributionAdd a random suffix or use a composite key; distribute writes across partitions with write sharding
High read latency on referenced documentsToo many round trips to resolve references (N+1 query problem)Denormalize frequently accessed reference data; use $lookup aggregation for server-side joins; batch reference resolution
Inconsistent denormalized dataWrite to source succeeds but denormalized copies not updatedImplement change streams (MongoDB) or DynamoDB Streams to propagate updates; use transactional writes where supported
Query requires full collection scanMissing index on query filter fieldsCreate compound indexes matching query predicates and sort order; use explain() to verify index usage

Examples

E-commerce product catalog in MongoDB: Products embed variant arrays (size, color, price) since variants are always accessed with the product. Reviews reference the product by ID since reviews are accessed independently and grow unboundedly. A compound index on {category: 1, price: 1} supports filtered browsing.

Social media feed in DynamoDB single-table design: Partition key is USER#userId, sort key is POST#timestamp for user timeline queries. A GSI with partition key HASHTAG#tag and sort key timestamp supports hashtag feeds. User profile data uses sort key PROFILE on the same partition.

IoT sensor data in Cassandra: Partition key is sensor_id, clustering column is timestamp DESC. Each partition holds one sensor's readings, ordered by time. TTL of 90 days automatically expires old readings. Materialized views support queries by location and sensor type.

Resources

Frequently asked questions about NoSQL Data Modeler

Similar skills