language-python

language-python is a skill for Claude Code from lugassawan/swe-workbench. It costs 60 tokens per session (1,273 once invoked), scanned A, original, MIT.

A Python coding guide covering type hints, dataclasses, exceptions, context managers, generators, asyncio, and testing. It loads when you work on Python files or projects.

In plain words
What is it for?
Use it when writing or reviewing Python functions, data containers, file or database resource handling, async code, or tests.
Why use it?
It helps make Python code clearer and safer, especially around resource cleanup, error handling, and asynchronous work.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the swe-workbench plugin — 60 skills, 25 commands, 32 agents, 4 hooks shipped together

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.

agentmods
npx agentmods add skills/lugassawan/swe-workbench/language-python
Any agent
npx skills add lugassawan/swe-workbench --skill language-python
Clone the repo
git clone --depth 1 https://github.com/lugassawan/swe-workbench

Made for: Claude Code.

Or install swe-workbench, the plugin that ships this one along with the rest of its 60 skills, 25 commands, 32 agents, 4 hooks.

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 language-python

README.md
[![agentmods](https://agentmods.dev/badge/skills/lugassawan/swe-workbench/language-python.svg)](https://agentmods.dev/skills/lugassawan/swe-workbench/language-python)
Your own site
<a href="https://agentmods.dev/skills/lugassawan/swe-workbench/language-python"><img src="https://agentmods.dev/badge/skills/lugassawan/swe-workbench/language-python.svg" alt="Measured on agentmods" height="20"></a>
Per session 60 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,273 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 2 findings. Scan, not verified.
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.00060 $0.01273
Opus 5 $0.00030 $0.00636
Sonnet 5 $0.00012 $0.00255
Haiku 4.5 $0.00006 $0.00127

Measured 2d ago against content hash 4501a9b42668, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

language-python scanned grade A 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 2d 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.

Makes network callslowCapability

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

tasks = [tg.create_task(fetch(u)) for u in urls]

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

- `subprocess.run(shell=True)` with user-controlled input — use the list form.
skills/language-python/SKILL.md · 137 lines

How it starts

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

Python

Type hints

  • Annotate all function signatures; Any is a smell unless at a genuine boundary.
  • Use dataclass for data containers with behavior; TypedDict for dict-shaped data at boundaries.
  • Prefer Protocol over ABC when duck typing suffices — no inheritance required.
  • from __future__ import annotations for forward refs in 3.9 and earlier.
from dataclasses import dataclass, field

@dataclass
class Order:
    id: str
    items: list[str] = field(default_factory=list)
    total: float = 0.0

Errors and exceptions

  • Use exceptions for exceptional paths, not flow control.
  • Raise specific subclasses; catch the narrowest class you can handle.
  • except Exception: is almost always wrong — at minimum log and re-raise.
  • contextlib.suppress(SomeError) for intentional ignore; bare except: never.
try:
    result = load(path)
except FileNotFoundError:
    raise MissingConfigError(path) from None

Context managers

  • with for any resource with a cleanup obligation: files, locks, DB connections.
  • @contextlib.contextmanager for ad-hoc managers without a full class.
  • Never hold a resource longer than the with block.
@contextlib.contextmanager
def managed_resource():
    r = acquire()
    try:
        yield r
    finally:
        release(r)

Generators and iterators

  • Prefer generators over materializing full lists when you only iterate once.
  • yield from to delegate to sub-generators.
  • Reach for itertools before writing loops: chain, islice, groupby, product.
def read_chunks(path: Path, size: int = 4096):
    with open(path, "rb") as f:
        while chunk := f.read(size):  # walrus operator, 3.8+
            yield chunk

Concurrency

  • GIL caveat: threads don't parallelize CPU-bound work — use ProcessPoolExecutor or multiprocessing.
  • asyncio for IO-bound concurrency; asyncio.TaskGroup (3.11+) for structured fan-out.
  • ThreadPoolExecutor for legacy sync IO or blocking C extensions.
  • One event loop per process; never nest or mix loops.

Read the full file on GitHub · 137 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. 2d ago First seen · 137 lines · 60 tokens per session scan A 4501a9b42668

Subscribe to this mod's changes

language-python is a skill published in the GitHub repository lugassawan/swe-workbench (2 stars, last pushed today), licensed MIT. It adds 60 tokens to every session and 1,273 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 2 findings (makes network calls, runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

functions-development

Build serverless Go or Python functions for Falcon Foundry apps. TRIGGER when user asks to "create a function", "write a serverless function", "build backend logic", runs foundry functions create, or needs help with FDK handler patterns, function testing, or collection integration from functions. Also TRIGGER when…

CrowdStrike/foundry-skills · 195 tokens

Python Clean Architecture

This skill should be used when the user asks to "scaffold a FastAPI project", "set up clean architecture", "refactor to clean architecture", "add a new endpoint", "add a router", "add an operation", "add a repository", "review my code structure", "apply design patterns in Python", "decouple my code", "improve code…

MKToronto/python-clean-architecture · 112 tokens

fastapi

FastAPI best practices and conventions. Use when working with FastAPI APIs and Pydantic models for them. Keeps FastAPI code clean and up to date with the latest features and patterns, updated with new versions. Write new code or refactor and update old code.

ReflexioAI/claude-smart · 57 tokens

update-public-docs

Update public API reference docs to match Python source code. Compares client.py, schema files, and config models against MDX docs and fixes any gaps. Triggers on: update docs, sync docs, update public docs, update api reference, refresh documentation.

ReflexioAI/claude-smart · 57 tokens

cloudflare-workers-multi-lang

Multi-language Workers development with Rust, Python, and WebAssembly. Use when building Workers in languages other than JavaScript/TypeScript, or when integrating WASM modules for performance-critical code.

secondsky/claude-skills · 45 tokens

language-idioms-refiner

Facilitate a structured conversation to define language-specific idioms and patterns for a repository. Produces a language-idioms.md document consumed by multiple atoms to adapt pseudocode defaults to the project's language. Use when setting up a new project, switching languages, or when the user says 'setup…

techygarg/lattice · 92 tokens