Skip to content
Agentmart
Submit a tool

mongo-index

Use when a MongoDB query or aggregation is slow, when explain shows COLLSCAN or an in-memory sort, or when designing indexes for a collection.

Skill by Srimukh99

IndexedMIT
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/srimukh99-mongo-index

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Use when a MongoDB query or aggregation is slow, when explain shows COLLSCAN or an in-memory sort, or when designing indexes for a collection.

Use cases: data

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/mongo-index

What's inside

Skill name
mongo-index
Description
Use when a MongoDB query or aggregation is slow, when explain shows COLLSCAN or an in-memory sort, or when designing indexes for a collection.
License
MIT
Instructions
30 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# mongo-index

## 1. Measure

`db.coll.find(<filter>).sort(<sort>).explain("executionStats")`, or `.explain()` on the aggregate. Look at:

- `totalDocsExamined` vs `nReturned`: far above 1:1 means wasted work.
- A `COLLSCAN` stage on a large collection.
- A brubricg `SORT` stage (sorting in memory).

## 2. Design the index (Equality, Sort, Range)

Order compound index fields: equality matches first, then sort fields, then range filters. Example: filter `{status: "open", created: {$gt: d}}` sorted by `priority` → index `{status: 1, priority: 1, created: 1}`.

## 3. Sharpen it

- **Covered queries**: project only indexed fields (and exclude `_id` if not in the index) so documents are never fetched.
- **Partial indexes** when queries always target a subset (`{status: "open"}`).
- **TTL indexes** for data that should expire.
- **Aggregations**: put `$match` and `$sort` first so they can use an index; `$lookup` on a large collection needs an index on the foreign field.

## 4. Keep the set healthy

Every index slows writes and uses memory. Use `$indexStats` to find unused indexes and remove them after confirming with the owners. Build new indexes on large production collections during low traffic and watch replication lag.

## Prove it

Report `executionTimeMillis` and `totalDocsExamined` before and after (`ship`).

From Srimukh99/rubric, MIT.

More from Srimukh99/rubric

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Oct 2, 2026 (26 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from Srimukh99

Cite this page

mongo-index skill. Agent Mart. https://agentmart.dev/skills/srimukh99-mongo-index (last updated 2026-10-24)