Backend Data Streamingのロゴ

Backend Data Streaming

コミュニティ
j4flmao
backend-data-streaming

Use this skill when the user says 'data streaming', 'kafka architecture', 'stream processing', 'flink job', 'kafka streams', 'exactly once', 'watermarks', 'windowed aggregation', 'consumer lag', 'log compaction'. Designs backend streaming pipelines on Kafka (or compatible logs) with Flink or Kafka Streams: partitioning, consumer groups, offset/commit strategy, stateful processing, event time and watermarks, and exactly-once configuration. Do NOT use for: simple pub/sub between services (backend-event-driven-architecture), broker selection for task queues (backend-message-queue), analytics warehouse/lakehouse pipelines (data-streaming in skills/data).

概要

公開者j4flmao
リポジトリagent-skills
スキル名backend-data-streaming
スター
41
フォーク
6
同梱ファイル
7
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 7個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    j4flmaoがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキルBackend Data StreamingをTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/j4flmao/agent-skills/tree/main/skills/backend/universal/data-streaming
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/j4flmao/agent-skills.git /tmp/agent-skills
mkdir -p .claude/skills
cp -r /tmp/agent-skills/skills/backend/universal/data-streaming .claude/skills/backend-data-streaming
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでBackend Data Streamingを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあると、モデルが自動的にBackend Data Streamingを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Backend Data Streamingは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、未使用のスキルにはコストがかかりません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Data Streaming Architecture

Purpose

Build pipelines that process continuous event streams with predictable latency and correct results under failures, late data and redelivery. Covers Kafka topic design, consumer scaling, processing semantics, and stateful stream processing with Flink or Kafka Streams.

Agent Protocol

Trigger

Exact user phrases: "data streaming", "kafka architecture", "stream processing", "flink job", "kafka streams", "exactly once", "watermarks", "windowed aggregation", "consumer lag", "log compaction".

Input Context

  • Event sources, volume (events/s, bytes/s), and latency target.
  • Ordering and correctness needs (approximate OK vs exact counts, money).
  • Processing engine in use or allowed (Flink, Kafka Streams, Spark Structured Streaming, plain consumers).
  • Sinks (DB, search index, another topic, warehouse).

Output Artifact

Pipeline diagram, topic/partition plan, producer/consumer/processor config, and processing code. No files unless requested.

Response Format

Pipeline: {source} -> {topic(partitions, RF)} -> {processor} -> {sink}
Key: {partition key}   Ordering: per key
Semantics: {at-least-once + idempotent sink | exactly-once (transactions)}
Time: {event time, watermark = max_ts - {lateness}} Window: {tumbling/sliding/session, size}
State: {store/backend, TTL}   Checkpoint: {interval}

Kafka Fundamentals That Drive Design

ConceptRule
PartitionUnit of ordering and parallelism. Order is only guaranteed within a partition
KeySame key -> same partition (default hash partitioner), so key by the entity whose order matters
Consumer groupEach partition is consumed by at most one member of a group; members beyond the partition count sit idle
Partition countCan be increased but not decreased; increasing remaps keys, breaking per-key order for in-flight data. Size for future peak
RetentionTime/size-based delete, or cleanup.policy=compact to keep the latest value per key (changelogs, state rebuild). Tombstone = null value deletes a key
Replicationreplication.factor=3 with min.insync.replicas=2 and producer acks=all survives one broker loss without data loss
MetadataKafka 4.x runs only in KRaft mode; ZooKeeper is gone

Offset Commit Strategy

StrategyConfigResult
Auto commitenable.auto.commit=true (periodic, auto.commit.interval.ms)Commits on a timer regardless of processing: crash can lose (committed but unprocessed) or duplicate messages
Commit after processingauto commit off, commit after handler succeedsAt-least-once: duplicates on crash/rebalance, no loss
Transactional read-process-writeKafka transactions, consumer isolation.level=read_committedExactly-once for Kafka-to-Kafka
Store offsets with resultsSave offset in the sink DB in the same transaction; seek on startupExactly-once into that DB

Default recommendation: at-least-once plus an idempotent sink (upsert by key, dedupe table on event ID). Reach for transactions only for Kafka-to-Kafka processing where duplicates matter.

Exactly-Once Configuration

Producer side (transactional):

properties
enable.idempotence=true
acks=all
transactional.id=orders-enricher-0   # stable per producer instance

Consumer side:

properties
isolation.level=read_committed
enable.auto.commit=false

Kafka Streams: processing.guarantee=exactly_once_v2 (requires brokers 2.5+). Flink: checkpointing enabled plus KafkaSink with DeliveryGuarantee.EXACTLY_ONCE and a transactionalIdPrefix; downstream consumers must read with read_committed, and output becomes visible only when a checkpoint completes (latency is at least the checkpoint interval).

Exactly-once never extends to external side effects (emails, HTTP calls) automatically; those need idempotency keys.

Event Time, Watermarks and Windows

  • Event time = when it happened (timestamp in the event); processing time = when the operator sees it. Use event time for correctness under replay and lag.
  • A watermark asserts "no more events with timestamp < T are expected". Bounded-out-of-orderness watermark: max_seen_ts - allowed_lateness.
  • Windows fire when the watermark passes the window end. Late events beyond allowed lateness are dropped or sent to a side output.
  • Idle partitions hold back watermarks; configure idleness (WatermarkStrategy.withIdleness) in Flink.
java
// Flink DataStream API: 1-minute tumbling revenue per merchant, event time.
WatermarkStrategy<Order> wm = WatermarkStrategy
    .<Order>forBoundedOutOfOrderness(Duration.ofSeconds(30))
    .withTimestampAssigner((order, ts) -> order.occurredAtMillis())
    .withIdleness(Duration.ofMinutes(1));

DataStream<Order> orders = env.fromSource(kafkaSource, wm, "orders");

orders
    .keyBy(Order::merchantId)
    .window(TumblingEventTimeWindows.of(Duration.ofMinutes(1)))
    .allowedLateness(Duration.ofMinutes(5))
    .sideOutputLateData(lateTag)
    .aggregate(new SumRevenue())
    .sinkTo(revenueSink);

Stateful Processing

EngineState storeFault toleranceFits when
Kafka StreamsLocal RocksDB per task, backed by compacted changelog topicsChangelog restore; standby replicas speed recoveryKafka-in/Kafka-out logic embedded in a JVM service
FlinkHeap or RocksDB state backendPeriodic checkpoints / savepoints to object storageComplex event-time logic, large state, multiple sources/sinks
Spark Structured StreamingState store in executors, checkpoint to storageMicro-batch checkpointsTeams already on Spark; seconds-level latency acceptable

Rules:

  • Set state TTL for keyed state that would otherwise grow forever (e.g. per-user sessions).
  • Joins between two streams need a time bound (interval join) or state grows without limit.
  • Take a savepoint before changing job topology; assign stable operator UIDs in Flink so state maps across versions.

Throughput vs Latency Knobs

SettingHigher value gives
linger.msBigger batches, better throughput, more latency
batch.sizeLarger batches per partition
compression.type (lz4, zstd)Less network/disk, some CPU
fetch.min.bytes / fetch.max.wait.msFewer, larger fetches
max.poll.recordsMore records per poll; keep processing time under max.poll.interval.ms
Checkpoint interval (Flink)Less overhead, longer replay on failure and higher EOS output latency

Operations

  • Monitor consumer lag per partition (records and time), not only total.
  • Alert on under-replicated partitions, ISR shrink, and rebalance frequency.
  • Use cooperative rebalancing (partition.assignment.strategy=CooperativeStickyAssignor) or the new consumer group protocol (group.protocol=consumer, KIP-848) to avoid stop-the-world rebalances.
  • Schema registry with BACKWARD compatibility for every topic.

Anti-Patterns

Anti-patternFix
Processing time windows for business metricsEvent time + watermarks
Unkeyed messages where order mattersKey by entity ID
One partition "to keep order" for the whole topicOrder per key; partition for parallelism
Long blocking calls in poll loop -> rebalancesAsync with bounded in-flight, or raise max.poll.interval.ms deliberately
Unbounded state in joinsInterval joins, TTL
Claiming exactly-once with a non-transactional sinkIdempotent upserts or two-phase commit sink

Checklist

  • Partition key and count sized for peak and ordering.
  • RF=3, min.insync.replicas=2, acks=all for critical topics.
  • Commit strategy and sink idempotency documented.
  • Event-time watermarks, allowed lateness and late-data handling defined.
  • State TTL and checkpoint/savepoint procedure in place.
  • Lag, throughput and DLQ/late-data metrics alerting.

References

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Backend Data Streaming」では何ができますか?

Use this skill when the user says 'data streaming', 'kafka architecture', 'stream processing', 'flink job', 'kafka streams', 'exactly once', 'watermarks', 'windowed aggregation', 'consumer lag', 'log compaction'. Designs backend streaming pipelines on Kafka (or compatible logs) with Flink or Kafka Streams: partitioning, consumer groups, offset/commit strategy, stateful processing, event time and watermarks, and exactly-once configuration. Do NOT use for: simple pub/sub between services (backend-event-driven-architecture), broker selection for task queues (backend-message-queue), analytics w...

TypingMindでBackend Data Streamingを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Backend Data Streamingはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにBackend Data Streamingをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/j4flmao/agent-skills/tree/main/skills/backend/universal/data-streamingを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Backend Data Streamingを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストが合致したときにこのスキルを読み込めます。

Backend Data Streamingは何個のAIモデルで使えますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもBackend Data Streamingを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Backend Data Streaming」は無料ですか?

はい。j4flmaoがGitHubでMITライセンスの下で公開しています。支払いが必要なのは、利用したトークンに対する、ご自身が契約するAIプロバイダーへの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇