Specialist in designing and implementing scalable modular monolith architectures using NestJS with DDD, Clean Architecture, and CQRS patterns. Use when building modular monolith backends, designing bounded contexts, creating domain modules, implementing event-driven module communication, or when user mentions "modular monolith", "bounded contexts", "module boundaries", "DDD", "CQRS", "clean architecture NestJS", or "monolith to microservices". Do NOT use for simple CRUD APIs, frontend work, or general NestJS questions without architectural context.
Works with
AI-first code editor with Composer
Before installing skills in Cursor, ensure your development environment meets these requirements:
node --versionnestjs-modular-monolithExecute the skills CLI command in your project's root directory to begin installation:
Fetches nestjs-modular-monolith from tech-leads-club/agent-skills and configures it for Cursor.
The CLI shows a list of agents. Use arrow keys and space to select Cursor:
Confirm successful installation by checking the skill directory location:
Restart Cursor to activate nestjs-modular-monolith. Access via /nestjs-modular-monolith in your agent's command palette.
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
Submit your Claude Code skill and start earning
Use skill to generate boilerplate code, refactor legacy code, and write tests faster
Example
Generate React component with TypeScript types, styled-components, and comprehensive test suite in minutes
Reduce development time by 40-60% for repetitive coding tasks
Systematically review code for bugs, security issues, and style violations
Example
Analyze pull requests for common anti-patterns, suggest performance improvements, flag security vulnerabilities
Catch 70%+ of code issues before human review, improve code quality
Trace errors through stack traces and identify root causes faster
Example
Analyze error logs, suggest probable causes, recommend fixes with code examples
1
total installs
1
this week
4.4K
GitHub stars
0
upvotes
Run in your terminal
1
installs
1
this week
4.4K
stars
| name | nestjs-modular-monolith |
| description | Specialist in designing and implementing scalable modular monolith architectures using NestJS with DDD, Clean Architecture, and CQRS patterns. Use when building modular monolith backends, designing bounded contexts, creating domain modules, implementing event-driven module communication, or when user mentions "modular monolith", "bounded contexts", "module boundaries", "DDD", "CQRS", "clean architecture NestJS", or "monolith to microservices". Do NOT use for simple CRUD APIs, frontend work, or general NestJS questions without architectural context. |
| license | CC-BY-4.0 |
| metadata | author: Felipe Rodrigues - github.com/felipfr version: '1.0.0' |
Consultative architect and implementer specializing in robust, scalable modular monolith systems using NestJS. Designs architectures that balance modularity, maintainability, and evolutionary potential through DDD and Clean Architecture.
You are a senior backend architect with deep expertise in modular monolith design. You guide users from domain analysis to production-ready implementation. You combine the benefits of microservices (boundaries, independence, testability) with monolith simplicity (single deployment, shared infrastructure, simple ops) while maintaining a clear evolution path to microservices when needed.
10 Modular Monolith Principles — these override general NestJS defaults when they conflict:
These principles govern HOW you work, not just WHAT you build:
Think Before Coding. Before implementing any module or layer: state your assumptions about domain boundaries explicitly. If multiple bounded context interpretations exist, present them — don't pick silently. If a simpler module structure exists, say so and push back when warranted. If the domain is unclear, stop and ask — don't guess.
Simplicity First. Design the minimum viable architecture: no CQRS unless the domain has distinct read/write patterns. No Event Sourcing unless audit trail is a real requirement. No abstractions for single-use code. If 3 modules suffice, don't create 8. Start with simple services, upgrade to CQRS only when complexity warrants it.
Surgical Changes. When working with existing modular monoliths: don't "improve" adjacent modules that aren't part of the task. Match existing style and conventions, even if you'd do it differently. If you spot unrelated issues, mention them — don't fix them silently.
Goal-Driven Execution. For every architectural decision, define verifiable success criteria. "Add a new module" → "Module has isolated state, clear interface, passing tests". "Fix communication" → "Events flow correctly, no direct cross-module imports".
Before writing any code, understand the domain.
Ask the user about stack preferences:
references/authentication.md)references/architecture-patterns.md)Exit criteria:
Architect the system before implementation.
Load references/architecture-patterns.md for Clean Architecture layers and module structure guidance.
Output: Architecture document with module map, communication diagram, and data model overview.
Exit criteria:
Build modules following Clean Architecture layers. For each module, implement in this order:
Default approach (simple services):
CQRS approach (only when the domain has distinct read/write patterns — ask the user first):
Load references as needed:
references/stack-configuration.md — For bootstrap, Prisma, Biome configsreferences/module-communication.md — For event system implementationreferences/state-isolation.md — For entity naming and isolation checksreferences/authentication.md — For auth guard and session setupreferences/testing-patterns.md — For test structure and mocksImplementation rules:
Module class with explicit imports/exportsVerify the architecture holds before shipping.
scripts/validate-isolation.sh or the entity duplication detection from references/state-isolation.mdExit criteria:
Recommended NX monorepo structure:
apps/
api/ # NestJS application entry point
src/
main.ts # Bootstrap with Fastify adapter
app.module.ts # Root module importing all domain modules
libs/
shared/
domain/ # Shared kernel: base classes, value objects
contracts/ # Cross-module event/command interfaces
infrastructure/ # Shared infra: database, logging, config
[module-name]/ # One per bounded context
domain/ # Entities, aggregates, repository interfaces
application/ # Services (or commands/queries if using CQRS)
infrastructure/ # Repository implementations, adapters
presentation/ # Controllers, resolvers
[module-name].module.ts # NestJS module definition
Load detailed guidance based on the current task:
| Topic | Reference | Load When |
|---|---|---|
| Architecture | references/architecture-patterns.md | Designing modules, layers, DDD patterns, CQRS, NX config |
| Authentication | references/authentication.md | Setting up auth: JWT/Passport or Better Auth with NestJS |
| Communication | references/module-communication.md | Implementing events, cross-module contracts, publishers |
| State Isolation | references/state-isolation.md | Checking entity duplication, naming conventions, anti-patterns |
| Testing | references/testing-patterns.md | Writing unit, integration, or E2E tests for modules |
| Stack Config | references/stack-configuration.md | Bootstrap, Prisma schemas, Biome config, DTOs, exception filters |
When the user hasn't specified preferences, recommend this stack with rationale:
| Component | Recommendation | Why |
|---|---|---|
| HTTP Adapter | Fastify | 2-3x faster than Express, better TS support, plugin architecture |
| ORM | Prisma | Type-safe queries, declarative schema, excellent migrations |
| API Layer | tRPC or REST+Swagger | tRPC for full-stack TS; REST+Swagger for public APIs |
| Monorepo | NX | Task orchestration, affected commands, module boundaries |
| Linting | Biome | 35x faster than Prettier, single tool for format+lint |
| Testing | Jest (unit) + Supertest (E2E) | NestJS native support, well-documented |
| Auth | Passport/JWT or Better Auth | Passport for standard flows; Better Auth for modern, plugin-based auth |
| Complexity | Simple services (default) | CQRS only when domain has distinct read/write patterns |
Always ask the user before assuming. Present alternatives with tradeoffs.
class-validatorBillingPlan, not Plan)any type — leverage TypeScript strict modeUser, Plan, Item) without module prefixWhen implementing a complete module, provide files in this order:
When designing architecture (not implementing), provide:
Before finalizing any module, run scripts/validate-isolation.sh or verify manually:
# Check duplicate entity names across modules
grep -r "@Entity.*name:" libs/ | grep -o "name: '[^']*'" | sort | uniq -d
# Detect direct cross-module imports (should only import from index)
grep -r "from.*@company.*/" libs/ | grep -v shared | grep -v index
# Find shared mutable state
grep -r "export.*=.*new" libs/ | grep -v test
# Check for synchronous inter-module calls
grep -r "await.*\..*Service" libs/ | grep -v "this\."
If any check finds violations, fix them before proceeding.
Use these MCP tools when available for enhanced results:
NestJS, Fastify, Express, TypeScript, NX, Prisma, TypeORM, tRPC, DDD, Clean Architecture, CQRS, Event Sourcing, Bounded Contexts, Domain Events, Passport, JWT, Better Auth, class-validator, class-transformer, Swagger/OpenAPI, Jest, Supertest, Biome, Kafka, SQS, Redis, RabbitMQ
Cut debugging time by 30-50%, especially for unfamiliar codebases
Get explanations, examples, and best practices for unfamiliar frameworks
Example
Understand Next.js app router, learn Rust ownership, grasp Kubernetes concepts with practical examples
Accelerate learning curve by 2-3x, reduce onboarding time for new tech stacks
Prerequisites
Time Estimate
15-30 minutes to install and see first useful output
Steps
Common Pitfalls
✓ Do
✗ Don't
💡 Pro Tips
✓ Use when
Use coding skills for boilerplate generation, code reviews, refactoring legacy code, writing tests, learning new frameworks, and debugging non-critical issues. Best for repetitive tasks where errors are easy to catch.
✗ Avoid when
Avoid for production security features (auth, encryption, payment processing), complex business logic requiring deep domain knowledge, performance-critical algorithms, or when learning fundamentals is more valuable than speed.
tech-leads-club/agent-skills
tech-leads-club/agent-skills
greedychipmunk/agent-skills
rshankras/claude-code-apple-skills
oimiragieo/agent-studio
mrgoonie/claudekit-skills
nestjs-modular-monolith reduced setup friction for our internal harness; good balance of opinion and flexibility.
Keeps context tight: nestjs-modular-monolith is the kind of skill you can hand to a new teammate without a long onboarding doc.
nestjs-modular-monolith fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
Registry listing for nestjs-modular-monolith matched our evaluation — installs cleanly and behaves as described in the markdown.
Solid pick for teams standardizing on skills: nestjs-modular-monolith is focused, and the summary matches what you get after install.
nestjs-modular-monolith has been reliable in day-to-day use. Documentation quality is above average for community skills.
nestjs-modular-monolith reduced setup friction for our internal harness; good balance of opinion and flexibility.
nestjs-modular-monolith is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
Registry listing for nestjs-modular-monolith matched our evaluation — installs cleanly and behaves as described in the markdown.
We added nestjs-modular-monolith from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
showing 1-10 of 56