typegoose-modeling
Simplifies creating type-safe MongoDB models in TypeScript with Typegoose decorators.
Install
mkdir -p .claude/skills/typegoose-modeling && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/17979" && unzip -o skill.zip -d .claude/skills/typegoose-modeling && rm skill.zipInstalls to .claude/skills/typegoose-modeling
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Create MongoDB models using Typegoose following project conventions. Use when defining database schemas, creating new models, working with embedded documents, adding indexes for query optimization, or exporting type-safe model instances.Key capabilities
- →Define database schemas using Typegoose.
- →Create new MongoDB models with class-based schemas.
- →Work with embedded documents for nested objects.
- →Add single and compound indexes for query optimization.
- →Export type-safe model instances.
How it works
The skill uses Typegoose to wrap Mongoose, enabling class-based schemas with decorators to define MongoDB models. It use TypeScript's `emitDecoratorMetadata` for automatic type inference.
Inputs & outputs
When to use typegoose-modeling
- →Define mongodb schema
- →Add indexes to model
- →Create embedded document types
- →Export type-safe models
About this skill
Typegoose Modeling
Modular guides for creating type-safe MongoDB models with Typegoose and Mongoose, following project conventions.
Core Concepts
Models live in apps/server/src/db/models and use Typegoose to wrap Mongoose. Always use class-based schemas with @modelOptions and the standard @prop decorator from Typegoose.
Note: This project uses SWC for TypeScript compilation with emitDecoratorMetadata enabled, so Typegoose can automatically infer types from TypeScript annotations without explicit type declarations.
Quick Reference
| Guide | Use When |
|---|---|
| Property Decorators | Understanding @prop options and patterns |
| Embedded Documents | Creating nested objects and arrays of documents |
| Indexes | Optimizing queries with single and compound indexes |
| Common Patterns | Enums, timestamps, references, optional fields, collections |
| Best Practices | Architecture patterns, keeping models pure, sharing schemas |
Learning Path
Beginner: Start with Prop Decorators → Common Patterns → Basic model creation
Intermediate: Add Embedded Documents → Indexes for query optimization
Advanced: Best Practices → Architecture patterns
See Also
- examples/basic-model.ts - Simple model structure
- examples/model-with-indexes.ts - Single and compound indexes
- examples/embedded-documents.ts - Nested documents
When not to use it
- →When not working with MongoDB or Typegoose.
- →When not defining database schemas or models.
- →When not using TypeScript for model definitions.
Limitations
- →The skill relies on SWC for TypeScript compilation with `emitDecoratorMetadata` enabled.
- →Model definitions are expected to reside in `apps/server/src/db/models`.
- →The skill focuses on Typegoose and Mongoose, not other ORMs or database types.
How it compares
This skill enforces project conventions for Typegoose modeling, providing structured guidance for property decorators, embedded documents, and indexing, which differs from ad-hoc Mongoose schema definitions.
Compared to similar skills
typegoose-modeling side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| typegoose-modeling (this skill) | 0 | 22d | No flags | Intermediate |
| mongodb | 0 | 4mo | Review | Intermediate |
| supabase-developer | 95 | 7mo | Review | Intermediate |
| payload | 73 | 1mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
mongodb
IamAshrafee
Work with MongoDB databases using best practices. Use when designing schemas, writing queries, building aggregation pipelines, or optimizing performance. Triggers on MongoDB, Mongoose, NoSQL, aggregation pipeline, document database, MongoDB Atlas.
supabase-developer
daffy0208
Build full-stack applications with Supabase (PostgreSQL, Auth, Storage, Real-time, Edge Functions). Use when implementing authentication, database design with RLS, file storage, real-time features, or serverless functions.
payload
payloadcms
Use when working with Payload CMS projects (payload.config.ts, collections, fields, hooks, access control, Payload API). Use when debugging validation errors, security issues, relationship queries, transactions, or hook behavior.
convex-backend
CloudAI-X
Convex backend development guidelines. Use when writing Convex functions, schemas, queries, mutations, actions, or any backend code in a Convex project. Triggers on tasks involving Convex database operations, real-time subscriptions, file storage, or serverless functions.
convex
waynesutton
Umbrella skill for all Convex development patterns. Routes to specific skills like convex-functions, convex-realtime, convex-agents, etc.
alwib-backend
Tsuev
Develop and maintain the Alwib NestJS backend in `backend/`. Use when implementing or refactoring modules, controllers, services, DTO validation, Swagger docs, authentication/authorization flows, Prisma schema and migrations, and backend lint/test flows.