Skip to content
Skills Library
Programming · Building & coding

nats

/nats

NATS cloud-native messaging system. Covers Core NATS, JetStream persistence, and request/reply patterns. Use for lightweight, high-performance microservices communication. USE WHEN: user mentions "nats", "jetstream", "cloud-native messaging", "request/reply", "subject wildcards", asks about "lightweight messaging", "microservices communication", "nats streaming" DO NOT USE FOR: complex routing - use `rabbitmq`; AWS-native - use `sqs`; Azure-native - use `azure-service-bus`; JMS compliance - use `activemq`; persistent queues only - use dedicated broker

Licence
MIT
Last repository change
21.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
2
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 21.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

NATS cloud-native messaging system. Covers Core NATS, JetStream persistence, and request/reply patterns. Use for lightweight, high-performance microservices communication. USE WHEN: user mentions "nats", "jetstream", "cloud-native messaging", "request/reply", "subject wildcards", asks about "lightweight messaging", "microservices communication", "nats streaming" DO NOT USE FOR: complex routing - use `rabbitmq`; AWS-native - use `sqs`; Azure-native - use `azure-service-bus`; JMS compliance - use `activemq`; persistent queues only - use dedicated broker

Triggers from the description

natsjetstreamcloud-native messagingrequest/replysubject wildcardslightweight messagingmicroservices communicationnats streaming
Original author description

NATS cloud-native messaging system. Covers Core NATS, JetStream persistence, and request/reply patterns. Use for lightweight, high-performance microservices communication. USE WHEN: user mentions "nats", "jetstream", "cloud-native messaging", "request/reply", "subject wildcards", asks about "lightweight messaging", "microservices communication", "nats streaming" DO NOT USE FOR: complex routing - use `rabbitmq`; AWS-native - use `sqs`; Azure-native - use `azure-service-bus`; JMS compliance - use `activemq`; persistent queues only - use dedicated broker

How it works

  1. Quick Start (Docker)
  2. Core Concepts
  3. Subject Patterns
  4. Core NATS (Node.js)
  5. Core NATS (Python)
  6. Core NATS (Go)
  7. When NOT to Use This Skill
  8. Anti-Patterns
  9. Quick Troubleshooting
  10. Production Checklist
Original SKILL.md headings · 166 lines, 565 words
SKILL.md preview
---
name: nats
description: |
  NATS cloud-native messaging system. Covers Core NATS, JetStream persistence,
  and request/reply patterns. Use for lightweight, high-performance
  microservices communication.

  USE WHEN: user mentions "nats", "jetstream", "cloud-native messaging", "request/reply", "subject wildcards", asks about "lightweight messaging", "microservices communication", "nats streaming"

  DO NOT USE FOR: complex routing - use `rabbitmq`; AWS-native - use `sqs`; Azure-native - use `azure-service-bus`; JMS compliance - use `activemq`; persistent queues only - use dedicated broker
allowed-tools: Read, Grep, Glob, Write, Edit
---
# NATS Core Knowledge

> **Full Reference**: See [advanced.md](advanced.md) for JetStream patterns (Node.js, Java), security configuration, TLS setup, and clustering.

> **Deep Knowledge**: Use `mcp__documentation__fetch_docs` with technology: `nats` for comprehensive documentation.

## Quick Start (Docker)

```yaml
# docker-compose.yml
services:
  nats:
    image: nats:latest
    ports:
      - "4222:4222"   # Client
      - "8222:8222"   # Monitoring
    command: "-js -m 8222"  # Enable JetStream
```

## Core Concepts

| Feature | Core NATS | JetStream |
|---------|-----------|-----------|
| Persistence | No | Yes |
| Delivery | At-most-once | At-least-once |
| Replay | No | Yes |
| Consumer Groups | Queue Groups | Consumer Groups |

## Subject Patterns

```
orders.created     → Specific subject
orders.*           → orders.created, orders.updated (single wildcard)
orders.>           → orders.created, orders.us.east (multi wildcard)
```

## Core NATS (Node.js)

```typescript
import { connect, StringCodec } from 'nats';

const nc = await connect({ servers: 'localhost:4222' });
const sc = StringCodec();

// Simple publish
nc.publish('orders.created', sc.encode(JSON.stringify(order)));

// Subscribe
const sub = nc.subscribe('orders.*');
for await (const msg of sub) {
  const order = JSON.parse(sc.decode(msg.data));
  console.log(`Received on ${msg.subject}:`, order);
}

// Queue group (load balancing)
const qsub = nc.subscribe('orders.process', { queue: 'workers' });

// Request/Reply
const response = await nc.request('orders.validate', sc.encode(JSON.stringify(order)), {
  timeout: 5000,
});
const result = JSON.parse(sc.decode(response.data));

await nc.drain();
```

## Core NATS (Python)

```python
import nats
import json
import asyncio

async def main():
    nc = await nats.connect("nats://localhost:4222")

    # Publish
    await nc.publish("orders.created", json.dumps(order).encode())

    # Subscribe
    async def message_handler(msg):
        order = json.loads(msg.data.decode())
        print(f"Received: {order}")

    await nc.subscribe("orders.*", cb=message_handler)

    # Request/Reply
    response = await nc.request("orders.validate",
                                json.dumps(order).encode(),
                                timeout=5)
    result = json.loads(response.data.decode())

    await nc.drain()

asyncio.run(main())
```

## Core NATS (Go)

```go
nc, _ := nats.Connect(nats.DefaultURL)
defer nc.Drain()

// Publish
body, _ := json.Marshal(order)
nc.Publish("orders.created", body)

// Subscribe
nc.Subscribe("orders.*", func(msg *nats.Msg) {
    var order Order
    json.Unmarshal(msg.Data, &order)
    processOrder(order)
})

// Queue group
nc.QueueSubscribe("orders.process", "workers", func(msg *nats.Msg) {
    // Load balanced
})

// Request/Reply
response, _ := nc.Request("orders.validate", body, 5*time.Second)
```

## When NOT to Use This Skill

- Long-term event replay required - Kafka provides better retention
- Complex routing patterns - RabbitMQ exchanges are more flexible
- JMS compliance needed - Use ActiveMQ
- AWS-native integration - SQS integrates better

## Anti-Patterns

| Anti-Pattern | Why It's Bad | Solution |
|--------------|--------------|----------|
| Core NATS for critical data | Fire-and-forget | Use JetStream for persistence |
| No subject hierarchy | Hard to filter | Use dot-separated subjects |
| No timeout on requests | Hanging requests | Always set timeout |
| Large payloads | Network strain | Keep messages small |
| Single server in production | No HA | Deploy 3+ server cluster |

## Quick Troubleshooting

| Issue | Likely Cause | Fix |
|-------|--------------|-----|
| Messages not received | Wrong subject | Verify subject name, check wildcards |
| Request timeout | No responders | Verify responders exist |
| JetStream errors | Not enabled | Start server with `-js` flag |
| Consumer lag growing | Slow processing | Add consumers or optimize |
| ACK timeout | Processing too slow | Increase ack_wait |

## Production Checklist

- [ ] TLS enabled
- [ ] Authentication configured
- [ ] Authorization (permissions)
- [ ] JetStream replicas >= 3
- [ ] Stream limits configured
- [ ] Consumer max_deliver set
- [ ] Ack timeout configured
- [ ] Monitoring dashboards
- [ ] Cluster health checks

## Reference Documentation

Available topics: `basics`, `jetstream`, `patterns`, `production`
Files in this package (2)
  • SKILL.md 5 KB
  • advanced.md 5 KB

Versions

RepositoryScoreLicence
This page · claude-dev-suite/claude-dev-suite100MIT
chrishuffman5/domain-expert100MIT

Database snapshot: 13.11.2026 · package version f673a64c3dfc (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100nats-messaging
    Build distributed messaging systems with NATS — pub/sub, request/reply, JetStream persistent messaging, and key-value store. Use when someone asks to "set up message queue", "pub/sub system", "event-driven architecture", "NATS messaging", "distributed messaging", "microservice…
  • 100activemq
    Apache ActiveMQ message broker with JMS support. Covers queues, topics, message selectors, and Spring integration. Use for enterprise Java messaging and JMS-compliant applications. USE WHEN: user mentions "activemq", "jms", "artemis", "message selectors", "virtual topics", asks…
  • 100azure-service-bus
    Azure Service Bus enterprise messaging service. Covers queues, topics, sessions, and transactions. Use for Azure-native enterprise messaging and hybrid cloud scenarios. USE WHEN: user mentions "azure service bus", "service bus queues", "service bus topics", "sessions", "azure…
  • 100nats-design-subject
    Design NATS subject hierarchies for messaging patterns (pub/sub, request/reply, streaming). Apply naming conventions, segmentation strategies, and wildcard patterns to create scalable subject architectures. Use when designing NATS messaging systems, choosing account-vs-subject…
  • 100nats-and-pulsar-lightweight-messaging-configuration
    Configures NATS core pub/sub and JetStream persistence, and Apache Pulsar topics/subscriptions, as lighter-weight alternatives to Kafka or RabbitMQ, and gives a decision framework for when each fits better. Use when the user asks to "set up NATS," "configure JetStream streams…
  • 100azure-servicebus-py
    Azure Service Bus SDK for Python messaging. Use for queues, topics, subscriptions, and enterprise messaging patterns.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.