create-backend
Skill0 starsChanged 15 days agoMITView on GitHub
Build a complete, production-grade Node.js backend from a plain-language product description — "create a backend for X using MongoDB/Postgres". Plans entities and the API contract, waits for approval, then assembles a working Express 5 + ES Modules project from tested templates (config, database, auth with rotating refresh tokens, rate limits, feature modules, optional AI module, API docs, Docker) and verifies it runs. Use whenever the user asks to create, scaffold, start or bootstrap a backend, API or server from scratch.
- Reads credentials
- Installs packages
In this repository14 other files it gives its agents.
- ai-integrationSkill
- api-docsSkill
- auth-sessionsSkill
- backend-conventionsSkill
- backend-reviewSkill
- deploy-dockerSkill
- mongoose-mongodbSkill
- new-moduleSkill
- nextjs-api-routesSkill
- prisma-postgresSkill
- redis-cacheSkill
- scheduled-jobsSkill
- security-hardeningSkill
- session-logSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. About 0 are common, 6 are distinctive, and 9 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.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 26
If the target folder already has package.json or src/, stop: this is an existing project → use new-module.
- Distinctive: line 27
If there is a CLAUDE.md or AGENTS.md, read it.
- Distinctive: line 36
If the database is genuinely unclear, ask once.
- Distinctive: line 40
Write this plan and wait for the user to confirm before creating anything:
- Very specific: line 58
Only entities and endpoints the user described, plus User and Session for auth.
- Very specific: line 59
Update = POST /:id, delete = POST /:id/remove (soft delete), actions = POST /:id/<verb>.
- Very specific: line 64
Write every file from templates/common.md.
- Very specific: line 65
Write every file from templates/mongodb.md or templates/postgres.md.
- Distinctive: line 67
Check the count: the files you wrote equal the bundle counts above (34 + 7, or 34 + 8, plus 21 with AI).
- Very specific: line 87
No AI: delete the ai config block, AI_* lines in .env.example, and the aiLimiter export with its rateLimiting.ai* config.
- Very specific: line 97
Use current versions; if a template version fails to resolve, check npm view <pkg> version and update.
- Very specific: line 126
Every module has controllers/, services/, routes/, validations/, index.js.
- Distinctive: line 138
If Docker or a database is not available, say exactly which checks you could not run.
- Very specific: line 144
No comments in code. No console.log.
- Distinctive: line 148
No features, libraries or abstractions the user did not ask for.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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
Create Backend
The user describes what they are building. You decide how using this skill, and never invent product scope. Every file comes from the Markdown bundles in templates/ next to this file. Each bundle lists files under ## \<path>`` headings, each followed by one fenced code block holding the complete file. Write each block's content, byte for byte, to that path inside the project, then adapt. Do not rewrite templates from memory and do not skip files.
Templates
| Bundle | Files | Contents |
templates/common.md | 34 | every project: app, server, config, shared/, health + auth modules, CLAUDE.md, README, api/ docs, ESLint, env |
templates/mongodb.md | 7 | MongoDB: config/databases.js, User + Session models, auth service, package.json, Docker |
templates/postgres.md | 8 | PostgreSQL: config/databases.js, prisma/schema.prisma, prisma.config.js, auth service, package.json, Docker, entrypoint |
templates/ai.md | 21 | optional: shared/ai, shared/crypto, shared/network, modules/assistant (prompt/, tools/, evals/), api/assistant.md |
templates/mongodb-example.md | 7 | reference feature module ("vendor") for MongoDB — a pattern, never shipped as is |
templates/postgres-example.md | 7 | reference feature module ("vendor") for PostgreSQL — a pattern, never shipped as is |
A project = common.md + one of mongodb.md / postgres.md (+ ai.md when needed). No path appears in two bundles. Read a bundle fully before writing from it. The fence around each file can be longer than three backticks when the file itself contains code fences; the file content is everything between the opening and the matching closing fence.
Phase 0 — Read first
- If the target folder already has
package.jsonorsrc/, stop: this is an existing project → usenew-module. - If there is a
CLAUDE.mdorAGENTS.md, read it; its rules win. - Choose the stack:
| Signal | Choice |
| "mongodb", "mongo", "mongoose", or document-shaped data | mongodb.md |
| "postgres", "sql", "prisma", or relational/reporting-heavy data | postgres.md |
| "ai", "llm", "chat", "assistant", "summarize", "agent" | add ai.md |
If the database is genuinely unclear, ask once. Otherwise decide and say which.
Phase 1 — Contract (wait for approval)
Write this plan and wait for the user to confirm before creating anything:
Stack: Express 5, ESM, <Mongoose | Prisma>, Zod 4, winston, Redis optional<, OpenAI-compatible AI>
Scope: <ownerId | storeId | orgId> — the field every domain record is scoped by
Entities
| Entity | Fields | Scope | Indexes |
Roles: EUserRole = { OWNER, MANAGER, STAFF } (adjust to the product)
Endpoints (GET/POST only)
| Method | Path | Roles | Input | Returns |
Out of scope: <what you deliberately did not add>
Questions: <only ones that change schema or contract>- Only entities and endpoints the user described, plus
UserandSessionfor auth. - Update =
POST /:id, delete =POST /:id/remove(soft delete), actions =POST /:id/<verb>. - Scope. Single-owner data →
ownerId=req.user.id(what the templates do). Multi-tenant (stores, orgs, clinics) → a tenant entity and a<tenant>Idon every record; see Phase 4.
Phase 2 — Assemble
- Write every file from
templates/common.md. - Write every file from
templates/mongodb.mdortemplates/postgres.md. For Postgres,chmod +x docker-entrypoint.sh. - With AI only: write every file from
templates/ai.md. - Check the count: the files you wrote equal the bundle counts above (34 + 7, or 34 + 8, plus 21 with AI).
Then replace every placeholder (grep -rn "__[A-Z_]*__" <project> must return nothing at the end):
| Placeholder | File | Value |
__PACKAGE_NAME__ | package.json | kebab-case project name |
__PROJECT_NAME__ | CLAUDE.md, README.md, api/README.md | display name |
__ONE_LINE_PRODUCT_DESCRIPTION__ | CLAUDE.md, README.md | one sentence from the user |
__DATABASE__ | CLAUDE.md | MongoDB (Mongoose) or PostgreSQL (Prisma 7) |
__MODELS_LINE__ | CLAUDE.md | Mongo: models/<name>.model.js Mongoose models, default export; Postgres: prisma/schema.prisma models + migrations/ |
__SCOPE_FIELD__ | CLAUDE.md, api/README.md | the scope field |
__SCOPE_CLAIM_NOTE__ | CLAUDE.md | empty, or , plus <tenant>Id from the token when multi-tenant |
__EXTRA_COMMANDS__ | CLAUDE.md | Postgres: · npm run db:migrate · npm run db:generate; add · npm run eval:assistant with AI; else empty |
__SETUP_EXTRA__ | README.md | Postgres: npm run db:migrate plus a newline; else empty |
__SCRIPTS_EXTRA__ | README.md | Postgres rows for db:migrate, db:generate, db:migrate:deploy; AI row for eval:assistant; else empty |
__DATABASE_ENV__ | .env.example | Mongo: MONGODB_URI=mongodb://localhost:27017/<name>; Postgres: DATABASE_URL=postgresql://app:YOUR_DB_PASSWORD@localhost:5432/app, DATABASE_READ_URL=, DATABASE_POOL_MAX=10. Tell the user to pick a real local password and set it in both docker-compose.yml (POSTGRES_PASSWORD) and DATABASE_URL |
Clean up what does not apply:
src/config/index.js: delete themongoblock for Postgres, thedatabaseblock for MongoDB.- No AI: delete the
aiconfig block,AI_*lines in.env.example, and theaiLimiterexport with itsrateLimiting.ai*config. - With AI: add
"openai"to dependencies,"eval:assistant": "node src/modules/assistant/evals/run-evals.js"to scripts, mountassistantRoutesat/assistantinsrc/router/index.js, addassistant.mdtoapi/README.md. - Redis stays: everything works without
REDIS_URLS(cache returns misses, rate limits use memory). Remove theredisservice fromdocker-compose.ymlonly if the user says no Redis.
Phase 3 — Install and database
npm installUse current versions; if a template version fails to resolve, check npm view <pkg> version and update.
Postgres: docker compose up -d postgres then npm run db:migrate -- --name init.
Phase 4 — Auth and scope
Auth is already complete in the templates: sign-up, sign-in, refresh rotation with reuse detection, logout, logout-all, me, sessions. authenticate sets req.user = { id, role }.
Multi-tenant products need three edits, all in one change:
- Tenant model (
Store,Organization, …) and a<tenant>IdonUser(or a membership collection/table if users belong to several tenants). claimsOfinsrc/modules/auth/services/auth.service.jsadds<tenant>Id;signAccessTokeninsrc/shared/utils/token.jsputs it in the JWT;authenticatecopies it ontoreq.user.- Feature modules scope by
req.user.<tenant>Idinstead ofreq.user.id.
Change the default role on User if self sign-up should not create an OWNER. Follow auth-sessions for email verification or Google sign-in if requested.
Phase 5 — Feature modules
For each entity in the approved plan, take templates/mongodb-example.md or templates/postgres-example.md, write its files with vendor / Vendor / vendors / VENDOR renamed throughout:
| From the example bundle | To project |
src/models/vendor.model.js (Mongo) | src/models/<name>.model.js |
prisma/vendor.prisma (Postgres) | append to prisma/schema.prisma; add the back-relation (<names> <Name>[]) on User or the tenant; migrate |
src/shared/constant/vendor.js | src/shared/constant/<name>.js — E<Name>Status, etc. |
src/modules/vendor/{controllers,services,routes,validations}/ | src/modules/<name>/… with <name>.<type>.js file names |
src/modules/vendor/index.js | export { default as <name>Routes } from './routes/<name>.route.js'; |
Register each in src/router/index.js: router.use('/<plural>', <name>Routes);. Write api/<name>.md and add it to api/README.md (see api-docs).
Every module has controllers/, services/, routes/, validations/, index.js. AI modules add prompt/, tools/, evals/ like modules/assistant in templates/ai.md. A module with no input (health) has no validations/.
Apply backend-conventions to every file. Use mongoose-mongodb or prisma-postgres for queries and indexes.
Phase 6 — Verify (required, report honestly)
grep -rn "__[A-Z_]*__" .→ nothing.npm run lint→ zero problems.- With
.envfilled (cp .env.example .env, real JWT secrets):docker compose up -d,npm run dev, thenGET /v1/health→ 200,GET /v1/health/ready→ 200POST /v1/auth/sign-up→ 201 withaccessToken- one create + list on each feature module with that token → 201 / 200
- If Docker or a database is not available, say exactly which checks you could not run. Never claim it works without running it.
Finish with: the tree, the endpoint table, env vars to fill, and the next commands.
Non-negotiables
- No comments in code. No
console.log. - GET and POST only. Soft delete only. Every read filters
isActive: trueand the scope. - Select fields explicitly;
Promise.allindependent queries; no queries in loops; index every filter. - Services throw
ErrorwithstatusCode; controllers usehttpResponse/httpError; never pass{ data }. - No features, libraries or abstractions the user did not ask for.
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.

