kafka
SKILL.md
Kafka Integration Skill
You are an expert in integrating Apache Kafka with Platformatic Watt for event-driven microservices.
Prerequisites Check
Before any Kafka setup, verify:
-
Node.js Version: Watt requires Node.js v22.19.0+
node --versionIf below v22.19.0, inform user they must upgrade Node.js first.
-
Existing Watt Config: Check if
watt.jsonalready existsls watt.json 2>/dev/nullIf no
watt.json, suggest running/watt initfirst to set up Watt.
Command Router
Based on user input ($ARGUMENTS), route to the appropriate workflow:
| Input Pattern | Action |
|---|---|
hooks, webhooks, (empty) |
Run Kafka-Hooks Setup |
producer, consumer, client |
Run Kafka Client Setup |
monitoring, lag, health |
Run Consumer Lag Monitoring Setup |
tracing, opentelemetry, otel |
Run Kafka Tracing Setup |
migrate, kafkajs, migration |
Run KafkaJS Migration Workflow |
Kafka-Hooks Setup
When user requests Kafka webhook/hook integration:
- Read references/kafka.md
- Choose integration approach:
- @platformatic/kafka-hooks: Kafka-to-HTTP webhooks (recommended for Watt)
- @platformatic/kafka: Direct producer/consumer in your services
- Create kafka-hooks service with
npx wattpm@latest create - Configure topics, webhooks, and request/response patterns
Kafka-Hooks Patterns
- Webhook: Kafka messages → HTTP endpoints (with DLQ)
- Request/Response: HTTP → Kafka → HTTP (correlation IDs)
- HTTP Publishing: POST to
/topics/{topicName}
Kafka Client Setup
When user requests direct Kafka producer/consumer integration:
- Read references/kafka.md
- Install
@platformatic/kafka:npm install @platformatic/kafka - Set up producer and/or consumer in the target service
- Configure serializers/deserializers based on message format
Consumer Lag Monitoring Setup
When user requests Kafka consumer lag monitoring:
- Read references/kafka.md
- Install
@platformatic/watt-plugin-kafka-health:npm install @platformatic/watt-plugin-kafka-health - Add plugin to service
watt.json - Configure lag threshold and check interval
Kafka Tracing Setup
When user requests OpenTelemetry tracing for Kafka:
- Read references/kafka.md
- Install
@platformatic/kafka-opentelemetry:npm install @platformatic/kafka-opentelemetry - Enable instrumentation in the service
KafkaJS Migration Workflow
When user wants to migrate from KafkaJS to @platformatic/kafka:
- Read references/migration.md
- Scan the project for KafkaJS usage patterns:
require('kafkajs')orfrom 'kafkajs'importsnew Kafka({...})factory instantiation.producer(),.consumer(),.admin()callsconnect()/disconnect()lifecycle callssubscribe()+run({ eachMessage })consumer patternsendBatch()callsCompressionTypesusagetransaction()calls- Error handling with
KafkaJS*error classes
- Apply the migration checklist from the reference, transforming each pattern
- Verify the migration covers all areas:
- Client creation (factory → direct instantiation)
- Connection lifecycle (
connect/disconnect→ lazy/close) - Producer API (topic per-send → topic per-message, serializers)
- Consumer API (callback → stream, offset modes)
- Admin API (new method signatures)
- Error handling (
retriable→canRetry, new error classes) - Events (custom events →
diagnostics_channel)
Important Notes
- Internal service URLs:
http://{service-id}.plt.local - Environment variables in watt.json use
{VAR_NAME}(curly braces, no dollar sign) - Kafka-hooks is the recommended approach for Watt multi-service architectures
- Always configure Dead Letter Queues (DLQ) for production webhook topics
Weekly Installs
9
Repository
platformatic/skillsFirst Seen
Feb 19, 2026
Security Audits
Installed on
opencode9
gemini-cli9
claude-code9
github-copilot9
amp9
codex9