developing-kafka-python-client
Use when the user wants to build a Python Kafka producer or consumer, add Schema Registry to existing Python code, migrate from raw JSON to schema-backed…
Skill by confluentincOfficial
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/confluentinc-developing-kafka-python-client
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: devops
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
- Runs as
- Python package
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/developing-kafka-python-client
What's inside
- Skill name
developing-kafka-python-client- Description
- Use when the user wants to build a Python Kafka producer or consumer, add Schema Registry to existing Python code, migrate from raw JSON to schema-backed serialization, or scaffold a confluent-kafka-python project for Confluent Cloud, local Docker, or WarpStream. Also use when user wants to optimize Python Kafka client configuration for WarpStream.
- License
- Apache-2.0
- Metadata
- version: 1.0.0
- Instructions
- 444 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
Files (20)
- SKILL.md
- evals.json · evals/
- existing_producer.py · evals/files/
- common.py · references/
- consumer.py · references/
- consumer_avro.py · references/
- docker-compose.yml · references/
- multi-event-guide.md · references/
- order_events.schema.json · references/
- producer.py · references/
- producer_avro.py · references/
- producer_avro_sync.py · references/
- producer_multi_event.py · references/
- producer_multi_event_sync.py · references/
- producer_sync.py · references/
- readme-template.md · references/
- schema-generation-rules.md · references/
- test_project.py · references/
- value.avsc · references/
- warpstream-optimization.md · references/
SKILL.md (first lines)
<HARD-GATE>
Do NOT generate any code, scaffold any project, or modify any file until you have
explicitly asked and received answers for questions #1 (existing app or greenfield),
#2 (target environment), and #3 (producer, consumer, or both). If the user's prompt
partially answers some questions, still confirm your understanding before generating.
This applies to EVERY prompt regardless of how specific it appears.
</HARD-GATE>
Begin by announcing: "Using the Confluent Kafka Python Client skill to guide this project."
# Confluent Kafka Python Client Creation
Generate a production-ready Python project for producing to and/or consuming from Kafka using `confluent-kafka-python`. Supports three target environments: **Confluent Cloud** (managed), **Local Docker** (open-source Kafka), and **WarpStream** (Kafka-compatible, object-storage-backed), and two producer styles: **AsyncIO** (non-blocking) and **Synchronous** (blocking). The generated code follows Confluent's best practices.
## Step 1: Gather Requirements
Before generating any code, work through the questions below. **Skip any question the user has already answered explicitly in their prompt** — do not re-ask just for form's sake. For example, "build a producer and consumer on Confluent Cloud with an async producer" already answers #2, #3, and #4; only #1, #5, #6, #7, and #8 remain.
**Mandatory confirmation gate — do not skip, even if the user answered every question.** Before writing any file, you MUST send one message that:
1. Recaps the answers you extracted as a short bulleted list (e.g., "Target: Confluent Cloud · Components: producer + consumer · Producer style: async · From scratch: yes").
2. Asks any remaining open questions inline.
3. Explicitly asks the user to confirm or correct before you proceed.
Then STOP and wait for the user's reply. Do not generate files in the same turn as the recap, and do not proceed on the assumption that a fully-specified prompt implies consent to generate immediately — the recap catches misinterpretations of the prompt and is required even when questions #1–#8 are all pre-answered. The only way to skip the gate is if the user has already confirmed the recap earlier in this conversation.
Do not assume defaults for #1, #2, or #3 — if any of these are not answered by the prompt, you must ask.
1. **Are you adding Kafka to an existing application, or starting from scratch?**
- If the user has existing Python code (mentions an existing project, has a `main.py`, uses Flask/FastAPI/Django, etc.), do **not** scaffold a new project. Instead: (a) identify their existing producer or data-sending code, (b) ask whether they already have schemas registered in Schema Registry, (c) add Schema Registry integration to their existing code following the patterns in the reference files. Generate only the files they are missing (e.g., `common.py`, `schemas/value.schema.json`) and modify their existing code inline.
- If the user already produces to Kafka without Schema Registry (schemaless), help them migrate: (1) generate a JSON Schema from their existing message structure, (2) register it, and (3) replace their raw `producer.produce()` calls with serializer-backed calls. Do not discard their existing code.
- If starting from scratch, proceed with the full scaffold below.
2. **Target environment?** — Confluent Cloud, local Kafka (Docker), or WarpStream. **Always prompt for this, even if the user didn't mention it.** If they mention "open source", "local", "docker", "self-hosted", or just want to try Kafka without a cloud account, choose **local Docker**. If they mention "Confluent Cloud", "CC", or have existing cloud credentials, choose **Confluent Cloud**. If they mention "WarpStream", choose **WarpStream**. Default to Confluent Cloud if they confirm they don't have a preference, but always ask first.
- **If WarpStream:** Read `references/warpstream-optimization.md` and apply the librdkafka overrides from that reference. Key changes: disable idempotence, dramatically increase batch sizes and in-flight requests, set large fetch sizes, add `ws_az=<az>` to `client.id` for zone-aware routing. Prefer null message keys for sticky partitioning unless entity-based ordering is required.
3. **Producer, consumer, or both?**
4. **Async or synchronous producer?** (Only if producer is requested.) Help the user choose:
- **AsyncIO Producer** (`AIOProducer`): Use when code runs under an event loop — FastAPI/Starlette, aiohttp, Sanic, asyncio workers — and must not block.
- **Synchronous Producer** (`Producer`): Use for scripts, batch jobs, and highest-throughput pipelines where the user controls threads/processes and can call `poll()`/`flush()` directly.
If the user mentions an async framework (FastAPI, aiohttp, Sanic) or uses `asyncio`, default to **AsyncIO**. If they mention scripts, batch, ETL, or don't have a preference, default to **Synchronous**.
5. **Do you have an existing schema you'd like to use?** If yes, ask the user to paste it or provide the file path, then use it as the `schemas/value.schema.json` instead of generating one. If no, proceed to ask about their data fields.
6. **What kind of data are you producing?** (Only if the user doesn't have an existing schema. Get field names and types so you can generate a matching JSON Schema and sample data.)
7. **Topic name?** (Default: `demo-topic`)
8. **Consumer group ID?** (Only if consumer; default: `python-consumer-group`)
Don't ask about Schema Registry — always include it. For Confluent Cloud and local Docker, always use JSON Schema. If the target is WarpStream, ask which Schema Registry implementation they are using — WarpStream's built-in schema registry only supports Avro and Protobuf (`GET /schemas/types` returns `["AVRO","PROTOBUF"]`), so if they are using it, ask whether they prefer Avro or Protobuf (default to Avro). If they are using a different SR (e.g., Confluent Cloud Schema Registry), JSON Schema is fine.
### Common Agent Mistakes
| Thought | Reality |
|---------|---------|
| "The user mentioned FastAPI, so I know it's async — skip the questions" | Still confirm. They might want a sync background worker alongside FastAPI. |
| "I'll use Avro since it's more widely used" | This skill uses JSON Schema by default. **Exception:** WarpStream's built-in schema registry only supports Avro and Protobuf — if the user is using WarpStream SR, use Avro by default. If they're using a different SR (e.g., Confluent Cloud SR), JSON Schema is fine regardless of the Kafka environment. |
| "I'll skip Schema Registry to keep it simple" | Schema Registry is non-negotiable. Every project includes it. |
| "I'll use `auto.register.schemas=True` for convenience" | Always `False`. Explicit registration is a core principle. |
| "I'll create a producer in `produce()` — it's cleaner" | One producer instance, created in `main()`, passed as a parameter. Always. |
| "The user wants sync, so the consumer should be sync too" | Consumer is always async (`AIOConsumer`). This is a deliberate design decision. |
| "I'll add `headers=` to the AIOProducer for schema ID" | `AIOProducer.produce()` raises `NotImplementedError` on headers. Only sync producers use headers. |
| "I'll swap `AsyncJSONSerializer` for `AsyncAvroSerializer` and keep the call site the same" | `JSONSerializer` takes `schema_str` first; `AvroSerializer` takes `schema_registry_client` first. Calling positionally across formats raises `TypeError: ... got multiple values for argument 'schema_registry_client'`. Always pass both as kwargs. |
| "I'll set `message.max.bytes=64000000` on the producer config and `fetch.max.bytes=50242880` on the consumer — they're independent" | Not in librdkafka. `message.max.bytes` is a **client-global** config (unlike Java's per-role `max.request.size`), so when `get_kafka_config()` is shared between producer and consumer, the consumer inherits it. librdkafka enforces `fetch.max.bytes >= message.max.bytes` at consumer construction and raises `KafkaError{_INVALID_ARG, ... "fetch.max.bytes must be >= message.max.bytes"}`. Use the WarpStream librdkafka consumer values in `references/warpstream-optimization.md` (`fetch.max.bytes=67108864`) — they're sized to satisfy this constraint. |
## Step 1b: Confirm Understanding
After gathering all answers, present a confirmation summary before generating any code:
```
Before I generate the project, let me confirm:
- Project type: [Greenfield scaffold / Migration of existing code]
- Environment: [Confluent Cloud (SASL_SSL) / Local Docker (PLAINTEXT) / WarpStream]
- Schema format: [JSON Schema / Avro / Protobuf] (Avro or Protobuf if using WarpStream's built-in SR)
- Components: [Producer only / Consumer only / Both]
- Producer style: [AsyncIO (AIOProducer) / Synchronous (Producer)] (if applicable)
- Schema: [brief description of user's data fields]
- Topic: [topic name]
- Consumer group: [group ID] (if consumer)
Does this look right?
```
Wait for user confirmation before proceeding to Step 2. If the user corrects anything, update your understanding and re-confirm.
## Step 2: Generate the Project
### Decision Flowchart
```dot
digraph decisions {
"Q1: Existing app?" -> "Migration path:\nmodify existing code" [label="yes"];
"Q1: Existing app?" -> "Q2: Environment?" [label="no / greenfield"];
"Q2: Environment?" -> "Cloud config\n(SASL_SSL)" [label="Confluent Cloud"];
"Q2: Environment?" -> "Local Docker config\n(PLAINTEXT) + docker-compose.yml" [label="local / docker / OSS"];
"Q2: Environment?" -> "WarpStream config\n(apply overrides from\nreferences/warpstream-optimization.md)" [label="WarpStream"];
"Cloud config\n(SASL_SSL)" -> "Q3: Components?";
"Local Docker config\n(PLAINTEXT) + docker-compose.yml" -> "Q3: Components?";
"WarpStream config\n(apply overrides from\nreferences/warpstream-optimization.md)" -> "Which SR?\n(WarpStream SR → Avro/Protobuf;\nother SR → JSON Schema)";
"Which SR?\n(WarpStream SR → Avro/Protobuf;\nother SR → JSON Schema)" -> "Q3: Components?";
"Q3: Components?" -> "Q4: Async or sync?" [label="producer requested"];
"Q3: Components?" -> "Generate consumer\n(always async AIOConsumer)" [label="consumer only"];
"Q4: Async or sync?" -> "AIOProducer path\nAsyncJSONSerializer\n(no headers support)" [label="async / event-loop"];
"Q4: Async or sync?" -> "Producer path\nJSONSerializer\n(header-based schema ID)" [label="sync / batch / ETL"];
}
```
Create this file structure in the user's chosen directory:
```
<project-dir>/
├── producer.py # (if requested)
├── consumer.py # (if requested)
├── common.py # shared config loading + verification helpers
├── schemas/
│ └── value.schema.json # JSON Schema (or value.avsc / value.proto when using WarpStream SR)
├── tests/
│ └── test_project.py # unit tests (always generated)
├── .env.example # template for credentials
├── requirements.txt
├── docker-compose.yml # (local Docker path only)
```
### SecurityFrom confluentinc/agent-skills, Apache-2.0.
More from confluentinc/agent-skills
- 0.725score
msk-migration
confluentincOfficial
Use this skill to assess and plan a migration from AWS MSK (Managed Streaming for Apache Kafka) to Confluent Cloud.
SkillBFreshness: B★ 59Claude Code +9 - 0.725score
confluent-cloud-flink-sql
confluentOfficial
Write and debug Flink SQL that runs on Confluent Cloud, enforcing the CC-vs-Apache-Flink (OSS) dialect boundary.
SkillBFreshness: B★ 59Claude Code +9 - 0.725score
confluent-tuning-advisor
confluentOfficial
Advisory-only Kafka tuning for Confluent Cloud or Confluent Platform by priority: latency, throughput, availability, or durability.
SkillBFreshness: B★ 59Claude Code +9 - 0.725score
kafka-schema-registry
confluentincOfficial
Scan a project to identify Kafka applications, extract schemas from data models, tag PII fields, generate Terraform for Confluent Schema Registry…
SkillBFreshness: B★ 59Claude Code +9 - 0.725score
kafka-streams-programming
confluentincOfficial
Architect, build, and debug Kafka Streams apps (JVM-embedded stream processing).
SkillBFreshness: B★ 59Claude Code +9 - 0.725score
flink-udf
confluentincOfficial
Build and deploy Apache Flink user-defined functions (UDFs) in Java for stream processing over Kafka.
SkillBFreshness: B★ 59Claude Code +9 - 0.721score
confluent-skill-creator
confluentOfficial
Create Confluent-specific skills for external users.
SkillBFreshness: B★ 59Claude Code +9 - 0.721score
confluent-skill-reviewer
confluentOfficial
Review a Confluent agent skill in this repo against the Agent Skills spec (agentskills.io), Confluent conventions in CLAUDE.md, the PR template gates, and the…
SkillBFreshness: B★ 59Claude Code +9 - 0.715score
confluent-cloud-cdc-tableflow
confluentincOfficial
Set up end-to-end Change Data Capture (CDC) pipelines on Confluent Cloud using Debezium source connectors, Flink for transformation, and Tableflow for data…
SkillBFreshness: B★ 59Claude Code +9 - 0.697score
developing-kafka-java-client
confluentincOfficial
Use when the user wants to integrate a Kafka client into an existing application or scaffold a Java Kafka client project (Maven or Gradle based) for Confluent…
SkillBFreshness: B★ 59Claude Code +9
Signals
- Stars
- 59
- Forks
- 11
- Open issues
- 1
- Last commit (this folder)
- Aug 24, 2026 (2 months ago)
- Last release
- Sep 24, 2026 (1 month ago)
From GitHub (fetched Oct 24, 2026).
Details
- Version
- 1.0.0
- License
- Apache-2.0
- Repository
- github.com/confluentinc/agent-skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from confluentinc
- 0.725score
kafka-schema-registry
confluentincOfficial
Scan a project to identify Kafka applications, extract schemas from data models, tag PII fields, generate Terraform for Confluent Schema Registry…
SkillBFreshness: B★ 59Claude Code +9 - 0.725score
kafka-streams-programming
confluentincOfficial
Architect, build, and debug Kafka Streams apps (JVM-embedded stream processing).
SkillBFreshness: B★ 59Claude Code +9 - 0.725score
flink-udf
confluentincOfficial
Build and deploy Apache Flink user-defined functions (UDFs) in Java for stream processing over Kafka.
SkillBFreshness: B★ 59Claude Code +9 - 0.725score
msk-migration
confluentincOfficial
Use this skill to assess and plan a migration from AWS MSK (Managed Streaming for Apache Kafka) to Confluent Cloud.
SkillBFreshness: B★ 59Claude Code +9 - 0.715score
confluent-cloud-cdc-tableflow
confluentincOfficial
Set up end-to-end Change Data Capture (CDC) pipelines on Confluent Cloud using Debezium source connectors, Flink for transformation, and Tableflow for data…
SkillBFreshness: B★ 59Claude Code +9 - 0.697score
developing-kafka-java-client
confluentincOfficial
Use when the user wants to integrate a Kafka client into an existing application or scaffold a Java Kafka client project (Maven or Gradle based) for Confluent…
SkillBFreshness: B★ 59Claude Code +9
Cite this page
developing-kafka-python-client skill. Agent Mart. https://agentmart.dev/skills/confluentinc-developing-kafka-python-client (last updated 2026-10-24)