kafka-python-client

kafka-python-client is a skill for Claude Code from lensesio/agentic-engineering-for-apache-kafka. It costs 150 tokens per session (5,377 once invoked), scanned C, original, MIT.

A project scaffold for Python applications that send messages to and read messages from Apache Kafka, including message schemas and tests. It uses confluent-kafka-python and connects to a Schema Registry, which stores the expected structure of messages.

In plain words
What is it for?
Use it to generate a Python Kafka producer and consumer project after discovering the target topic, partitions, and registered JSON Schema from a connected Kafka system.
Why use it?
It avoids starting a Kafka client project from scratch and includes setup for safer message delivery, clean shutdowns, and testing.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the kafka-skills plugin — 10 skills shipped together

Good fit Use it to generate a Python Kafka producer and consumer project after discovering the target topic, partitions, and registered JSON Schema from a connected Kafka system.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/lensesio/agentic-engineering-for-apache-kafka/kafka-python-client
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add lensesio/agentic-engineering-for-apache-kafka --skill kafka-python-client
Clone the repo
git clone --depth 1 https://github.com/lensesio/agentic-engineering-for-apache-kafka

Made for: Claude Code.

Or install kafka-skills, the plugin that ships this one along with the rest of its 10 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for kafka-python-client

README.md
[![agentmods](https://agentmods.dev/badge/skills/lensesio/agentic-engineering-for-apache-kafka/kafka-python-client/github.svg)](https://agentmods.dev/skills/lensesio/agentic-engineering-for-apache-kafka/kafka-python-client)
Your own site
<a href="https://agentmods.dev/skills/lensesio/agentic-engineering-for-apache-kafka/kafka-python-client"><img src="https://agentmods.dev/badge/skills/lensesio/agentic-engineering-for-apache-kafka/kafka-python-client/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for kafka-python-client

Your own site · 80×15
<a href="https://agentmods.dev/skills/lensesio/agentic-engineering-for-apache-kafka/kafka-python-client"><img src="https://agentmods.dev/badge/skills/lensesio/agentic-engineering-for-apache-kafka/kafka-python-client.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 150 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,377 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 2 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00150 $0.05377
Opus 5.5 $0.00060 $0.02151
Sonnet 5.5 $0.00030 $0.01075
Haiku 4.5 $0.00015 $0.00538

Measured 1mo ago against content hash fe7cc40b802d, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade C, and why

kafka-python-client scanned grade C with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

The scan reads SKILL.md. This mod also ships 5 executable files (evals/files/trips_api/main.py, references/common-template.py, references/consumer-template.py, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Downloads and executes remote codehighSupply chain

curl | sh runs whatever the server returns today, which is not necessarily what it returned when this was reviewed.

If `uv` is missing on the user's machine, point them at the official installer (`curl -LsSf https://astral.sh/uv/install.sh | sh`) before continuing — do not fall back to `pip`.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

If `uv` is missing on the user's machine, point them at the official installer (`curl -LsSf https://astral.sh/uv/install.sh | sh`) before continuing — do not fall back to `pip`.
skills/kafka-python-client/SKILL.md · 367 lines

How it starts

The opening of the file, as written. The whole thing — 367 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Kafka Python Client Scaffold

Generates a production-ready Python project that produces to and consumes from a Kafka topic using confluent-kafka-python, with Schema Registry (JSON Schema), graceful shutdown, idempotent producer, header-based schema identification, and tests. The agent should discover everything about the target topic (name, partitions, registered schema) from the live cluster via whichever Kafka MCP server is attached — Lenses MCP, Confluent's, Aiven's, or any other — before asking the user. Only fall back to questions if no Kafka MCP is attached or discovery returns nothing.

Target environment and keyword: $ARGUMENTS

Open your first reply with: "Running the kafka-python-client skill to scaffold this project."

Workflow

Copy this checklist and track your progress:

Scaffold Progress:
- [ ] Step 1: Discover topic + schema via the attached Kafka MCP
- [ ] Step 2: Hard gate - confirm with user before generating
- [ ] Step 3: Generate the project files
- [ ] Step 4: Run pytest against the generated tests
- [ ] Step 5: Run validation gate (kafka-topic-audit + kafka-perf-review)
- [ ] Step 6: Hand back with run instructions
  1. Discover topic + schema via whichever Kafka MCP is attached (see references/mcp-discovery.md)
  2. Hard gate: recap what was discovered, confirm with user before generating anything
  3. Generate the project using the templates in references/
  4. Run pytest against the generated tests/ and fix any failures (fix the code, not the tests)
  5. Run validation gate: invoke kafka-topic-audit against the target topic and kafka-perf-review against the generated producer.py and consumer.py
  6. Hand back with run instructions and the validation-gate findings inline

Step 1: Discover topic + schema via any attached Kafka MCP

Read references/mcp-discovery.md for the full probing procedure, vendor-specific tool-name hints and fallbacks. The high-level shape:

  1. Identify the attached Kafka MCP server by looking at what's available in the session. Common ones: mcp__Lenses__* (Lenses MCP — reference implementation), mcp__Confluent__*, mcp__Aiven__*, custom servers tagged for Kafka.
  2. Discover the environment / cluster using whichever tool the MCP exposes (Lenses: list_environments; Confluent: list_clusters; others vary).
  3. Search for candidate topics by keyword from the user's prompt (Lenses: list_datasets(search=...); raw Kafka admin MCPs: list_topics then filter).
  4. Fetch the registered schema for the chosen topic's value subject (Lenses: get_dataset; Confluent: get_schema(subject=<topic>-value); bare Schema Registry MCPs: HTTP GET against /subjects/<topic>-value/versions/latest).
  5. Read partition count and replication factor (Lenses: get_topic_metadata; most others expose a describe_topic or get_topic equivalent).
  6. Check existing consumer groups to suggest a non-colliding GROUP_ID (Lenses: list_consumer_groups_by_topic; most others: list_consumer_groups).

Read the full file on GitHub · 367 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 367 lines · 150 tokens per session scan C fe7cc40b802d

Subscribe to this mod's changes

kafka-python-client is a skill published in the GitHub repository lensesio/agentic-engineering-for-apache-kafka (65 stars, last pushed 2mo ago), licensed MIT. It adds 150 tokens to every session and 5,377 once invoked, about $0.0006 per session on Opus 5.5. A static security scan graded it C with 2 findings (downloads and executes remote code, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

fastapi-templates

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

wshobson/agents · 37 tokens

fastapi-async-microservices

Design and develop production-grade asynchronous microservices using FastAPI, Python 3.12+, Pydantic v2 Settings and Schemas, SQLAlchemy 2.0 async sessions, dependency injection, lifespan state management, structured JSON logging, and connection pooling. Trigger when building async Python APIs, microservices, or…

hamzabellouch/agent-skills · 77 tokens

django

Expert Django assistance covering ORM, models, class-based views, admin interface, migrations, and Django REST Framework. Use when developing robust, scalable Python web applications and REST APIs.

G1Joshi/Agent-Skills · 37 tokens

fastapi

Expert FastAPI assistance covering Pydantic models, async endpoints, dependency injection, and OpenAPI generation. Use when developing high-performance Python REST APIs and microservices.

G1Joshi/Agent-Skills · 36 tokens

flask

Expert Flask assistance covering Blueprints, application factories, Jinja2 templating, and SQLAlchemy extensions. Use when developing lightweight Python web services and applications.

G1Joshi/Agent-Skills · 34 tokens

scaffold-utils

Add or wire pure helpers/utils, preferring ArchiPy utils (datetime, JWT, password, file, string). Use for "add a helper/util function", "format dates", "hash passwords", or "generate tokens".

SyntaxArc/archipy-plugin · 50 tokens