python-kafka-module-skill

python-kafka-module-skill is a skill for Claude Code, Codex from jiushiwon/wg-skills. It costs 106 tokens per session (2,139 once invoked), scanned A, original, Apache-2.0.

A Python integration guide for adding Apache Kafka to an existing FastAPI project. Kafka is a system for sending, storing, and processing streams of messages between services.

In plain words
What is it for?
Use it to send and receive JSON messages, create producers and consumers, use consumer groups, retry failed messages, assign message keys and partitions, or work with Kafka transactions.
Why use it?
It provides a standard starting point for event-driven features without separately designing producer, consumer, serialization, retry, and error-handling code. It is intended for projects that already have a FastAPI structure.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to send and receive JSON messages, create producers and consumers, use consumer groups, retry failed messages, assign message keys and partitions, or work with Kafka transactions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/jiushiwon/wg-skills/python-kafka-module-skill
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 jiushiwon/wg-skills --skill python-kafka-module-skill
Clone the repo
git clone --depth 1 https://github.com/jiushiwon/wg-skills

Made for: Claude Code, Codex.

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 python-kafka-module-skill

README.md
[![agentmods](https://agentmods.dev/badge/skills/jiushiwon/wg-skills/python-kafka-module-skill/github.svg)](https://agentmods.dev/skills/jiushiwon/wg-skills/python-kafka-module-skill)
Your own site
<a href="https://agentmods.dev/skills/jiushiwon/wg-skills/python-kafka-module-skill"><img src="https://agentmods.dev/badge/skills/jiushiwon/wg-skills/python-kafka-module-skill/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 python-kafka-module-skill

Your own site · 80×15
<a href="https://agentmods.dev/skills/jiushiwon/wg-skills/python-kafka-module-skill"><img src="https://agentmods.dev/badge/skills/jiushiwon/wg-skills/python-kafka-module-skill.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 106 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,139 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Privilege Escalation · line 286
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
How audits are shown
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.00106 $0.02139
Opus 5.5 $0.00042 $0.00856
Sonnet 5.5 $0.00021 $0.00428
Haiku 4.5 $0.00011 $0.00214

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

Security

Grade A, and why

python-kafka-module-skill scanned grade A with 0 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.

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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

vibeCoding/backend/python/fastapi-module/python-kafka-module-skill/SKILL.md · 325 lines

How it starts

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

Python Kafka Module Skill

面向已有 FastAPI 项目的开发者,快速集成 Kafka 能力。

能力清单

能力 说明
生产者 同步/异步发送消息、消息分区、消息key
消费者 消费监听、消息重试、消费者组
消息序列化 JSON
事务消息 Kafka 事务
错误处理 消息发送/消费错误处理

触发场景

用户说"帮我加 Kafka"或"集成 Kafka"时触发。

依赖配置

pip install aiokafka

默认方法封装

1. 生产者

# kafka_producer.py
from aiokafka import AIOKafkaProducer, AIOKafkaConsumer
from typing import Optional, Callable, Any
import json
import logging

logger = logging.getLogger(__name__)

class KafkaProducer:
    def __init__(self, bootstrap_servers: str = "localhost:9092"):
        self.bootstrap_servers = bootstrap_servers
        self._producer: Optional[AIOKafkaProducer] = None
    
    async def start(self):
        """启动生产者"""
        self._producer = AIOKafkaProducer(
            bootstrap_servers=self.bootstrap_servers,
            value_serializer=lambda v: json.dumps(v, ensure_ascii=False).encode('utf-8'),
            key_serializer=lambda k: k.encode('utf-8') if k else None
        )
        await self._producer.start()
        logger.info("Kafka 生产者已启动")
    
    async def stop(self):
        """停止生产者"""
        if self._producer:
            await self._producer.stop()
            logger.info("Kafka 生产者已停止")
    
    async def send(self, topic: str, value: Any, key: Optional[str] = None) -> str:
        """发送消息(同步)"""
        if not self._producer:
            raise RuntimeError("生产者未启动")
        
        future = await self._producer.send_and_wait(topic, value, key=key)
        return f"{future.topic}-{future.partition}-{future.offset}"
    
    async def send_async(self, topic: str, value: Any, key: Optional[str] = None, callback: Optional[Callable] = None):
        """发送消息(异步)"""
        if not self._producer:
            raise RuntimeError("生产者未启动")
        
        await self._producer.send(topic, value, key=key)
        if callback:
            # 注册回调
            pass
    
    async def send_json(self, topic: str, data: dict, key: Optional[str] = None):
        """发送 JSON 消息"""
        return await self.send(topic, data, key)
    
    async def send_messages(self, topic: str, messages: list):
        """批量发送消息"""
        if not self._producer:
            raise RuntimeError("生产者未启动")
        
        for msg in messages:
            await self._producer.send(topic, msg)

# 全局实例
producer = KafkaProducer()

Read the full file on GitHub · 325 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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 · 325 lines · 106 tokens per session scan A 5e95567f8c19

Subscribe to this mod's changes

python-kafka-module-skill is a skill published in the GitHub repository jiushiwon/wg-skills (121 stars, last pushed yesterday), licensed Apache-2.0. It adds 106 tokens to every session and 2,139 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. 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-patterns

FastAPI patterns for async APIs, dependency injection, Pydantic request and response models, OpenAPI docs, tests, security, and production readiness.

affaan-m/ECC · 35 tokens

stripe-projects

Use after E2B sandbox/API access has been provisioned through Stripe Projects and the user needs to use the resulting E2B API key with the E2B CLI, JavaScript SDK, Python SDK, or Code Interpreter SDK.

e2b-dev/E2B · 51 tokens

azure-mgmt-botservice-py

Azure Bot Service Management SDK for Python. Use for creating, managing, and configuring Azure Bot Service resources. Triggers: "azure-mgmt-botservice", "AzureBotService", "bot management", "conversational AI", "bot channels".

microsoft/skills · 59 tokens

azure-messaging-webpubsubservice-py

Azure Web PubSub Service SDK for Python. Use for real-time messaging, WebSocket connections, and pub/sub patterns. Triggers: "azure-messaging-webpubsubservice", "WebPubSubServiceClient", "real-time", "WebSocket", "pub/sub".

microsoft/skills · 64 tokens

django-pro

Master Django 5.x with async views, DRF, Celery, and Django Channels. Build scalable web applications with proper architecture, testing, and deployment. Use PROACTIVELY for Django development, ORM optimization, or complex Django patterns.

rmyndharis/antigravity-skills · 52 tokens

fastapi-pro

Build high-performance async APIs with FastAPI, SQLAlchemy 2.0, and Pydantic V2. Master microservices, WebSockets, and modern Python async patterns. Use PROACTIVELY for FastAPI development, async optimization, or API architecture.

rmyndharis/antigravity-skills · 57 tokens