nestjs-hexagonal: Instructions file for Claude Code

CLAUDE.md

nestjs-hexagonal CLAUDE.md is an instructions file for Claude Code from Softtor/nestjs-hexagonal. It costs 3,180 tokens per session, scanned A, original, MIT.

A project guide for building NestJS applications with Hexagonal Architecture, Domain-Driven Design, and CQRS. NestJS is a TypeScript framework; these design approaches separate business rules, infrastructure, and different kinds of commands and queries.

In plain words
What is it for?
It is for routing NestJS tasks to the right skill or agent and enforcing rules for entities, repositories, events, modules, validation, and write operations.
Why use it?
It gives agents consistent architecture rules, such as keeping business code independent from NestJS and limiting what modules expose.

Instructions file for Claude Code

Written for Claude Code: $CLAUDE_PLUGIN_DATA variable. Also seen: mentions .claude-plugin; mentions CLAUDE.md; mentions subagents.

This is Softtor/nestjs-hexagonal's own configuration. It tells Claude Code how to work on nestjs-hexagonal itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything nestjs-hexagonal configures →

Reuse

Borrowing it

Nothing to install: this file belongs to Softtor/nestjs-hexagonal. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/Softtor/nestjs-hexagonal/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/Softtor/nestjs-hexagonal

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for nestjs-hexagonal CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/softtor/nestjs-hexagonal/claude-md/github.svg)](https://agentmods.dev/instructions/softtor/nestjs-hexagonal/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/softtor/nestjs-hexagonal/claude-md"><img src="https://agentmods.dev/badge/instructions/softtor/nestjs-hexagonal/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for nestjs-hexagonal CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/softtor/nestjs-hexagonal/claude-md"><img src="https://agentmods.dev/badge/instructions/softtor/nestjs-hexagonal/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 3,180 This file is loaded in full into every session.
When invoked 3,180 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.03180 $0.03180
Opus 5.5 $0.01272 $0.01272
Sonnet 5.5 $0.00636 $0.00636
Haiku 4.5 $0.00318 $0.00318

Measured 9d ago against content hash 646b839ee577, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

nestjs-hexagonal CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 139 lines

How it starts

The opening of the file, as written. The whole thing — 139 lines — stays where its author put it; the contents beside it link to each section on GitHub.

NestJS Hexagonal Plugin — Instructions

Plugin for building NestJS bounded contexts with Hexagonal Architecture + DDD + CQRS. Compatible with GSD workflow.

Entry Point

nestjs-hexagonal:using-nestjs-hexagonal — meta-skill that routes any NestJS task to the correct skill or agent. Check this FIRST when working in a hexagonal NestJS project.

Architecture Rules (enforced by all skills and agents)

  1. Entity is pure TypeScript — uses this.apply(event) for domain events
  2. Repository is PURE persistence — save, find, search, delete. NO event dispatch
  3. EventDispatcher lives in the Handler, NEVER in UseCase — UseCase returns entity, Handler calls await events.from(entity).publish() after the actual transaction commit
  4. No NestJS imports in domain — no exceptions
  5. Module exports ONLY Port tokens — never use cases or repositories
  6. class-validator ONLY in presentation request DTOs — never in domain or application
  7. Write operations return void or { id: string } — CQRS strict
  8. No over-engineering — no use case for simple findById, no abstraction for single use, no generic relay patterns

Rulebook (machine-readable rules)

rulebooks/hexagonal.rulebook.yaml encodes the rules above; scripts/check.ts (entry scripts/run.sh, bin nestjs-hexagonal-check) runs the static ones offline and, with --classes semantic and TYPESAFE_API_KEY, asks Jev the semantic ones (scripts/lib/{jev-client,state-builder,decide,semantic-engine}.ts). Runtime rules are still inert. Projects opt in with .claude/rulebook.yaml (extends with sha256 stamps, own rules, overrides by id); NESTJS_HEXAGONAL_DISABLE=1 turns everything off. The same rulebook drives the hooks in hooks/hooks.json (scripts/hooks/*.ts, shared code in scripts/hooks/lib/, state in scripts/lib/session-store.ts, log in scripts/lib/hook-log.ts).

Hook Matcher Gate Effect (v1)
SubagentStart ^nestjs-hexagonal:.* opt-in project, plugin agent rulebook slice of the agent's layer as additionalContext (<= 1,500 tokens); records HEAD sha and start time
PreToolUse Write|Edit plugin agent, path in project and in a static scope only findings the current file does not already have: new static FAIL -> permissionDecision: deny (3 findings max); new WARN -> additionalContext, no permission decision; no network, no external checks
PostToolUse Write|Edit any agent (path recorded per agent_id) static for all; semantic only for plugin agent with key; additionalContext only with findings, 8 KB cap per agent and session
SubagentStop the six pipeline agents plugin agent files = store paths + (git diff/untracked since start minus the baseline recorded at start); static FAIL -> decision: block at once, no Jev; clean stop -> semantic advisory under a 17 s deadline stored for the Agent hook; after 2 blocks -> release with systemMessage
PostToolUse Agent completed plugin subagent unresolved FAILs and the last semantic advisory of that agentId from the store as additionalContext

Read the full file on GitHub · 139 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago Changed · +4 lines · +66 tokens per session 646b839ee577
  2. 25d ago Changed · +8 tokens per session aa8aa6e6a7d0
  3. 27d ago Changed · +59 lines · +2,105 tokens per session 25239676a9ff
  4. 1mo ago First seen · 76 lines · 1,001 tokens per session scan A f1d277122823

Subscribe to this mod's changes

nestjs-hexagonal CLAUDE.md is an instructions file published in the GitHub repository Softtor/nestjs-hexagonal (5 stars, last pushed 10d ago), licensed MIT. It adds 3,180 tokens to every session, about $0.0127 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other instructions, from other repositories

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 9,649 tokens

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,257 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, cache eligibility and rollout and applying the notice (cutover).

microsoft/vscode · 5,262 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,680 tokens

vscode copilot-instructions.md

Copilot instructions for microsoft/vscode, covering vs code copilot instructions, project overview, root folders, core architecture (src/ folder) and built-in extensions (extensions/ folder).

microsoft/vscode · 2,731 tokens

deepseek-harness AGENTS.md

AGENTS.md instructions for deepseek-ai/deepseek-harness, covering agents.md, pre-stable apis and released session data, repository layout, commands and host sandbox failures.

deepseek-ai/deepseek-harness · 4,159 tokens