Nuxt Nats logo

Nuxt Nats

Community
lithqube
nuxt-nats

Use this skill whenever working in a Nuxt 4 / Nitro project that uses the nuxt-nats module to talk to NATS JetStream — configuring the module in nuxt.config (the `nats:` key), publishing events with jsPublish or corePublish, registering durable pull consumers with defineNatsConsumer, building a dead-letter consumer with defineDeadLetterConsumer, streaming to the browser with useEphemeralConsumer (SSE), using KV/Object Store via useKV/useObj, exposing or calling AI agents with defineNatsAgent/useAgents, typing subjects via the NatsEvents interface, or the NUXT_NATS_WORKERS worker gate. Trigger on any of those symbols, on the env vars NUXT_NATS_SERVERS / NUXT_NATS_USER_JWT / NUXT_NATS_NKEY_SEED / NUXT_NATS_WORKERS, or when a Nuxt app needs server-side NATS messaging. Use this even if the user just says "add NATS to my Nuxt app". For raw @nats-io/* client code outside Nuxt use jetstream-architecture; for server/cluster deployment use jetstream-deployment; for the Synadia agent protocol details use nats-agent-fabric.

Overview

Publisherlithqube
Repositorynats-jetstream-claude-skills
Skill namenuxt-nats
Stars
28
Forks
2
Bundled files
7
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 7 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by lithqube on GitHub. Read the source before you install it.

Installation

Install the Nuxt Nats AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/lithqube/nats-jetstream-claude-skills/tree/main/nuxt-nats
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/lithqube/nats-jetstream-claude-skills.git /tmp/nats-jetstream-claude-skills
mkdir -p .claude/skills
cp -r /tmp/nats-jetstream-claude-skills/nuxt-nats .claude/skills/nuxt-nats
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Nuxt Nats in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Nuxt Nats on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Nuxt Nats is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

nuxt-nats

nuxt-nats is a Nuxt 4 / Nitro server-side module (config key nats) that owns the NATS JetStream connection lifecycle and gives you auto-imported server utilities for publishing, consuming, KV/Object Store, and the Synadia agent fabric. It wraps the modular @nats-io/* v3 client — you almost never call @nats-io/* directly in a nuxt-nats app.

It is server-only (Nitro): there are no browser composables (ADR-002). Publish and consume from server/ — plugins, API routes, and Nitro tasks.

What it gives you (auto-imported in server/)

UtilityPurpose
useNats() / useJetStream() / useJetStreamManager()raw connection / JS client / JSM, when you need to drop down
useJetStreamIfAvailable()non-throwing useJetStream() — returns null before the connection is ready (see SSR lifecycle)
jsPublish(subject, data, opts?)durable JetStream publish, typed via NatsEvents, with msgId dedup + client retry
corePublish(subject, payload)fire-and-forget core NATS publish (no PubAck)
defineNatsConsumer(opts)register a durable pull consumer (worker)
defineDeadLetterConsumer(opts)build a DLQ by consuming max-deliver / terminated advisories from a stream
useEphemeralConsumer(opts)request-scoped ordered ephemeral consumer (SSE)
useKV(bucket, opts?) / useObj(bucket, opts?)KV bucket / Object Store, cached per process
defineNatsAgent(opts) / useAgents()host or call AI agents on the Synadia Agent Protocol

Reference files

Read the one you need — don't load them all:

  • references/configuration.md — the full nats: module option reference, env-var overrides, the auth priority chain, TLS, JetStream domain/prefix, and the provisioning stance (provision). Read when setting up or debugging module config.
  • references/publishing.md — jsPublish vs corePublish, the NatsEvents typed-subject augmentation, msgId dedup, and publish retry. Read when producing events.
  • references/consumers.md — defineNatsConsumer, the NUXT_NATS_WORKERS gate, ack/nak/term handling, defineDeadLetterConsumer, and useEphemeralConsumer for SSE. Read when consuming.
  • references/kv-object.md — useKV / useObj, and their real gotchas (Object Store wants a ReadableStream, KV TTL units). Read for state/blob storage.
  • references/agents.md — defineNatsAgent / useAgents on the Synadia Agent Protocol. Read when building an agent; defer to the nats-agent-fabric skill for the wire protocol itself.
  • references/gotchas.md — the SSR/Nitro lifecycle race, reconnect-storm status semantics, Nitro externals, provisioning races, and testing with Testcontainers. Read this before shipping to production; it's where the non-obvious failures live.

Minimal setup

ts
// nuxt.config.ts
export default defineNuxtConfig({
  modules: ['nuxt-nats'],
  nats: {
    servers: ['nats://localhost:4222'],   // override in prod via NUXT_NATS_SERVERS (all cluster nodes)
    // auth is normally injected via env: NUXT_NATS_USER_JWT + NUXT_NATS_NKEY_SEED
    streams: [                             // DESCRIBE streams; do not let the app own them in prod
      { name: 'ORDERS', subjects: ['orders.>'], provision: 'never' },
    ],
  },
})
ts
// server/api/orders.post.ts — publish
export default defineEventHandler(async (event) => {
  const body = await readBody(event)
  await jsPublish('orders.created', body, { msgId: body.id })  // msgId => Nats-Msg-Id dedup
  return { ok: true }
})
ts
// server/plugins/order-worker.ts — consume (runs only when NUXT_NATS_WORKERS=true)
export default defineNitroPlugin(() => {
  defineNatsConsumer({
    stream: 'ORDERS',
    durable: 'order-processor',       // binds an EXISTING durable by default (IaC owns its config)
    async handler(data, msg) {
      await process(data)
      // handler return = ack; throw = nak with backoff; see references/consumers.md
    },
  })
})

Core principles

  • Server-side only. Publish/consume from server/. There are no client composables; don't try to useNats() in a Vue component.
  • The worker gate is deliberate. Consumers and agents run only when NUXT_NATS_WORKERS=true. Serverless/edge deployments publish fine but must not run long-lived pull loops. The recommended topology is a serverless publisher + a separate persistent worker process. If your consumer "never fires", check this first.
  • provision: 'never' in production. A stream/consumer config is server-side state that belongs in IaC (an idempotent streams.sh or Helm), not in N racing app replicas. provision: 'startup' is for dev; 'update' races on rolling deploys. The streams: block in config is best read as documentation of a stream some other process owns.
  • defineNatsConsumer binds; it does not enforce. By default it binds an existing durable — filterSubjects/ackPolicy you pass are not sent to the broker unless the durable is being created (provision: 'startup'). The live durable's config wins; a drift test against a real broker is the only thing that catches a mismatch.
  • NATS has no dead-letter queue. maxDeliver = retry then stop, not "route to a DLQ". Use defineDeadLetterConsumer() (advisory capture) if you need one — see references/consumers.md. Never write a comment claiming redelivery auto-routes to dlq.*; it doesn't.
  • Type your subjects. Augment NatsEvents in a server/**/*.d.ts so every jsPublish is checked. See references/publishing.md.
  • Respect the SSR lifecycle race. Nitro doesn't await async server plugins in order, so the connection may not be ready when a later plugin runs. Use useJetStreamIfAvailable() / the module's readiness wait, never a bare useJetStream() at plugin top level. See references/gotchas.md.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Nuxt Nats AI skill do?

Use this skill whenever working in a Nuxt 4 / Nitro project that uses the nuxt-nats module to talk to NATS JetStream — configuring the module in nuxt.config (the `nats:` key), publishing events with jsPublish or corePublish, registering durable pull consumers with defineNatsConsumer, building a dead-letter consumer with defineDeadLetterConsumer, streaming to the browser with useEphemeralConsumer (SSE), using KV/Object Store via useKV/useObj, exposing or calling AI agents with defineNatsAgent/useAgents, typing subjects via the NatsEvents interface, or the NUXT_NATS_WORKERS worker gate. Trigg...

Why use Nuxt Nats on TypingMind?

Because you install it once and use it with any model. Nuxt Nats is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Nuxt Nats in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/lithqube/nats-jetstream-claude-skills/tree/main/nuxt-nats. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Nuxt Nats?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Nuxt Nats?

As many as you like. As long as a model supports skills, you can use Nuxt Nats with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Nuxt Nats AI skill free?

Yes. It is published on GitHub by lithqube under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇