Document database implementation for flexible schema applications. Use when building content management, user profiles, catalogs, or event logging. Covers MongoDB (primary), DynamoDB, Firestore, schema design patterns, indexing strategies, and aggregation pipelines.
Production-ready Claude Skill for NoSQL document database selection and implementation.
This skill guides document database selection and implementation for flexible schema applications across Python, TypeScript, Rust, and Go.
Primary databases covered:
using-document-databases/
├── SKILL.md # Main skill file (<500 lines)
├── references/
│ ├── mongodb.md # MongoDB collections, indexes, aggregation
│ ├── dynamodb.md # DynamoDB single-table, GSI patterns
│ ├── firestore.md # Firestore real-time, security rules
│ └── schema-design-patterns.md # Embedding vs referencing framework
├── examples/
│ ├── mongodb-fastapi/ # Python FastAPI + MongoDB (Motor)
│ │ ├── main.py
│ │ └── requirements.txt
│ └── dynamodb-serverless/ # Python Lambda + DynamoDB
│ ├── handler.py
│ └── serverless.yml
└── scripts/
└── validate_indexes.py # MongoDB index validation tool
The skill automatically triggers when building applications with:
Use MongoDB when:
Use DynamoDB when:
Use Firestore when:
Decision matrix for embedding vs referencing:
See references/schema-design-patterns.md
MongoDB index types:
Validate indexes:
python scripts/validate_indexes.py --db myapp --collection orders
MongoDB's killer feature for complex transformations:
$match, $project, $group, $lookup$unwind, $sort, $limit, $facetSee references/mongodb.md for aggregation cookbook.
Access pattern-driven modeling:
PK: USER#12345, SK: METADATA # User data
PK: USER#12345, SK: ORDER#001 # User's orders
PK: ORDER#001, SK: METADATA # Order details
PK: ORDER#001, SK: ITEM#001 # Order items
See references/dynamodb.md for complete patterns.
Production-ready async API with Motor:
cd examples/mongodb-fastapi
pip install -r requirements.txt
export MONGODB_URI="mongodb://localhost:27017/"
python main.py
Features:
AWS serverless API with single-table design:
cd examples/dynamodb-serverless
npm install -g serverless
serverless deploy
Features:
Python:
pymongo (sync)motor (async with AsyncIO/FastAPI)boto3 (DynamoDB)TypeScript:
mongodb (native driver)@aws-sdk/client-dynamodb (DynamoDB SDK v3)firebase/firestore (Firestore)Rust:
mongodb crateaws-sdk-dynamodbGo:
mongo-go-driveraws-sdk-go-v2media/ - File metadata storage (MongoDB GridFS) ai-chat/ - Conversation history + vector search (Atlas Vector Search) feedback/ - Event logging (DynamoDB high-throughput writes) forms/ - Dynamic form submissions (Firestore real-time validation) search-filter/ - Product catalogs (MongoDB Atlas Search)
Pagination (MongoDB):
// Cursor-based (recommended)
db.products.find({ _id: { $gt: lastId }}).limit(20)
Soft Deletes:
// Mark as deleted instead of removing
{ deleted: true, deletedAt: ISODate("...") }
Audit Logs:
// Versioned documents
{ documentId: "doc123", version: 3, history: [...] }
Python:
pip install motor pymongo boto3 firebase-admin
TypeScript:
npm install mongodb @aws-sdk/client-dynamodb firebase
❌ Unbounded arrays - Use references instead
❌ Deep nesting - Flatten with references
❌ Over-indexing - Index only queried fields
❌ DynamoDB scans - Always use query with partition key
❌ Missing indexes - Validate with explain()
Run index validation:
python scripts/validate_indexes.py --db myapp --all
Expected output:
references/mongodb.mdreferences/dynamodb.mdreferences/firestore.mdreferences/schema-design-patterns.mdv0.1.0 - Initial release (December 2025)
Skill Author: Claude Code Skill Type: Database Implementation Languages: Python, TypeScript, Rust, Go Databases: MongoDB, DynamoDB, Firestore
npx skills add ancoleman/using-document-databases下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer