Kafka Streams topology design expert. Covers KStream vs KTable vs GlobalKTable, topology patterns, stream operations (filter, map, flatMap, branch), joins, windowing strategies, and exactly-once semantics. Activates for kafka streams topology, kstream, ktable, globalkTable, stream operations, stream joins, windowing, exactly-once, topology design.
View on GitHubanton-abyzov/specweave
sw-kafka-streams
January 25, 2026
Select agents to install to:
npx add-skill https://github.com/anton-abyzov/specweave/blob/main/plugins/specweave-kafka-streams/skills/kafka-streams-topology/SKILL.md -a claude-code --skill kafka-streams-topologyInstallation paths:
.claude/skills/kafka-streams-topology/# Kafka Streams Topology Skill
Expert knowledge of Kafka Streams library for building stream processing topologies in Java/Kotlin.
## What I Know
### Core Abstractions
**KStream** (Event Stream - Unbounded, Append-Only):
- Represents immutable event sequences
- Each record is an independent event
- Use for: Clickstreams, transactions, sensor readings
**KTable** (Changelog Stream - Latest State by Key):
- Represents mutable state (compacted topic)
- Updates override previous values (by key)
- Use for: User profiles, product catalog, account balances
**GlobalKTable** (Replicated Table - Available on All Instances):
- Full table replicated to every stream instance
- No partitioning (broadcast)
- Use for: Reference data (countries, products), lookups
**Key Differences**:
```java
// KStream: Every event is independent
KStream<Long, Click> clicks = builder.stream("clicks");
clicks.foreach((key, value) -> {
System.out.println(value); // Prints every click event
});
// KTable: Latest value wins (by key)
KTable<Long, User> users = builder.table("users");
users.toStream().foreach((key, value) -> {
System.out.println(value); // Prints only current user state
});
// GlobalKTable: Replicated to all instances (no partitioning)
GlobalKTable<Long, Product> products = builder.globalTable("products");
// Available for lookups on any instance (no repartitioning needed)
```
## When to Use This Skill
Activate me when you need help with:
- Topology design ("How to design Kafka Streams topology?")
- KStream vs KTable ("When to use KStream vs KTable?")
- Stream operations ("Filter and transform events")
- Joins ("Join KStream with KTable")
- Windowing ("Tumbling vs hopping vs session windows")
- Exactly-once semantics ("Enable EOS")
- Topology optimization ("Optimize stream processing")
## Common Patterns
### Pattern 1: Filter and Transform
**Use Case**: Clean and enrich events
```java
StreamsBuilder builder = new StreamsBuilder();
// Input stream
KStream<Long, Clic