What problem does it solve? MongoDB and Mongoose fail silently: queries on non-existent fields return empty results, missing indexes cause full collection scans, and relationship references are never enforced. This Skill provides a systematic procedure to audit schemas, map query patterns to indexes, and run safe data migrations before these issues reach production. ## Core Features & Use Cases - Index Coverage Auditing: Find schemas with no indexes, map every find/aggregate query pattern to a supporting compound or single-field index, and add them before model export. - Relationship Validation: Verify that Mongoose ref directions are correct so queries like Inbox.findOne({ agentId }) do not silently return null on non-existent fields. - Idempotent Data Migrations: Run rename/transform migrations that return { migrated, total }, handle empty results gracefully, use .lean() for reads, and report errors to Sentry. - Schema Verification Tests: Write bun test suites that assert required fields, ref directions, and index definitions exist in schema files before every deploy. - Use Case: An admin dashboard joins Messages by organizationId and sorts by createdAt; this Skill detects the missing compound index { organizationId: 1, createdAt: -1 } and adds it before the query scans the full collection. ## Quick Start Ask the agent to audit all Mongoose schemas in db/mongo/schemas for missing indexes and incorrect relationship directions, then add the required indexes and verification tests.