Mongoose ODM & MongoDB Patterns
Implement robust MongoDB data modeling with Mongoose, featuring schema-driven validation, middleware hooks, and optimized TypeScript type inference.
This skill equips Claude with professional patterns for working with Mongoose ODM in Node.js environments. It focuses on schema-first development, leveraging automatic TypeScript type inference to minimize redundancy while maximizing type safety. The skill enforces critical performance optimizations like using .lean() for read operations and ensures reliable database behavior through strict transaction management and middleware registration rules. By following these patterns, developers can avoid common pitfalls such as hydration overhead, silent transaction failures, and connection timeouts in modern Node.js runtimes.