Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Mongoose TypeScript Skill

A Codex skill for designing, implementing, and reviewing Mongoose models in strict TypeScript projects.

The skill emphasizes schema-driven type inference, typed methods and statics, safe population, intentional indexes, and the places where Mongoose inference needs help.

What it covers

  • Automatic schema and hydrated-document inference
  • Explicit, inferred ObjectId _id fields
  • Literal-union enums from const tuples or const objects
  • DTO and input types derived without duplicating schema fields
  • Methods, statics, virtuals, query helpers, and middleware
  • ObjectId references and typed populate()
  • Lean query results
  • Index design and production index management
  • Model caching in hot-reload and test environments
  • Cases that need explicit types, including plugins and post-construction schema changes

The detailed worked example is loaded only when needed, keeping the main skill compact.

Install

Install directly from GitHub with the Codex skill installer:

Install the skill from https://github.com/HamStudy/mongoose-typescript-skill

Or copy mongoose-typescript/ into your Codex skills directory.

Use

Invoke the skill explicitly:

Use $mongoose-typescript to create a Course model with a teacher reference,
typed methods, timestamps, and appropriate indexes.

It should also trigger for Mongoose schema, model, populate, virtual, middleware, and index work in TypeScript projects.

Repository layout

mongoose-typescript/
├── SKILL.md
├── agents/
│   └── openai.yaml
└── references/
    └── example.md

Compatibility

The guidance targets Mongoose 9.x with TypeScript strict mode enabled. For an older Mongoose release, check that release's documentation and existing project patterns before applying newer inference behavior.

Contributing

Keep SKILL.md focused on the decision-making workflow. Put extended examples and details in references/, link them directly from SKILL.md, and run the skill validator before submitting changes.

Mongoose behavior changes over time, so verify version-sensitive advice against the official Mongoose TypeScript documentation.

About

Codex skill for type-safe Mongoose models in TypeScript

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors