agentleFS
vaquarkhanvaquarkhan/data-engineering-agent-skills/skills/kafka-resilience-and-schema-evolution/SKILL.md

kafka-resilience-and-schema-evolution

Skill49 starsChanged 6 months agoMITView on GitHub

Enforces production Kafka guardrails including non-breaking schema evolution, dead-letter queues for poison messages, and acks=all producer durability. Use when designing or changing Kafka topics, producers, consumers, schema registry policies, or streaming recovery paths.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 5 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before any schema change:

    line 41
  2. Distinctive:

    run compatibility checks in CI against registered schemas

    line 43
  3. Distinctive:

    document producer-then-consumer or consumer-then-producer rollout order

    line 44
  4. Distinctive:

    Every production consumer that parses external payloads must define:

    line 49
  5. Distinctive:

    no silent drop of unparseable records

    line 54
  6. Very specific:

    Use mcp-data-observability-integration with mcp/kafka.mcp.json to inspect consumer group lag and topic metadata before changing consumer …

    line 64

≈ “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 Resilience And Schema Evolution

Overview

Generic streaming guidance is not enough for production Kafka. Agents routinely introduce breaking schema changes, under-provisioned durability settings, and missing poison-message isolation. This skill mandates enforceable broker, producer, consumer, and registry guardrails before any production change ships.

When to Use

  • creating or modifying Kafka topics, producers, or consumers
  • setting or changing schema registry compatibility policies
  • designing dead-letter queue (DLQ) routing for poison pill messages
  • hardening producer durability (acks, retries, idempotence)
  • reviewing consumer lag, replay, or failover behavior on Kafka-backed pipelines

Pair with streaming-and-messaging-systems for broader event design. Pair with avro-protobuf-json-schema-registry when registry subjects and compatibility CI are in scope.

Workflow

  1. Define the production contract before broker changes. Document:
    • topic key strategy and partition count rationale
    • retention, compaction, and replay policy
    • schema format and registry subject naming
    • consumer groups and downstream sinks
    • delivery semantics target (at-least-once with idempotent sinks, or stricter)
  2. Enforce producer durability defaults. Require unless explicitly waived with owner approval:
    • acks=all (or acks=-1)
    • enable.idempotence=true when ordering and deduplication matter
    • bounded retries with delivery.timeout.ms aligned to SLA
    • max.in.flight.requests.per.connection=1 when strict ordering is required
    • TLS/SASL configuration documented for non-development clusters
  3. Block breaking schema evolution. Before any schema change:
    • set compatibility policy per subject (BACKWARD, FORWARD, or FULL — not NONE in production)
    • run compatibility checks in CI against registered schemas
    • document producer-then-consumer or consumer-then-producer rollout order
    • reject field removals, renames, or type changes without migration plan
    • load references/kafka-production-guardrails.md for DLQ and evolution patterns
  4. Mandate dead-letter and poison pill isolation. Every production consumer that parses external payloads must define:
    • DLQ topic or sink with retention and access controls
    • classification rules (deserialization failure, schema mismatch, business rule violation)
    • alert routing when DLQ rate exceeds threshold
    • replay procedure with deduplication keys
    • no silent drop of unparseable records
  5. Make lag and recovery observable. Plan for:
    • consumer group lag alerts with owner routing
    • offset reset policy documented and restricted
    • replay runbook that does not bypass DLQ classification
    • broker disk and retention monitoring for high-throughput topics
  6. Load MCP observability when diagnosing live lag. Use mcp-data-observability-integration with mcp/kafka.mcp.json to inspect consumer group lag and topic metadata before changing consumer code or partition counts.

Common Rationalizations

RationalizationReality
"acks=1 is fine because Kafka is durable."Leader acknowledgment without full ISR acknowledgment loses events under failure scenarios.
"We can fix schema breaks by redeploying consumers quickly."Breaking changes propagate to many consumers and batch sinks before redeploy completes.
"DLQs add too much operational overhead."Poison pills without DLQs stall partitions, inflate lag, and hide data loss as consumer retries.
"Schema compatibility NONE is okay for internal topics."Internal topics still feed warehouses, stream processors, and audit systems.

Red Flags

  • production subjects use NONE compatibility
  • producers use acks=0 or acks=1 without documented waiver
  • consumers have no DLQ path for deserialization failures
  • schema changes ship without CI compatibility validation
  • consumer group lag has no alert owner
  • replay procedures reset offsets without reconciliation or publish pause

Verification

  • Producer durability settings meet acks=all and idempotence requirements
  • Schema compatibility policy is set and CI-validated for production subjects
  • DLQ routing, alerts, and replay procedure are documented
  • Consumer lag and retention monitoring exist with named owners
  • Rollout order for schema changes is explicit and tested in non-production

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.