---
name: "ksqldb-streaming-event-joins"
description: "Write continuous SQL queries, windowed aggregations, and stream-table joins over Kafka topics."
metadata:
  author: "Confluent"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "create ksqldb stream"
  - "write stream table join ksqldb"
  - "tumbling window aggregation ksqldb"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# ksqlDB Real-Time Streaming SQL & Materialized Views

Builds streaming architectures with ksqlDB: creating streams and tables from Kafka topics, writing tumbling and hopping window aggregations, stream-table joins, and querying push/pull queries over REST.

## When to Invoke
Invoke this skill whenever you need to:
- create ksqldb stream
- write stream table join ksqldb
- tumbling window aggregation ksqldb

## Execution SOP & Rules
1. Create stream: CREATE STREAM orders_stream (order_id VARCHAR, amount DOUBLE) WITH (KAFKA_TOPIC='orders', VALUE_FORMAT='JSON');
2. Create materialized table: CREATE TABLE user_totals AS SELECT user_id, SUM(amount) FROM orders_stream GROUP BY user_id;
3. Write windowed aggregation: SELECT user_id, COUNT(*) FROM orders_stream WINDOW TUMBLING (SIZE 5 MINUTES) GROUP BY user_id EMIT CHANGES;
4. Query materialized state via ksqlDB pull query endpoint: SELECT * FROM user_totals WHERE user_id = 'user_123';

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
