NestJS Hexagonal Architecture Plugin
Claude Code plugin for building NestJS bounded contexts with Hexagonal Architecture, DDD, and CQRS patterns.
Overview
This plugin provides layer-specific skills, specialized agents, and workflow orchestrators for creating well-structured NestJS bounded contexts. It codifies Ports & Adapters architecture combined with Domain-Driven Design and the @nestjs/cqrs module.
Who it's for: Teams building NestJS applications that follow clean architecture and want consistent, reviewable code.
Key patterns:
- Pure TypeScript entities and events, fluent typed dispatcher, and configurable EventBus or broker publishers
- Value Objects (scalar, composed, enum, state machine)
- Repository interfaces as ports with Prisma and in-memory implementations
- Three application patterns (plain UseCase, CQRS Command/Query, Handler-as-Orchestrator)
- WebSocket broadcasting via
WsGatewayPort abstraction
- NestJS module wiring that exports only port tokens
Compatible with GSD workflow (usable as phase execution within milestones).
Installation
From GitHub
# 1. Add the marketplace (one time)
/plugin marketplace add softtor/nestjs-hexagonal
# 2. Install the plugin
/plugin install nestjs-hexagonal
The plugin prompts for two optional values when enabled: TYPESAFE_API_KEY (semantic rules; leave empty to stay offline) and package_runner (bun run, pnpm, npm run or yarn; leave empty to detect it from each project's lockfile). To pin the CLI in a project, bun add -d github:Softtor/nestjs-hexagonal#v1.4.0 (see Onboarding another project).
Local development
cd /path/to/nestjs-hexagonal && bun install # --plugin-dir does not get the automatic dependency install
claude --plugin-dir /path/to/nestjs-hexagonal
Claude Code installs the Node dependencies of a plugin it copies into its cache (marketplace install), but a plugin loaded in place with --plugin-dir or from a local-directory marketplace keeps its source directory as CLAUDE_PLUGIN_ROOT and gets no install. Without node_modules the hooks fail open (one actionable line on stderr, exit 0) and the CLI exits 1. To test the hooks the way a user gets them, bump version, run /plugin update and /reload-plugins so the copy in the cache is the one that runs.
Skills
Layer Skills
| Skill | Trigger examples | What it does |
|---|
nestjs-hexagonal:domain | "create entity", "new value object" | Entity (pure TypeScript), VOs, events, repo interfaces, data builders |
nestjs-hexagonal:application | "create use case", "cqrs handler" | Use cases, handlers, DTOs, ports, read models |
nestjs-hexagonal:infrastructure | "prisma repo", "module wiring" | Prisma repos, mappers, adapters, NestJS modules |
nestjs-hexagonal:presentation | "create controller", "request dto" | Controllers, request DTOs, Swagger, error filters |
nestjs-hexagonal:websocket-broadcasting | "broadcast event", "ws gateway" | Domain event -> WebSocket broadcast to frontend |
Workflow Skills
| Skill | What it does |
|---|
nestjs-hexagonal:create-subdomain | Orchestrates full BC creation by dispatching agents per layer; verification and review run the checker |
nestjs-hexagonal:review-subdomain | Three steps: static rulebook (CLI), semantic rulebook (Jev, one batch per file), residual review by the Opus agent; every finding cites its rule id or residual |
nestjs-hexagonal:onboard-project | Checklist to onboard a project: stamped .claude/rulebook.yaml, key, pinned CLI, baseline, hooks |
nestjs-hexagonal:jev-eval | Calibrate or evaluate a semantic rule: golden cases, run.ts/fit.ts, report, advise/ask/deny decision, weekly pilot report |
nestjs-hexagonal:using-nestjs-hexagonal | Routing meta-skill; also documents the package runner, the rulebook and CLI, the hooks and how other harnesses run the CLI |
Agents
The six pipeline agents are rulebook-driven: the rules arrive as a slice injected by the SubagentStart hook, the layer skill supplies the code patterns, the SubagentStop hook blocks a stop that leaves a static FAIL behind, and each agent runs nestjs-hexagonal-check on the files it created before reporting. architecture-reviewer runs the checker first and judges only what the rulebook cannot decide. explore-agent is the cheap read-only scanner (issue #2) built on prescan.