Skip to main content
ClaudeWave
ES, Spanish
Skill7.1k estrellas del repoactualizado 6d ago

nestjs-modular-monolith

This NestJS code skill guides backend architects in designing scalable modular monolith systems using Domain-Driven Design, Clean Architecture, and CQRS patterns. Use when building structured backend applications with clear module boundaries, defining bounded contexts, implementing event-driven module communication, or when explicit architectural decisions matter more than rapid prototyping.

Instalar en Claude Code
Copiar
git clone --depth 1 https://github.com/tech-leads-club/agent-skills /tmp/nestjs-modular-monolith && cp -r /tmp/nestjs-modular-monolith/packages/skills-catalog/skills/(development)/nestjs-modular-monolith ~/.claude/skills/nestjs-modular-monolith
Después abre una sesión nueva de Claude Code; el skill carga automáticamente.

SKILL.md

# Modular Monolith Specialist

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.

## Role Definition

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.

## When to Use This Skill

- Designing a new modular monolith from scratch
- Defining bounded contexts and domain boundaries
- Creating NestJS modules with Clean Architecture layers
- Setting up event-driven communication between modules
- Optionally implementing CQRS when the domain justifies it
- Planning monolith-to-microservices evolution paths
- Configuring NX monorepo workspace for modular backends
- Reviewing module boundaries and state isolation

## When NOT to Use

- Simple CRUD APIs with < 10 endpoints (NestJS defaults suffice)
- Frontend or full-stack questions without backend architecture focus
- General NestJS questions without architectural context
- Microservices-first architectures (different patterns apply)
- Prototypes or MVPs where speed > structure

## Core Principles

**10 Modular Monolith Principles** — these override general NestJS defaults when they conflict:

1. **Boundaries**: Clear interfaces between modules, minimal coupling
2. **Composability**: Modules can be recombined dynamically
3. **Independence**: Each module is self-contained with its own domain
4. **Scalability**: Per-module optimization without system-wide changes
5. **Explicit Communication**: Contracts between modules, never implicit
6. **Replaceability**: Any module can be substituted without system impact
7. **Logical Deployment Separation**: Even in monolith, maintain separation
8. **State Isolation**: Strict data boundaries — no shared database tables
9. **Observability**: Module-level monitoring and tracing
10. **Resilience**: Failures in one module don't cascade

## Behavioral Guidelines

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".

## Core Workflow

### Phase 1: Discovery

Before writing any code, understand the domain.

1. **Identify the business domain** — What problem does the system solve?
2. **Map bounded contexts** — Which business capabilities are distinct?
3. **Define aggregates and entities** — What are the core domain objects?
4. **Clarify scaling requirements** — Which modules need independent scaling?
5. **Identify integrations** — External systems, APIs, event sources?

**Ask the user about stack preferences:**

- HTTP adapter: Fastify (recommended for performance) or Express?
- ORM: Prisma (type-safe, recommended) or TypeORM?
- API style: tRPC (type-safe) or REST with Swagger?
- Monorepo: NX (recommended) or Turborepo?
- Linting: Biome (fast, recommended) or ESLint+Prettier?
- Auth: Passport/JWT or Better Auth? (see `references/authentication.md`)
- Complexity: Simple services (default) or CQRS? (see `references/architecture-patterns.md`)

**Exit criteria:**

- [ ] Bounded contexts identified with clear responsibilities
- [ ] Stack preferences confirmed
- [ ] Scaling and integration requirements documented

### Phase 2: Design

Architect the system before implementation.

1. **Design module structure** — Map bounded contexts to NX libraries
2. **Define module interfaces** — Public API surface of each module
3. **Plan communication** — Events for cross-module, direct calls within module
4. **Design data model** — Per-module schemas with state isolation
5. **Plan authentication** — Choose and configure auth strategy

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:**

- [ ] Each module has defined responsibilities and public interface
- [ ] Communication contracts specified (events for cross-module)
- [ ] Data model shows strict module ownership
- [ ] No shared entities across module boundaries

### Phase 3: Implementation

Build modules following Clean Architecture layers. For each module, implement in this order:

**Default approach (simple services):**

1. **Domain layer** — Entities, value objects, domain events, repository interfaces
2. **Application layer** — Services with business logic, DTOs
3. **Infrastructure layer** — Repository implementations, external adapters
4. **Presentation layer** — Controllers, resolvers, route defini
accessibilitySkill

Audit and improve web accessibility following WCAG 2.1 guidelines. Use when asked to "improve accessibility", "a11y audit", "WCAG compliance", "screen reader support", "keyboard navigation", or "make accessible". Do NOT use for SEO (use seo), performance (use core-web-vitals), or comprehensive site audits covering multiple areas (use web-quality-audit).

ai-cold-outreachSkill

When the user wants to build an AI-powered outreach system, write cold emails, improve deliverability, or scale personalized outreach. Also use when the user mentions 'cold email,' 'cold outreach,' 'outreach automation,' 'Instantly,' 'Smartlead,' 'Clay,' 'email sequences,' 'deliverability,' 'personalization at scale,' 'reply rate,' or 'outreach stack.' This skill covers the complete AI cold outreach system from signal detection through conversion. Do NOT use for technical implementation, code review, or software architecture.

ai-pricingSkill

When the user wants to price an AI product, choose a charge metric, design pricing tiers, or optimize margins. Also use when the user mentions 'AI pricing,' 'usage-based pricing,' 'consumption pricing,' 'outcome pricing,' 'BYOK,' 'bring your own key,' 'per-seat pricing,' 'pricing tiers,' 'AI margins,' 'cost per token,' or 'pricing model.' This skill covers pricing strategy, packaging, and margin management for AI-native products. Do NOT use for technical implementation, code review, or software architecture.

ai-sdrSkill

When the user wants to deploy AI sales development reps, automate sales qualification, build signal-to-action routing, or design AI agent architecture for sales. Also use when the user mentions 'AI SDR,' 'AI sales agent,' 'automated qualification,' 'signal routing,' 'sales automation,' '11x,' 'Artisan,' 'AiSDR,' 'AI BDR,' or 'autonomous sales.' This skill covers AI SDR deployment, qualification automation, and agent architecture for sales development. Do NOT use for technical implementation, code review, or software architecture.

ai-seoSkill

When the user wants to build programmatic SEO with AI, create competitor alternative pages, optimize for AI Overviews, or scale content production. Also use when the user mentions 'SEO,' 'programmatic SEO,' 'AI content,' 'competitor alternative pages,' 'AI Overviews,' 'search optimization,' 'DataForSEO,' 'content at scale,' 'keyword strategy,' or 'organic traffic.' This skill covers AI-powered SEO strategy from keyword research through programmatic page generation. Do NOT use for technical implementation, code review, or software architecture.

ai-ugc-adsSkill

When the user wants to create UGC ad campaigns, recruit UGC creators, generate AI UGC content, or scale with user-generated content. Also use when the user mentions 'UGC,' 'user-generated content,' 'creator ads,' 'Spark Ads,' 'whitelisting,' 'AI UGC,' 'Arcads,' 'Creatify,' 'creator brief,' or 'UGC testing.' This skill covers the UGC growth framework from creator recruitment through AI-powered scaling. Do NOT use for technical implementation, code review, or software architecture.

aws-advisorSkill

Expert AWS Cloud Advisor for architecture design, security review, and implementation guidance. Leverages AWS MCP tools for accurate, documentation-backed answers. Use when user asks about AWS architecture, security, service selection, migrations, troubleshooting, or learning AWS. Triggers on AWS, Lambda, S3, EC2, ECS, EKS, DynamoDB, RDS, CloudFormation, CDK, Terraform, Serverless, SAM, IAM, VPC, API Gateway, or any AWS service. Do NOT use for non-AWS cloud providers or general infrastructure without AWS context.

best-practicesSkill

Apply modern web development best practices for security, compatibility, and code quality. Use when asked to "apply best practices", "security audit", "modernize code", "code quality review", or "check for vulnerabilities". Do NOT use for accessibility (use web-accessibility), SEO (use seo), performance (use core-web-vitals), or comprehensive multi-area audits (use web-quality-audit).