agentleFS
seed-forgeseed-forge/harness-ai-kit/skills/public-kafka-expert-base/SKILL.md

public-kafka-expert-base

Skill25 starsChanged 4 months agoApache-2.0View on GitHub

Kafka 知识基座。覆盖 Topics/Partitions、Consumer Groups、Producer/Consumer Config、Serialization、Exactly-Once、Rebalancing。供 devlab-middleware-expert 通过 extends 继承。

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 3 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use partition keys for related messages that must be ordered (e.g., user_id for user events).

    line 16
  2. Distinctive:

    All consumers in a group share the workload (each partition → one consumer).

    line 19
  3. Very specific:

    Use auto.offset.reset=earliest for new groups that need to process all history.

    line 22
  4. Very specific:

    Use Avro/Protobuf/JSON Schema with Schema Registry for type safety.

    line 44
  5. Distinctive:

    Never use Java serialization (not cross-language, not forward-compatible).

    line 45
  6. Very specific:

    Use isolation.level=read_committed on consumer (read only committed transactions).

    line 50
  7. Very specific:

    Use cooperative rebalancing (partition.assignment.strategy=CooperativeStickyAssignor).

    line 55
  8. Very specific:

    Use ConsumerRebalanceListener for cleanup on partition revocation.

    line 57
  9. Very specific:

    Always set acks=all and enable.idempotence=true for producers.

    line 60
  10. Very specific:

    Always use manual offset commits (enable.auto.commit=false).

    line 61
  11. Distinctive:

    Never use Java serialization for Kafka messages.

    line 62

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Kafka Knowledge Base

Foundational guidance for building event streaming applications with Apache Kafka.

Source: Adapted from confluentinc/agent-skills and Apache Kafka best practices.

Topics & Partitions

  • Design topics around domain events (order.created, payment.completed), not database tables.
  • Partition count determines max consumer parallelism — start with 3-6, scale up as needed.
  • Partitions are ordered; messages within a partition have guaranteed order.
  • Use partition keys for related messages that must be ordered (e.g., user_id for user events).

Consumer Groups

  • All consumers in a group share the workload (each partition → one consumer).
  • Multiple groups can independently consume the same topic (fan-out).
  • Consumer offset tracking: committed offsets vs. current position.
  • Use auto.offset.reset=earliest for new groups that need to process all history.

Producer Configuration

SettingDefaultRecommended
acks1all (durability)
retries03+ (transient failures)
linger.ms05-100 (batching)
batch.size16KB32-64KB (throughput)
compression.typenonelz4 or zstd
enable.idempotencetruealways true

Consumer Configuration

SettingDefaultRecommended
auto.offset.resetlatestearliest (first run)
enable.auto.committruefalse (manual commit)
max.poll.records500Tune to processing capacity
session.timeout.ms45s10-30s (failure detection)
heartbeat.interval.ms3ssession.timeout / 3

Serialization

  • Use Avro/Protobuf/JSON Schema with Schema Registry for type safety.
  • Never use Java serialization (not cross-language, not forward-compatible).
  • StringSerializer/StringDeserializer only for simple text messages.

Exactly-Once Semantics

  • Enable enable.idempotence=true on producer (prevents duplicates from retries).
  • Use isolation.level=read_committed on consumer (read only committed transactions).
  • For transactional processing: beginTransaction() → process → commitTransaction().

Rebalancing

  • Triggered when consumers join/leave a group or partitions are reassigned.
  • Use cooperative rebalancing (partition.assignment.strategy=CooperativeStickyAssignor).
  • Handle CommitFailedException during rebalance — retry after rebalance completes.
  • Use ConsumerRebalanceListener for cleanup on partition revocation.

Guardrails

  • Always set acks=all and enable.idempotence=true for producers.
  • Always use manual offset commits (enable.auto.commit=false).
  • Never use Java serialization for Kafka messages.
  • Monitor consumer lag (kafka-consumer-groups --describe).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.