/nest:nest-ddd-conventionsfrom nest
NestJS conventions for Domain-Driven Design: domain layer purity, forbidden/allowed imports, port/adapter patterns with Symbol tokens, and bounded context modules.
Ships in nest. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
The cross-language OOP DDD principles (domain purity, ports & adapters, dependency direction, bounded contexts, aggregates) are defined in
craft:ddd-principles. This skill keeps NestJS-specific patterns.
@Injectable(), @Controller(), @Module(), @Inject()Request, Response, @Body(), @Param(), @Query()pgTable), Drizzle query builders, PrismaClientConfigService, HttpService, NestJS Loggerstring, number, Date, Record, etc.)domain/, implemented in infrastructure/)packages/shared (Zod schemas + inferred types)as const objects, branded typessrc/
├── domain/ # PURE — no framework imports
│ ├── model/ # Entities, value objects, aggregates
│ ├── port/ # Interfaces (repository contracts)
│ ├── service/ # Domain services (pure logic)
│ └── error/ # Domain exceptions
│
├── application/ # Use cases — orchestration
│ └── use-case/ # May use @Injectable() for DI
│
└── infrastructure/ # Framework & external — implements ports
├── persistence/ # Drizzle repositories (implements port/)
├── http/ # Controllers, guards, pipes
└── config/ # NestJS module, providers
Each bounded context maps to a NestJS module:
// ✅ One module per bounded context
@Module({
controllers: [ReceiptController],
providers: [
GenerateReceiptUseCase,
{ provide: RECEIPT_REPOSITORY, useClass: DrizzleReceiptRepository },
],
})
export class ReceiptModule {}
// ✅ domain/port/receipt-repository.ts — pure interface
export interface ReceiptRepository {
findByTenantId(tenantId: TenantId): Promise<Receipt[]>;
save(receipt: Receipt): Promise<void>;
}
export const RECEIPT_REPOSITORY = Symbol('ReceiptRepository');
// ✅ infrastructure/persistence/drizzle-receipt-repository.ts
import { Injectable, Inject } from '@nestjs/common';
import { ReceiptRepository } from '../../domain/port/receipt-repository';
@Injectable()
export class DrizzleReceiptRepository implements ReceiptRepository {
constructor(@Inject('DRIZZLE') private readonly db: DrizzleDatabase) {}
async findByTenantId(tenantId: TenantId): Promise<Receipt[]> {
// Drizzle query — infrastructure concern
}
async save(receipt: Receipt): Promise<void> {
// Drizzle insert
}
}
| Layer | Can import from | Cannot import from |
|---|---|---|
| Domain | Pure TS, shared DTOs | NestJS, Drizzle, HTTP, any framework |
| Application | Domain, NestJS DI | Infrastructure directly |
| Infrastructure | Domain, NestJS, Drizzle | — |
| NestJS pattern | Convention |
|---|---|
| Bounded context | 1 NestJS module per context |
| Port DI token | Symbol('PortName') exported alongside interface |
| Adapter | @Injectable() class implementing the port |
| Use case | @Injectable() orchestrator in application/use-case/ |
What SKILL.md sets; muted values are Claude Code's defaults
2 skills in this plugin
Other plugins' skills for the same job
npx claudepluginhub fabiensalles/claude-marketplace --plugin nest