nestjs-modular-monolith
Skill0 starsChanged 8 days agoMITView on GitHub
Set up or prepare a NestJS modular monolith with DDD layers, module contracts, and dependency-cruiser checks proven by a self-test. Use to scaffold, add a module, check boundaries, or assess an existing app.
In this repository3 other files it gives its agents.
- AGENTS.mdAGENTS.md
- nestjs-best-practicesSkill
- nestjs-learnSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Read structure.md for module code, rules.md before settings/reporting, existing-project.md for existing apps, options.md for requested …
- Very specific: line 18
New: only after nest new <name> --package-manager <pm> --strict in this session or layout.freshNestProject: true (untouched starters).
- Very specific: line 25
Verify with the project's commands: build/typecheck, lint, unit, e2e, arch, arch:selftest, formatter if any.
- Distinctive: line 32
Never weaken or delete a rule, add an ignore, or grow the baseline to pass checks.
≈ “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
NestJS modular monolith
Sets up structure and checks. Never designs business boundaries or moves existing code unasked.
Read structure.md for module code, rules.md before settings/reporting, existing-project.md for existing apps, options.md for requested opt-ins. For DDD code, follow installed nestjs-best-practices ddd-* rules.
Steps
node <skill-dir>/scripts/inspect.mjs <root> --no-cruise(read only). Stop/reportblockers. UsepackageManager.commands. Fornest.monorepo, ask which app and set its paths.- New only after
nest new <name> --package-manager <pm> --strictin this session orlayout.freshNestProject: true(untouched starters). Otherwise existing: follow existing-project.md; report migration preparation. - Install
dependency-cruiserwithaddDev. - Copy assets/dependency-cruiser.cjs to
<root>/.dependency-cruiser.cjs. Read it only through the---- Rules belowline; edit onlysettings, listing generated clients (Prisma) ingeneratedDirs. Keep the hiddensettingsexport. - Copy scripts/arch-selftest.mjs to
<root>/tools/arch-selftest.mjs. - Scripts:
arch=depcruise <sourceRoot> [test] --config .dependency-cruiser.cjs(existing: add--ignore-known .dependency-cruiser-known-violations.json);arch:selftest=node tools/arch-selftest.mjs .. Include both in existing check/CI scripts; create CI files only if asked. - New mode: delete
AppController,AppService, and their spec only whenlayout.starterFilesmarks themuntouched. Remove theirAppModulewiring; preserve CLI-added imports (e.g.ObserveModule). Addsrc/app.module.spec.tscompilingAppModuleand an e2e boot test (GET /→ 404). Match import suffixes. - User-named modules:
node <skill-dir>/scripts/add-module.mjs <root> <kebab-name>createsdomain/,application/,infrastructure/,api/,contracts/with.gitkeep,<name>.module.ts, andindex.ts; registers in the root module, preserving import style. Addapplication/commands/,application/queries/, and shared layers on first use. Never invent business modules; no example module. - Verify with the project's commands: build/typecheck, lint, unit, e2e,
arch,arch:selftest, formatter if any. All must pass.
Defaults: directly injected use cases with execute() (no CQRS bus); api/ calls application/ only; domain/ uses no packages; new projects use relative imports, existing aliases stay; base classes/shared files only when needed. Configure through settings or options.md.
Report
Report mode, changes, counts (arch violations/known ones, self-test cases, tests), and rules.md limits: passing arch is not a DDD review. Existing mode: outside files and suggested first module.
Never weaken or delete a rule, add an ignore, or grow the baseline to pass checks. If a rule seems wrong, explain it and let the user choose the setting.
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.

