kafka-streams-programming
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "kafka-streams-programming":https://skillpi.com/zh/skills/deepskill-d8b318ccff4c36ba4da42012444d5b59c01387f5e98df5281a07163cb16baacf。安装前核对上游来源和版本:https://github.com/Kilo-Org/kilo-marketplace。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
架构、构建与调试 Kafka Streams(JVM 嵌入式流处理)应用。适用于提及 KStream、KTable、拓扑(topology)、TopologyTestDriver、StreamsBuilder、交互式查询、GlobalKTable、连接/窗口/聚合或调试问题(如再平衡、状态存储、滞后、反序列化错误)时,也适用于希望针对 WarpStream 优化或调整 Kafka Streams 客户端配置以适配 WarpStream 的场景。请勿用于 Flink、连接器、CDC 或普通生产者/消费者 情形。
介绍来源: third_party · Kilo-Org · 0.0.1 参考来源
SkillPi 解读
- 软件、账号及付费要求
- 翻译待完成,请参阅来源文档。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: kafka-streams-programming
description: >-
Architect, build, and debug Kafka Streams apps (JVM-embedded stream
processing). Use when user mentions KStream, KTable, topology,
TopologyTestDriver, StreamsBuilder, interactive queries, GlobalKTable,
joins/windows/aggregations, or debugging issues (rebalancing, state stores,
lag, deserialization errors). Also use when user wants to optimize Kafka
Streams for WarpStream or tune Kafka Streams client configuration for
WarpStream. Do NOT trigger for Flink, connectors, CDC, or plain
producer/consumer.
metadata:
category: data
source:
repository: 'https://github.com/confluentinc/agent-skills'
path: skills/kafka-streams-programming
license_path: LICENSE
commit: 9095afceac13c8924c7b9993b26f0f57abd8b267Kafka Streams — Architect, Build, Debug
JVM-embedded stream processing library with no separate cluster.
⚠️ IMPORTANT: Lazy-Load References Only
Do NOT read all reference files upfront. Read ONLY what you need, when you need it.
- User asks "how do I join two topics?" → Read
references/topology-patterns.md§ Joins Decision Tree only - User asks "build me a Kafka Streams app" → Read
references/build-templates.mdwhen writing build files, not before - User asks "my app is crashing" → Read the specific section in
references/debugging.mdfor that symptom - Most questions need 0-2 reference files total, not all 10
Never read multiple files preemptively "just in case"
Always Confirm Target Environment First
Before answering in any mode (Architect, Build, Debug), confirm the target environment if the user hasn't stated it: Apache Kafka | Confluent Platform | Confluent Cloud | WarpStream. Versions/auth shape every recommendation — KIP-1071 support, SASL config, ACL model, transactional-id expiry, CLI tool names all branch on this. Skip the question only if the user already named the environment.
If the user selects WarpStream: Read references/warpstream-optimization.md and apply its overrides on top of the standard config baseline. Key impacts for Kafka Streams:
- EOS has a significant throughput cost —
exactly_once_v2enables idempotent producers internally, which reduces throughput on WarpStream due to limited in-flight request concurrency. Default toat_least_oncewith downstream deduplication unless the user has a strong need for EOS. - Producer and consumer configs must be overridden (larger batches, higher linger, larger fetches). See the "Kafka Streams Specific" section in the shared reference.
fetch.min.bytesis not supported — do not set it.replication.factoris cosmetic (always 3) — do not tune it.- Zone-aware routing via
client.idwithws_az=<az>suffix is critical for cost. - Latency is higher (~250ms p50 produce vs single-digit ms on Kafka) — set expectations with the user.
Mode Detection
Determine the user's intent and enter the appropriate mode:
| User intent | Mode | What to do |
|---|---|---|
| "I need to process events from topic X..." / "Build me a KS app..." / "I want to aggregate/filter/join..." | Build | Go to Build Mode |
| "How should I design my topology?" / "Should I use a KTable or GlobalKTable?" / "What join type do I need?" / "How do I handle late events?" | Architect | Go to Architect Mode |
| "My Streams app is stuck/slow/crashing..." / "Why am I getting rebalancing loops?" / "How do I interpret this metric?" | Debug | Go to Debug Mode |
If unclear, default to Architect — understand the problem before generating code.
Flink-first check (Confluent Cloud only)
If user asks for generic stream processing on CC without mentioning KS, briefly offer Flink as alternative. Don't lecture.
Architect Mode
Design the right topology. Translate user's data problem into KS primitives.
Step 1: Understand the Data Problem
Confirm target environment first (see preamble). Then ask (skip if answered): What data (topics)? What output? Relationship between inputs (combine/enrich/group)?
Step 2: Recommend the Topology Pattern
Match problem to pattern (read references/topology-patterns.md only for the specific pattern needed). Present: why it fits, data flow in plain English, KS primitives involved, tradeoffs/alternatives.
Key Decision Trees
When needed, read only the relevant section:
- Combine topics:
references/topology-patterns.md§ Joins Decision Tree - Aggregate over time:
references/topology-patterns.md§ Windowing Decision Tree - Enrichment/lookup:
references/topology-patterns.md§ Enrichment Patterns - Exactly-once:
references/topology-patterns.md§ Exactly-Once (walk through before recommending — at-least-once is simpler if downstream can dedupe)
After user confirms, go to Build Mode.
Build Mode
Generate a complete, runnable Kafka Streams project.
Step 1: Gather Requirements
Ask (skip if already answered):
- What does your app do? Push back on vague requests.
- Topics & data flow: Input/output topics? Schematized? If yes, retrieve schema (don't generate new ones). How do topics connect (joins/lookups/independent)?
- Schema format (skip if using existing): Avro (default) | Protobuf | JSON Schema
- Build tool: Gradle (default) | Maven
- Target environment (REQUIRED): Apache Kafka | Confluent Platform | Confluent Cloud | WarpStream (read
references/config-baseline.mdwhen generating config; if WarpStream, also readreferences/warpstream-optimization.mdfor client overrides) - Credentials: CC needs 2 API keys (Kafka + SR). CP/AK needs bootstrap + SR URLs + auth type (read
references/cli-commands.mdif needed) - Deployment sizing: Partitions? Instances? State size? (read
references/architecture.mdorreferences/production-hardening.md§ Deployment Sizing if needed) - Test data: Has data or wants sample data generated?
Step 2: Plan Resources
Present plan: topics to create (source/output/DLQ), schemas to register. Changelog/repartition topics auto-created by KS. If the user says input topics already exist, omit them from create-topics.sh — the script should only create new topics (typically output + DLQ).
Step 3: Generate the Project
Generate: project structure, schemas, App.java, TopologyBuilder.java, config, simplelogger.properties, docker-compose (if local), scripts, TopologyTest.java, .env.example, monitoring comments.
Read references only as needed:
- Topology code? →
references/topology-patterns.mdfor the specific pattern - Build file structure? →
references/build-templates.md - Schema syntax? →
references/schema-patterns.md - Config properties? →
references/config-baseline.mdfor env-specific blocks - Scripts? →
scripts/create-topics.sh,scripts/teardown.sh - Local dev? →
references/docker-compose.md
Gradle: Run gradle wrapper --gradle-version 8.12 after creating build files.
If user wants sample data: generate SampleDataProducer.java and produce task.
Step 4: Production Hardening (if production target)
Trigger: User says "production"/"prod"/"deploy" or specifies K8s/ECS/Docker Swarm or requests multiple instances.
Add production components (read references/production-hardening.md for details if needed): Logback JSON logging, logback.xml, health check endpoint, Dockerfile with JVM tuning, KIP-1034 DLQ handler, K8s YAML (if K8s), shadow/fat jar plugin.
Step 5: Walk Through the Code
Explain topology, config choices, how to run, what to monitor. Mention group.protocol=streams (KIP-1071) provides 50-80% faster rebalancing (requires AK 4.2+/CP 8.2+).
Step 6: Run the App Before Handing Off
You must actually start the app against a real broker and observe it reach RUNNING before declaring the task done. Generated code that compiles and passes TopologyTestDriver tests can still fail at startup — version-mismatch NoClassDefFoundErrors, silent logger fallbacks, missing runtime deps, and import-path errors all slip past compile + test and only surface against a real broker / Schema Registry. A green build is not a working app.
Branch on the target environment chosen in Step 1:
Local (Apache Kafka or Confluent Platform via the generated docker-compose.yml):
docker compose up -dand wait for Kafka + SR to be healthy (docker compose ps, or curl SR/subjects)./create-topics.sh- Start the app in the background (
./gradlew runormvn exec:java) so you can read its logs while it runs - Tail the log and confirm
State transition from REBALANCING to RUNNINGwithin ~30s. If you don't see it, read the actual stack trace, diagnose viareferences/debugging.md§ Startup Failures, fix, restart, re-verify - If the user wanted sample data: produce a few records and confirm output appears on the destination topic
- Stop the app and
docker compose down(or leave running if the user wants to keep iterating — ask)
Confluent Cloud: You usually cannot run end-to-end yourself because the cluster + SR API keys are the user's. Do the most you can without them, then hand off the rest:
- If
.envhas real CC creds (the user has set up a real.env): run the app locally pointed at CC (./gradlew runauto-loads.env) and follow steps 3–5 above. Don't skip just because it's CC — if you have creds, run it. - If creds are placeholders or not provided: do not fabricate a successful run. Instead:
- Run
./gradlew build(compile + unit tests) and report the result - List the exact commands the user must run to verify (
./create-topics.sh --cloud,./gradlew run, the consume command fromreferences/verification.md§ Confluent Cloud) and what success looks like (State transition from REBALANCING to RUNNING, records on the output topic) - Tell the user explicitly: "I couldn't run this against your CC cluster because I don't have your API keys — please run the steps above and paste any errors back."
- Run
WarpStream: You usually cannot run end-to-end yourself because the WarpStream cluster and credentials are the user's. Follow the same approach as Confluent Cloud:
- If
.envhas real WarpStream creds: run the app locally (./gradlew runauto-loads.env) and follow the Local steps 3–5 above. Note thatState transition from REBALANCING to RUNNINGmay take longer due to WarpStream's higher metadata latency. - If creds are placeholders or not provided: do not fabricate a successful run. Instead:
- Run
./gradlew build(compile + unit tests) and report the result - List the exact commands the user must run to verify (
./create-topics.sh,./gradlew run) and what success looks like (State transition from REBALANCING to RUNNING, records on the output topic) - Remind the user to set
client.idwithws_az=<az>in their.envfor zone-aware routing - Tell the user explicitly: "I couldn't run this against your WarpStream cluster because I don't have your credentials — please run the steps above and paste any errors back."
- Run
In the handoff, state plainly which of the above you did. If you ran it and saw RUNNING, say so. If you only compiled, say only that. Don't imply a runtime verification you didn't perform.
For CC consume commands, schema-aware producers, and reset procedures, read references/verification.md.
Debug Mode
Step 1: Classify the Problem
| Symptom | Category | Go to |
|---|---|---|
| App crashes on startup | Startup failure | references/debugging.md § Startup Failures |
| App runs but no output / stops processing | Processing stall | references/debugging.md § Processing Stalls |
| Rebalancing loops / constant rebalancing | Rebalancing | references/debugging.md § Rebalancing Issues |
| High lag / slow processing | Performance | references/debugging.md § Performance |
| Deserialization errors / poison pills | Data quality | references/debugging.md § Deserialization Errors |
| State store issues (corruption, growth, recovery) | State | references/debugging.md § State Store Issues |
Thread failures / StreamsUncaughtExceptionHandler |
Thread health | references/debugging.md § Thread Failures |
| Memory issues (OOM, high heap, RocksDB) | Memory | references/debugging.md § Memory Issues |
| Low throughput or KAFKA_STORAGE_ERROR on WarpStream | WarpStream config | references/warpstream-optimization.md |
Step 2: Gather Context
Confirm target environment first (see preamble) — most debug paths branch on it. Then ask for: error message, config, KS/Java versions, new app or regression?
Step 3: Diagnose and Fix
Read the relevant section in references/debugging.md for the identified category. Provide fix with explanation.
Invariant Checklist
Non-negotiable defaults. Apply all. Read reference files only if you need implementation details.
- Schematized data: SR serdes (
SpecificAvroSerde,KafkaProtobufSerde,KafkaJsonSchemaSerde). Setschema.registry.url,default.key.serde,default.value.serde. JSON Schema: setjson.value.type. Protobuf: setspecific.protobuf.value.type(references/config-baseline.md) - Versions: KS 4.x / CP 8.x, Java 17+
- KIP-1071:
group.protocol=streams(default). Remove ifUnsupportedVersionException. Unsupported: static membership, regex topics, standby replicas, warm-up replicas (references/topology-patterns.md § Assignment Strategy) - Four-tier error handling:
DeserializationExceptionHandler,ProcessingExceptionHandler(KIP-1034),ProductionExceptionHandler,StreamsUncaughtExceptionHandler. Use MaxFailures pattern for uncaught (references/production-hardening.md § Error Handling) - Explicit naming:
ensure.explicit.internal.resource.naming=true - Graceful shutdown: Hook with
streams.close(30s)on SIGTERM/SIGINT - Monitoring:
metrics.recording.level=INFO(references/config-baseline.md) - Log verbosity: Generate
simplelogger.properties(references/build-templates.md) - Defensive topology: Guard lambdas in prod (null checks, try/catch). Dev: simpler is fine.
- Schema parity: Avro/Protobuf/JSON Schema all supported (references/build-templates.md, references/schema-patterns.md)
- Test caching: TopologyTestDriver tests need
statestore.cache.max.bytes=0to avoid non-deterministic assertions. - Avro logical type Java mappings: Avro 1.12+ generates
java.time.Instantfortimestamp-millis/timestamp-micros,LocalDatefordate,BigDecimalfordecimal, etc. Never use rawlong/intliterals with generated setter methods — useInstant.EPOCH,Instant.now(),Instant.ofEpochMilli(...). UseInstant.isAfter()/isBefore()instead ofMath.max()/Math.min()for timestamp comparisons. Applies to topology code, aggregation initializers, producers, AND test helpers (references/schema-patterns.md § Java type mapping).
Bundled Scripts
scripts/: create-topics.sh (pre-create topics, --cloud), teardown.sh (delete topics/state, --cloud), produce-test-data.sh (generate if requested).
Reference Files (read on-demand only)
references/topology-patterns.md — design, joins, windows, aggregations | references/architecture.md — internals, sizing | references/debugging.md — troubleshooting | references/config-baseline.md — config | references/build-templates.md — project structure | references/schema-patterns.md — Avro/Protobuf/JSON | references/production-hardening.md — prod setup | references/cli-commands.md — CLI | references/docker-compose.md — local dev | references/verification.md — checklists | references/warpstream-optimization.md — WarpStream client config overrides
版本历史
-
skills-20261103210927-6c1b454
GitHub ↗
原版更新说明
Automated skills release from commit 6c1b4543cac1d45a80bf5904e4b69ac315117323
-
skills-20260928190452-ff51758
GitHub ↗
原版更新说明
Automated skills release from commit ff51758b06b8249007116184096765d47bdb7505
-
skills-20260924105536-d31110d
GitHub ↗
原版更新说明
Automated skills release from commit d31110d62dc0bd00c22f1d6f6a630d1e702a0049
-
skills-20260923085113-cea285e
GitHub ↗
原版更新说明
Automated skills release from commit cea285ef0e4d6ec47cd2fd9fdbca03813a3363c7
-
skills-20260922193956-97d7333
GitHub ↗
原版更新说明
Automated skills release from commit 97d7333d8200e5ac556c659c8669f3a83ba10866
此处仅展示最近 5 个版本。 在原站查看完整版本历史 ↗
当前收录版本
0.0.1
安全与评测信息
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供 Kafka Streams 全生命周期支持:从拓扑设计、项目生成到生产部署与 WarpStream 优化
- 覆盖主流环境(Apache Kafka、Confluent Platform/Cloud、WarpStream)并提供差异化配置建议
亮点
- 触发词覆盖全面且边界清晰,明确排除 Flink、CDC 等无关场景,减少误触风险
待提升项
-
description 内容重复 原报告严重程度:轻微
顶层 frontmatter 和 skill_body 内部均包含完整 description,存在冗余
改进建议:保留一处即可,建议移除 skill_body 内重复的 description 字段以精简文档
亮点
- 三大模式(Architect/Build/Debug)划分清晰,步骤完整,含端到端运行验证要求
- 强调 Lazy-Load References 和按需读取,提升执行效率
待提升项
-
缺少显式 When to Use 章节 原报告严重程度:轻微
文档未设置独立 When to Use 章节,但核心触发逻辑已在 description 中完整描述
改进建议:可考虑添加显式 When to Use 小节以增强可读性,但当前已满足功能需求
亮点
- 强制要求实际运行验证(观察 RUNNING 状态),避免仅编译通过导致的交付缺陷
- 针对 WarpStream 提供专项优化建议(如禁用 fetch.min.bytes、zone-aware routing)
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
-
账号、密钥或授权
使用专用、最小权限账号,不把密钥粘贴到公开内容或命令日志;核对接收数据的服务与租户。
主文档提及 · 第 102, 159, 165 行
文档引用的域名或地址
这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。
- github.com
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
翻译待完成,请参阅来源文档。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。