Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add kid-sid/codex-spellbook --skill mongodbgit clone --depth 1 https://github.com/kid-sid/codex-spellbookWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/kid-sid/codex-spellbook/mongodb)<a href="https://agentmods.dev/skills/kid-sid/codex-spellbook/mongodb"><img src="https://agentmods.dev/badge/skills/kid-sid/codex-spellbook/mongodb/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/kid-sid/codex-spellbook/mongodb"><img src="https://agentmods.dev/badge/skills/kid-sid/codex-spellbook/mongodb.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00035 | $0.04741 |
| Opus 5.5 | $0.00014 | $0.01896 |
| Sonnet 5.5 | $0.00007 | $0.00948 |
| Haiku 4.5 | $0.00003 | $0.00474 |
Grade A, and why
mongodb scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 573 lines — stays where its author put it; the contents beside it link to each section on GitHub.
MongoDB — Async Patterns with Motor
Async MongoDB via Motor, aggregation pipelines, and index design.
When to Activate
- Writing async MongoDB queries with Motor
- Designing aggregation pipelines (
$match,$group,$lookup,$unwind) - Creating indexes (compound, text, TTL, sparse, partial)
- Running multi-document transactions
- Watching for real-time changes with change streams
- Working with
adk.state(Agentex per-task state backed by MongoDB) - Designing document schemas for flexible or hierarchical data
Connection
from motor.motor_asyncio import AsyncIOMotorClient, AsyncIOMotorDatabase
client = AsyncIOMotorClient("mongodb://localhost:27017")
db: AsyncIOMotorDatabase = client["mydb"]
# With auth + replica set (production)
client = AsyncIOMotorClient(
"mongodb://user:pass@host1:27017,host2:27017/mydb?replicaSet=rs0&authSource=admin"
)
# Close on shutdown
client.close()
Collections are accessed as attributes — no schema declaration needed:
users = db["users"] # or db.users
orders = db.orders
CRUD
from datetime import datetime, timezone
from bson import ObjectId
# Insert one
result = await db.users.insert_one({
"email": "[email protected]",
"name": "Alice",
"role": "user",
"created_at": datetime.now(timezone.utc),
})
inserted_id = result.inserted_id # ObjectId
# Insert many
result = await db.users.insert_many([
{"email": "[email protected]", "name": "Bob"},
{"email": "[email protected]", "name": "Carol"},
])
# Find one
user = await db.users.find_one({"email": "[email protected]"})
user = await db.users.find_one({"_id": ObjectId("64a...")})
# Find many — returns an async cursor
cursor = db.users.find({"role": "admin"}).sort("created_at", -1).skip(0).limit(20)
users = await cursor.to_list(length=None) # length=None = all results
# Count
count = await db.users.count_documents({"role": "admin"})
estimated = await db.users.estimated_document_count() # fast, uses metadata
# Update one
result = await db.users.update_one(
{"_id": ObjectId("64a...")},
{"$set": {"role": "admin", "updated_at": datetime.now(timezone.utc)}},
)
matched = result.matched_count
modified = result.modified_count
# Update many
await db.users.update_many(
{"role": "user", "created_at": {"$lt": cutoff_date}},
{"$set": {"tier": "legacy"}},
)
# Upsert
await db.users.update_one(
{"email": "[email protected]"},
{"$setOnInsert": {"created_at": datetime.now(timezone.utc)},
"$set": {"name": "Dave", "role": "user"}},
upsert=True,
)
# Delete
await db.users.delete_one({"_id": ObjectId("64a...")})
await db.users.delete_many({"status": "inactive", "created_at": {"$lt": cutoff}})
# Find one and update (atomic — returns updated doc)
updated = await db.users.find_one_and_update(
{"_id": ObjectId("64a...")},
{"$inc": {"login_count": 1}},
return_document=True, # return doc after update
)
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago First seen · 573 lines · 35 tokens per session scan A 0aaa5375adfb
mongodb is a skill published in the GitHub repository kid-sid/codex-spellbook (22 stars, last pushed 5mo ago), licensed MIT. It adds 35 tokens to every session and 4,741 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
azure-cosmos-py
Azure Cosmos DB SDK for Python (NoSQL API). Use for document CRUD, queries, containers, and globally distributed data.
qdrant-clients-sdk
Qdrant provides client SDKs for various programming languages, allowing easy integration with Qdrant deployments.
azure-cosmos-db-py
Build Azure Cosmos DB NoSQL services with Python/FastAPI following production-grade patterns. Use when implementing database client setup with dual auth (DefaultAzureCredential + emulator), service...
azure-cosmos-py
Client library for Azure Cosmos DB NoSQL API — globally distributed, multi-model database.
azure-data-tables-py
NoSQL key-value store for structured data (Azure Storage Tables or Cosmos DB Table API).
adding-personhog-rpc
Guide for adding a new RPC to personhog-replica and personhog-router. Covers eligibility checks, proto definition, code generation for Python and Node.js clients, Rust implementation (storage trait, postgres queries, service handler, router wiring), and index compatibility validation. Use when adding a new gRPC…