agentsclimarketplace

Using nestjs hexagonal

Skill Softtor/nestjs-hexagonal/skills/using-nestjs-hexagonal

Meta-skill that routes NestJS development tasks to the correct nestjs-hexagonal skill or agent. Activates when working on NestJS projects with hexagonal architecture, DDD, CQRS, bounded contexts, entities, value objects, repositories, event listeners, WebSocket broadcasting, or any architectural task in a NestJS codebase. This skill should be checked FIRST before any implementation in a NestJS hexagonal project.From its SKILL.md

Install
npx -y skills add Softtor/nestjs-hexagonal --skill using-nestjs-hexagonal

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 5 stars5 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

7.8 KB, as published. Nobody here has run it

Using NestJS Hexagonal

This is a routing skill. When working in a NestJS project that follows hexagonal architecture, check this skill FIRST to find the right tool for the job.


Detection — When Does This Plugin Apply?

This plugin applies when ANY of these are true:

  • Project has @nestjs/core and @nestjs/cqrs in dependencies
  • Project structure has domain/, application/, infrastructure/ layers
  • Files contain AggregateRoot, @EventsHandler, @CommandHandler, @QueryHandler
  • User mentions: entity, value object, bounded context, CQRS, hexagonal, DDD, aggregate
  • CLAUDE.md references nestjs-hexagonal skills

If detected, route ALL architectural tasks through this plugin's skills and agents.


Routing Table — What Are You Doing?

Creating or Modifying Code

TaskRoute toType
Create new bounded context / modulenestjs-hexagonal:create-subdomainSkill (orchestrator)
Create entity (AggregateRoot)nestjs-hexagonal:domain-agentAgent (Opus 5)
Create value objectnestjs-hexagonal:domainSkill
Create domain eventnestjs-hexagonal:domainSkill
Create repository interfacenestjs-hexagonal:domainSkill
Create data builder (testing)nestjs-hexagonal:domainSkill
Create use casenestjs-hexagonal:applicationSkill
Create CQRS command/query handlernestjs-hexagonal:applicationSkill
Create DTOnestjs-hexagonal:applicationSkill
Create port (cross-module interface)nestjs-hexagonal:applicationSkill
Create Prisma repositorynestjs-hexagonal:infrastructureSkill
Wire NestJS modulenestjs-hexagonal:infrastructureSkill
Create adapter (port implementation)nestjs-hexagonal:infrastructureSkill
Create controllernestjs-hexagonal:presentationSkill
Create request DTO (class-validator)nestjs-hexagonal:presentationSkill
Create event listener (same-BC)nestjs-hexagonal:event-listenersSkill
Create event listener (cross-BC)nestjs-hexagonal:event-listenersSkill
Create WebSocket broadcastnestjs-hexagonal:websocket-broadcastingSkill
Create WS gatewaynestjs-hexagonal:websocket-broadcastingSkill
Create frontend event consumernestjs-hexagonal:broadcasting-agentAgent (Sonnet 5)

Reviewing or Debugging

TaskRoute toType
Review bounded contextnestjs-hexagonal:architecture-reviewerAgent (Opus 5)
Check for over-engineeringnestjs-hexagonal:architecture-reviewerAgent (Opus 5)
Debug event not reaching frontendnestjs-hexagonal:event-debug-agentAgent (Opus 5)
Debug event not being consumednestjs-hexagonal:event-debug-agentAgent (Opus 5)

Setting Up

TaskRoute toType
Configure GSD to use this pluginnestjs-hexagonal:gsd-installerSkill
Review all available patternsRead CLAUDE.md at plugin rootReference

Agent Selection by Model

Decision TypeAgentModelWhy
Domain modeling (what entities, VOs, events)domain-agentOpus 5Critical architectural decisions
Architecture reviewarchitecture-reviewerOpus 5Deep judgment for smells + over-engineering
Event chain debuggingevent-debug-agentOpus 56-layer systematic tracing
Application layer (use cases, handlers)application-agentSonnet 5Follows established patterns
Infrastructure (repos, modules)infrastructure-agentSonnet 5Mechanical pattern application
Presentation (controllers, DTOs)presentation-agentSonnet 5Mechanical pattern application
WebSocket + frontendbroadcasting-agentSonnet 5Follows WS skill patterns
Event listenerslistener-agentSonnet 5Follows listener skill patterns

Rule: Use Opus 5 for DECISIONS (what to build), Sonnet 5 for EXECUTION (how to build it).


Architecture Rules (always enforce)

These rules apply to ALL tasks routed through this plugin:

  1. Entity extends AggregateRoot — uses this.apply(event) to queue events
  2. Repository is PURE persistence — no event dispatch, no domain logic
  3. EventPublisher in Handler ONLY — UseCase returns entity, Handler commits events
  4. Module exports ONLY Port tokens — never use cases, never repositories
  5. class-validator ONLY in presentation — never in domain or application
  6. Write returns void or ID — CQRS strict, no full objects on command side
  7. No over-engineering — no use case for trivial findById, no abstractions for single use
  8. Listeners in CONSUMING BC — cross-BC listeners live where they're consumed, not emitted
  9. try/catch in all listeners — listener failure never breaks the event chain

Workflow Order (when building a full BC)

1. Domain (Opus 5)   → entities, VOs, events, repo interface, data builders
2. Application       → use cases / handlers, DTOs, ports
3. Infrastructure    → Prisma repo, module wiring, adapters, listeners
4. Presentation      → controllers, request DTOs, Swagger
5. Broadcasting      → WS gateway + frontend hooks (if real-time needed)
6. Verification      → lint, types, tests, build
7. Review (Opus 5)   → architecture compliance + over-engineering audit

Use nestjs-hexagonal:create-subdomain to orchestrate this automatically.


Pattern Quick Reference

Application Layer — Which Pattern?

ScenarioPattern
Simple CRUD, no events neededA — Plain UseCase + TOKEN
Module uses CQRS, events on writeB — Command/Query handlers
Complex orchestration, multiple portsC — Handler as Orchestrator
Trivial findById, no RBACNo pattern — repo directly in controller

Event Listeners — Which Type?

ScenarioType
Update Redis projection after eventSame-BC listener
Another BC reacts to this eventCross-BC listener
Frontend needs real-time updateBridge listener (WS)
External service needs notificationBridge listener (broker/email/webhook)
3+ consumers sharing pre-processingStrategy + Gateway pattern
Simple side effect, single consumerPut it in the command handler directly

Red Flags — Stop and Route

If you catch yourself doing any of these, STOP and invoke the correct skill:

What you're about to doProblemRoute to
Adding @Injectable to a domain classFramework leak into domainnestjs-hexagonal:domain
Putting EventPublisher in a UseCaseUseCase must be framework-agnosticnestjs-hexagonal:application
Exporting a repository from a moduleOnly Port tokens should be exportednestjs-hexagonal:infrastructure
Adding class-validator to a VOValidation layers are separatenestjs-hexagonal:domain
Making repository dispatch eventsRepository is pure persistencenestjs-hexagonal:infrastructure
Creating use case for simple findByIdOver-engineeringCheck architecture-reviewer criteria
Importing a service from another BCUse ports insteadnestjs-hexagonal:application (ports)
Creating generic event relayOver-engineeringnestjs-hexagonal:event-listeners

Keep looking

Skills are one crate of 627,801. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.