This template gives you the same shape of project artifacts you built and used during the AI Coding with MongoDB Workshop. Clone it, customize four files, and Claude Code will use the same defaults in every prompt.
You influence what Claude Code reaches for through, in decreasing order of strength:
- A
CLAUDE.mdin the project root. The agent reads it on every prompt. This is the strongest lever. - Repo artifacts the agent reads first. The
mongodbdriver inpackage.json(already here); no strayprisma/schema.prismaorpostgresservices indocker-compose.yml. - An MCP server wired to your database. Lives at
.mcp.jsonat the project root. Lets Claude Code talk to your actual MongoDB instance. - Domain skills. Install the official MongoDB plugin with
/plugin install mongodbfrom inside Claude Code.
This template ships the first three. Step 6 below enables the fourth.
Sign up at https://www.mongodb.com/cloud/atlas/register. The M0 tier is free forever, no credit card required. Create a cluster, create a database user, allow your IP, and grab the connection string.
For purely local development, MongoDB Community Edition on mongodb://localhost:27017 works as well, but Atlas is recommended once you go beyond a single-machine prototype.
export MONGODB_URI="mongodb+srv://USER:PASS@CLUSTER.mongodb.net/YOUR_DB_NAME"Persist it in your shell profile so Claude Code's MCP server inherits it.
Open CLAUDE.md and replace <your-db-name> with the actual database name your application will use. Add any project-specific conventions (folder layout, error format, auth approach, team coding standards).
Fill in the four sections (Domain, Data sources, Access patterns, Constraints). The agent uses this to reason about your schema before it proposes one. The more specific you are about access patterns, the better the schema you get back.
.mcp.json at the project root reads the connection string from your shell's MONGODB_URI, which you set in Step 2. No edits needed in the default case. The first time you launch Claude Code in this project, it asks you to approve this MCP server, which is the standard prompt for project-scoped MCP configs. If you'd rather hardcode the URI inline (not recommended; easy to commit by accident), replace ${MONGODB_URI} in .mcp.json with your Atlas connection string.
npm install
claudeInside Claude Code:
/plugin install mongodb
That gives Claude Code seven MongoDB skills: schema design, natural language querying, query optimization, MCP setup, search with AI, connection configuration, and Atlas Stream Processing. Source at https://github.com/mongodb/agent-skills.
Read CLAUDE.md and CONTEXT.md, then propose a MongoDB schema for this application.
This step assumes you've filled in CONTEXT.md's access patterns section. The prompt below asks Claude Code to build endpoints around those patterns; if the section is empty, you'll get generic CRUD instead.
Paste this:
Now build a working API on top of the schema you proposed.
1. Use the MongoDB MCP server to create the collections in my database
and seed them with realistic sample data so I have something to
query.
2. Scaffold an Express API in `server.js`. Use the official `mongodb`
driver (already in package.json), ESM imports (the project is
`"type": "module"`), and listen on port 3000.
3. Add one endpoint per access pattern listed in CONTEXT.md. Include
at least one aggregation endpoint that answers an analytical
question for this domain.
4. Add `express` to package.json and run `npm install`.
Show me the route list and the seed-data plan before you write any
code or run any MCP write operations.
Reading the plan before code lets you catch wrong sample-data assumptions or missing endpoints early. After you accept it, Claude Code creates the collections, writes the server, and starts it. The bonus below assumes this step ran and the server is on port 3000.
Once you have a schema, a couple of endpoints, and an analytical query that returns interesting data, you are one prompt away from a working dashboard. The prompt below assumes you have at least one aggregation endpoint already in your API; if not, ask Claude Code to add one first (top-N by some field is a good starting point), then come back here.
Paste this into Claude Code exactly as written:
Add a GET /dashboard route to my Express server that serves a single
self-contained HTML page. The page should call the aggregation endpoint
I added to this API (read the server file to find the route path and
the response shape) and render the results as a small dashboard.
Use vanilla HTML, CSS, and JavaScript only. No build tools, no npm
installs, no external frameworks, no CDN links. Inline all CSS and
JavaScript in the HTML file. Serve the HTML as a string from the
route handler.
Style it with MongoDB's brand colors:
- forest green #00684A for primary elements
- spring green #00ED64 for accents
- charcoal #001E2B for text
- white background
Render summary numbers as cards at the top and any ranked or grouped
data as a simple HTML/CSS bar chart. Make it look polished and ready
to demo. Restart the server so Express picks up the new route.
Open http://localhost:3000/dashboard in your browser. The page should render with the data your aggregation returned. The leverage moment is in how little this prompt has to specify: the agent reads the existing server file, finds the route, infers the response shape, and writes the matching UI.
Claude Code can handle your routine git work too. The conventions for how it should behave around git live in CLAUDE.md: it won't push without asking, won't amend pushed commits, keeps messages concise, and confirms before anything destructive. Three example prompts you can lift verbatim. Read the diff or the message before you accept.
Stage and commit:
Stage the changes I just made and commit them with a concise message
describing the why, not the what. Don't push.
Create a branch:
Create a feature branch off main called feature/<short-name>, switch
to it, and stage no changes yet. I'll tell you what's next.
Open a PR:
Push this branch to origin and open a PR. Title under 70 chars.
Body should have a one-paragraph summary of what changed and why,
plus a short test plan.