---
name: "nestjs-microservices-rabbitmq"
description: "Build decoupled distributed microservices using NestJS built-in transporters and RabbitMQ."
metadata:
  author: "NestJS"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "setup nestjs microservice rabbitmq"
  - "@messagepattern nestjs"
  - "clientproxy rabbitmq nestjs"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# NestJS Microservices Architecture & RabbitMQ Transporters

Implements NestJS microservices: ClientProxy, @MessagePattern for request-response, @EventPattern for fire-and-forget event publishing, configuring RabbitMQ queues, and handling connection failovers.

## When to Invoke
Invoke this skill whenever you need to:
- setup nestjs microservice rabbitmq
- @messagepattern nestjs
- clientproxy rabbitmq nestjs

## Execution SOP & Rules
1. Bootstrap microservice: app.connectMicroservice({ transport: Transport.RMQ, options: { urls: [...], queue: 'orders_queue' } }).
2. Handle messages in controllers: @MessagePattern({ cmd: 'calculate_tax' }) calculateTax(data: OrderData) { ... }.
3. Publish from API gateway: this.client.emit('user_registered', payload) using injected ClientProxy.
4. Ensure message payload serialization and acknowledgment settings prevent message drops on restarts.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
