TY

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.zip

Installs 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.
237 chars✓ has a “when” trigger
Intermediate

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

You give it
TypeScript class definitions with Typegoose decorators
You get back
Type-safe MongoDB models

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

GuideUse When
Property DecoratorsUnderstanding @prop options and patterns
Embedded DocumentsCreating nested objects and arrays of documents
IndexesOptimizing queries with single and compound indexes
Common PatternsEnums, timestamps, references, optional fields, collections
Best PracticesArchitecture 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.

SkillInstallsUpdatedSafetyDifficulty
typegoose-modeling (this skill)022dNo flagsIntermediate
mongodb04moReviewIntermediate
supabase-developer957moReviewIntermediate
payload731moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

Search skills

Search the agent skills registry