Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/softtor/nestjs-hexagonal/event-listenersnpx skills add Softtor/nestjs-hexagonal --skill event-listenersgit clone --depth 1 https://github.com/Softtor/nestjs-hexagonalWrote 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.
[](https://agentmods.dev/skills/softtor/nestjs-hexagonal/event-listeners)<a href="https://agentmods.dev/skills/softtor/nestjs-hexagonal/event-listeners"><img src="https://agentmods.dev/badge/skills/softtor/nestjs-hexagonal/event-listeners.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00075 | $0.03297 |
| Opus 5 | $0.00037 | $0.01648 |
| Sonnet 5 | $0.00015 | $0.00659 |
| Haiku 4.5 | $0.00007 | $0.00330 |
Grade A, and why
event-listeners 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 4d 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.
How it starts
The opening of the file, as written. The whole thing — 445 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Event Listeners
Domain events emitted via entity.commit() flow through the NestJS CQRS EventBus. Listeners are @EventsHandler classes that react to these events. Multiple handlers for the same event run in parallel via Promise.allSettled — if one fails, others continue.
This skill covers WHERE listeners live, WHAT they do, and WHEN you actually need one.
Decision Tree
Do you need to react to a domain event?
│
├─ Is it a side effect within the SAME bounded context?
│ └─ YES → Same-BC Listener (see Section 1)
│ Examples: update Redis projection, write audit log, invalidate cache
│
├─ Does ANOTHER bounded context need to react?
│ └─ YES → Cross-BC Listener (see Section 2)
│ Examples: Billing creates invoice when Order is created
│
├─ Does the event need to leave the process?
│ └─ YES → Bridge Listener (see Section 3)
│ Examples: WebSocket broadcast, RabbitMQ publish, send email, call webhook
│
└─ Is the side effect simple and only 1 consumer exists?
└─ YES → Consider putting it in the command handler directly (no listener needed)
When NOT to Create a Listener (anti-over-engineering)
| Situation | Do this instead |
|---|---|
| Only 1 side effect, simple and synchronous | Put it in the command handler after entity.commit() |
| Side effect is part of the core business transaction | Keep it in the use case / handler — not a separate listener |
| < 2 consumers for the event | Question whether you need the event at all |
| Event payload identical to what listener would emit | Emit directly from handler, skip intermediate event |
Principle: Events are for decoupling. If there's nothing to decouple, don't add the indirection.
Section 1: Same-BC Listener
Lives in <bc>/infrastructure/listeners/. Reacts to events from its OWN bounded context.
// infrastructure/listeners/order-created-projection.handler.ts
import { EventsHandler, IEventHandler } from '@nestjs/cqrs';
import { Inject, Logger } from '@nestjs/common';
import { OrderCreatedEvent } from '../../domain/events/order-created.event';
import { REDIS_READ_MODEL_TOKEN } from '../../application/ports/read-model.port';
import type { ReadModelPort } from '../../application/ports/read-model.port';
@EventsHandler(OrderCreatedEvent)
export class OrderCreatedProjectionHandler implements IEventHandler<OrderCreatedEvent> {
private readonly logger = new Logger(OrderCreatedProjectionHandler.name);
constructor(
@Inject(REDIS_READ_MODEL_TOKEN)
private readonly readModel: ReadModelPort,
) {}
async handle(event: OrderCreatedEvent): Promise<void> {
try {
await this.readModel.upsert(`order:${event.aggregateId}`, {
id: event.aggregateId,
total: event.total,
status: event.status,
organizationId: event.organizationId,
updatedAt: event.occurredOn.toISOString(),
});
} catch (error) {
// Log but never re-throw — don't break the event chain
this.logger.error(`[OrderCreatedProjection] Failed:`, error);
}
}
}
What ships with it
3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
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.
- 4d ago First seen · 445 lines · 75 tokens per session scan A 2bcd8ae4e332
event-listeners is a skill published in the GitHub repository Softtor/nestjs-hexagonal (5 stars, last pushed 24d ago), licensed MIT. It adds 75 tokens to every session and 3,297 once invoked, about $0.0004 per session on Opus 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.
Other skills, from other repositories
new-skill
Scaffold a new brooks-lint analysis skill so it passes npm run validate and npm run evals on the first try — generates skills/{name}/SKILL.md (with the mandatory "Do NOT trigger for:" clause and a Process section citing guide step ranges) plus skills/{name}/{name}-guide.md (sequentially numbered steps), then appends…
release
Cut a brooks-lint release: set the version in package.json, propagate it across all four plugin manifests and every version-bearing text file (README badges, docs site metadata), write the CHANGELOG entry, validate, then commit, push, tag, and publish the GitHub release. Triggers when the maintainer asks to "release"…
brooks-audit
Architecture audit that maps module dependencies, checks layering integrity, and flags structural decay across a codebase, drawing on twelve classic engineering books. Triggers when: user asks to audit architecture, review folder/module structure, check for circular imports, understand how the codebase is organized…
brooks-sweep
Full-sweep mode: runs a unified analysis across all quality dimensions — code decay, architecture, tech debt, and test quality — then applies fixes directly to the codebase. Safe changes are auto-applied; risky changes are confirmed before execution. Drawing on twelve classic engineering books. Triggers when: user…
brooks-debt
Tech debt assessment that identifies, classifies, and prioritizes maintainability problems — helping teams build a refactoring roadmap — drawing on twelve classic engineering books. Triggers when: user asks about tech debt, refactoring priorities, what to clean up first, or asks "why is this so hard to change?", "what…
brooks-review
PR code review that surfaces decay risks, design smells, and maintainability issues with concrete Symptom → Source → Consequence → Remedy findings, drawing on twelve classic engineering books. Triggers when: user asks to review code, check a PR, shares a diff or pastes code asking "does this look right?" / "any issues…