nats — Claude Code skill: features and installation
This Claude Code skill explains Core NATS, JetStream, and request/reply messaging. It activates for questions about NATS subjects and microservice communication.
MIT 101 installs ★ 50 updated 2026-10-23
npx skills add claude-dev-suite/claude-dev-suite --skill nats -a claude-codeWhat nats does
The skill covers messaging patterns built around NATS. It explains publishing and subscribing, queue groups, wildcard subjects, and request/reply, with code samples in Node.js, Python, and Go.
Core NATS does not retain messages, while JetStream adds persistence and replay. The Docker Compose example enables JetStream with the -js flag and exposes ports 4222 and 8222. Requests need a timeout to avoid hanging.
What it helps with
- configure NATS message publishers and subscribers
- choose subject patterns for event filtering
- connect services with request/reply messaging
- decide between Core NATS and JetStream
Example prompts for the agent
- Show me how to use NATS request/reply in Python.
- Explain when to use JetStream instead of Core NATS for events.
- How do I subscribe to
orders.*and distribute messages across handlers?
How to install nats
1Skills CLI (Vercel)
npx skills add claude-dev-suite/claude-dev-suite --skill nats -a claude-code2Manually: put the files in place
~/.claude/skills/nats/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/nats/
1Skills CLI (Vercel)
npx skills add claude-dev-suite/claude-dev-suite --skill nats -a codex2Manually: put the files in place
.agents/skills/nats/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add claude-dev-suite/claude-dev-suite --skill nats -a cursor2Manually: put the files in place
.cursor/skills/nats/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install claude-dev-suite/claude-dev-suite skills/messaging/nats2Manually: put the files in place
.github/skills/nats/SKILL.md1Skills CLI (Vercel)
npx skills add claude-dev-suite/claude-dev-suite --skill nats -a gemini-cli2Platform CLI
gemini skills install https://github.com/claude-dev-suite/claude-dev-suite --path skills/messaging/natsManually: put the files in place
.devin/skills/nats/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add claude-dev-suite/claude-dev-suite --skill nats -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about nats
How do I install nats in Claude Code?
Run npx skills add claude-dev-suite/claude-dev-suite --skill nats -a claude-code. The skill file is at ~/.claude/skills/nats/SKILL.md.
What does nats do?
It teaches Core NATS, JetStream, and common messaging patterns. Examples cover publishing, subscriptions, and request/reply in Node.js, Python, and Go.
How does Core NATS differ from JetStream?
Core NATS does not persist messages and delivers them at most once. JetStream supports persistence and replay, with at-least-once delivery.
Source text
SKILL.md · MIT
---
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`
© claude-dev-suite · MIT · claude-dev-suite/claude-dev-suite