memgoose
Skill1 starsChanged 6 months agoMITView on GitHub
Use memgoose for Mongoose-like in-memory databases, backend tests that mock mongoose, schema/model/query implementation, storage backend selection, aggregation pipelines, and performance tuning with indexes or lean queries. Trigger when working with memgoose directly, replacing mongoose in tests with memgoose, writing model tests, configuring memory/file/SQLite/WiredTiger storage, or using memgoose schemas, queries, populate, hooks, virtuals, discriminators, ObjectId, and aggregation.
In this repository7 other files it gives its agents.
- braid-promptingSkill
- git-best-practicesSkill
- lucide-iconsSkill
- milkdownSkill
- raison-sdkSkill
- readme-creatorSkill
- reka-uiSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 6 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use this skill to work efficiently with memgoose using only the documented API.
- Distinctive: line 22
Prefer docs-backed patterns over assumptions from Mongoose.
- Very specific: line 45
Use Schema and model for default memory storage, or create a configured database with connect() / createDatabase() when storage matters.
- Very specific: line 64
Use MongoDB-like filters and update operators.
- Distinctive: line 81
Use memory for tests and transient data.
- Distinctive: line 87
Do not describe memgoose as full Mongoose or MongoDB parity.
- Distinctive: line 88
Do not add undocumented configuration keys or operators.
- Distinctive: line 89
Use indexes for frequently queried fields and compound indexes for common multi-field filters.
- Very specific: line 90
Use lean queries only when virtuals, methods, and save() are unnecessary.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Memgoose
Use this skill to work efficiently with memgoose using only the documented API. memgoose is a lightweight MongoDB-like, Mongoose-style TypeScript database with memory storage by default and optional persistent storage.
First Steps
Identify the task and load only the needed reference:
- Testing or mocking mongoose: read
references/testing.md. - Basic models, CRUD, and connection setup: read
references/basics.md. - Schema fields, validation, indexes, timestamps, methods, or statics: read
references/schemas.md. - Queries, updates, chaining, select, sort, pagination, lean, populate, or atomic operations: read
references/queries.md. - Aggregation pipelines and analytics: read
references/aggregation.md. - Storage backend choice or persistence setup: read
references/storage.md. - Performance tuning: read
references/performance.md.
Prefer docs-backed patterns over assumptions from Mongoose. If a requested Mongoose feature is not in these references, inspect the project docs before claiming support.
Common Workflows
Use memgoose in Tests
Mock mongoose before importing app code or production models:
import { vi } from 'vitest'
import { connect, disconnect, dropDatabase } from 'memgoose'
vi.mock('mongoose', () => import('memgoose'))
beforeAll(() => connect({ storage: 'memory' }))
afterAll(async () => disconnect())
beforeEach(async () => dropDatabase())For route tests, register the mock before building the app and then exercise the app through its test interface. See references/testing.md.
Build a Model
Use Schema and model for default memory storage, or create a configured database with connect() / createDatabase() when storage matters.
import { Schema, model } from 'memgoose'
const userSchema = new Schema({
email: { type: String, required: true, unique: true },
age: { type: Number, min: 0 }
})
userSchema.index('email')
const User = model('User', userSchema)See references/basics.md and references/schemas.md.
Query and Update Data
Use MongoDB-like filters and update operators. Query builders are thenable and also support .exec().
const users = await User.find({ age: { $gte: 18 } })
.sort('-age name')
.limit(20)
.select('email age')
.lean()
.exec()
await User.updateOne({ email }, { $inc: { loginCount: 1 } })See references/queries.md.
Choose Storage
Use memory for tests and transient data. Use file, SQLite, or WiredTiger only when persistence is required or the task explicitly targets those backends. Always disconnect persistent databases when done.
See references/storage.md.
Guardrails
- Do not describe memgoose as full Mongoose or MongoDB parity; use the documented supported APIs.
- Do not add undocumented configuration keys or operators.
- Use indexes for frequently queried fields and compound indexes for common multi-field filters.
- Use lean queries only when virtuals, methods, and
save()are unnecessary.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

