home / skills / ehtbanton / claudeskillsrepo / mongodb-schema-generator
This skill generates complete Mongoose schema files with validation, indexes, and virtuals for TypeScript projects.
npx playbooks add skill ehtbanton/claudeskillsrepo --skill mongodb-schema-generatorReview the files below or copy the command above to add this skill to your agents.
---
name: mongodb-schema-generator
description: Generate MongoDB/Mongoose schema files with validation, indexes, and virtuals. Triggers on "create mongodb schema", "generate mongoose model", "mongo schema", "mongoose model for".
---
# MongoDB Schema Generator
Generate Mongoose schema files with validation, indexes, virtuals, and methods.
## Output Requirements
**File Output:** `*.model.ts` or `*.schema.ts`
**Format:** Valid Mongoose TypeScript
**Standards:** Mongoose 8.x with TypeScript
## When Invoked
Immediately generate a complete Mongoose schema with validation and indexes.
## Example Invocations
**Prompt:** "Create MongoDB schema for blog posts"
**Output:** Complete `post.model.ts` with validation, indexes, and virtuals.
This skill generates ready-to-use Mongoose schema and model files in TypeScript for MongoDB. It produces complete *.model.ts or *.schema.ts files that include validation, indexes, virtuals, static and instance methods, and TypeScript types compatible with Mongoose 8.x. The output is designed for direct use in a Node.js/TypeScript codebase.
When triggered, the skill analyzes the provided entity description, fields, and relationships and emits a fully formed TypeScript Mongoose schema file. It includes field types, required/optional flags, custom validators, compound and single-field indexes, virtual properties, and example statics/methods. The generated file follows Mongoose 8.x TypeScript patterns and compiles-ready structure.
Which file names and formats does the skill output?
It outputs TypeScript files named with .model.ts or .schema.ts containing a Mongoose schema and model compatible with Mongoose 8.x.
Can it add indexes and virtuals automatically?
Yes — provide indexing needs and computed fields in the prompt and the generator will add single-field and compound indexes as well as virtuals.