python-idioms

python-idioms is a skill for Claude Code, Codex from Everyone-Needs-A-Copilot/claude-copilot. It costs 116 tokens per session (2,018 once invoked), scanned A, original, MIT.

Pythonic code patterns, anti-patterns, and quality rules — with deterministic AST-based anti-idiom detection for Python, Django, Flask, pytest, and pyproject.toml projects. Catches non-Pythonic patterns, PEP8 violations, type-hint gaps, and pre-commit quality issues. Use proactively when reviewing Python source files…

Skill for Claude CodeCodex

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/everyone-needs-a-copilot/claude-copilot/python-idioms
Any agent
npx skills add Everyone-Needs-A-Copilot/claude-copilot --skill python-idioms
Clone the repo
git clone --depth 1 https://github.com/Everyone-Needs-A-Copilot/claude-copilot

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-idioms

README.md
[![agentmods](https://agentmods.dev/badge/skills/everyone-needs-a-copilot/claude-copilot/python-idioms.svg)](https://agentmods.dev/skills/everyone-needs-a-copilot/claude-copilot/python-idioms)
Your own site
<a href="https://agentmods.dev/skills/everyone-needs-a-copilot/claude-copilot/python-idioms"><img src="https://agentmods.dev/badge/skills/everyone-needs-a-copilot/claude-copilot/python-idioms.svg" alt="Measured on agentmods" height="20"></a>
Per session 116 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,018 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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 $0.00116 $0.02018
Opus 5 $0.00058 $0.01009
Sonnet 5 $0.00023 $0.00404
Haiku 4.5 $0.00012 $0.00202

Measured today against content hash 6979cde8ab59, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

python-idioms scanned grade A with 1 finding 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 today.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/python_lint.py, scripts/test_python_lint.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.

Makes network callslowCapability

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

_cache[key] = fetch(key)
.claude/skills/code/python-idioms/SKILL.md · 327 lines

How it starts

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

Python Idioms

Pythonic patterns, anti-patterns, and quality rules for clean Python code.

Core Principles

Principle Description
Explicit > Implicit Clear, readable code over clever tricks
EAFP Easier to Ask Forgiveness than Permission
Duck Typing Focus on behavior, not types
Flat > Nested Avoid deep nesting

Patterns vs Anti-Patterns

List/Dict Comprehensions

# GOOD: List comprehension
squares = [x**2 for x in range(10) if x % 2 == 0]

# BAD: Manual loop for simple transforms
squares = []
for x in range(10):
    if x % 2 == 0:
        squares.append(x**2)

Context Managers

# GOOD: Context manager for resources
with open('file.txt') as f:
    content = f.read()

# BAD: Manual resource management
f = open('file.txt')
try:
    content = f.read()
finally:
    f.close()

Unpacking

# GOOD: Tuple unpacking
first, *rest, last = items
x, y = point

# BAD: Index access
first = items[0]
last = items[-1]
x = point[0]
y = point[1]

Iteration

# GOOD: Direct iteration
for item in items:
    process(item)

# GOOD: Enumerate when index needed
for i, item in enumerate(items):
    print(f"{i}: {item}")

# BAD: Range-based iteration
for i in range(len(items)):
    process(items[i])

Dictionary Operations

# GOOD: dict.get() with default
value = data.get('key', default_value)

# GOOD: setdefault for initialization
cache.setdefault(key, []).append(item)

# BAD: Check and access
if 'key' in data:
    value = data['key']
else:
    value = default_value

String Formatting

# GOOD: f-strings (Python 3.6+)
message = f"Hello, {name}! You have {count} items."

# OK: .format() for dynamic templates
template = "Hello, {name}!"
message = template.format(name=name)

# BAD: % formatting or concatenation
message = "Hello, " + name + "!"
message = "Hello, %s!" % name

Boolean Checks

# GOOD: Truthiness
if items:  # Not empty
if not items:  # Empty
if value is None:  # Explicit None check

# BAD: Explicit comparisons
if len(items) > 0:
if items != []:
if value == None:

Read the full file on GitHub · 327 lines

Files

What ships with it

2 files 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. today First seen · 327 lines · 116 tokens per session scan A 6979cde8ab59

Subscribe to this mod's changes

python-idioms is a skill published in the GitHub repository Everyone-Needs-A-Copilot/claude-copilot (13 stars, last pushed 10d ago), licensed MIT. It adds 116 tokens to every session and 2,018 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-04.

Related

Other skills, from other repositories

code-reviewer-python

Auto-route to this skill if project contains.

buiphucminhtam/forgewright · 4 tokens

py-clean-arch

Use this skill when the user asks about Clean Architecture in Python — not generic theory, but the specific layer conventions (l1entities, l2usecases, l3interfaceadapters, l4frameworksanddrivers), folder patterns, boundary interfaces, and .importlinter.ini contracts from CJHwong/py-clean-architecture-examples. Fetches…

CJHwong/py-clean-architecture-examples · 113 tokens

quality-gates

Use when assessing task complexity, before starting complex tasks, when stuck after multiple attempts, or reviewing code against best practices. Provides quality-gates scoring (1-5), escalation workflows, and pattern library management.

yonatangross/orchestkit · 46 tokens

flask-werkzeug-attack

Exploit Flask/Werkzeug debugger exposure for traceback and SECRET leaks.

uphiago/recon-skills · 22 tokens

django

Use when building, reviewing, securing, testing or shipping a Django app — models, migrations, QuerySets/managers, FBV/CBV views, forms, the admin, settings split, and Django REST Framework (serializers, ModelViewSet, permissions). NOT async FastAPI/Pydantic services (that is fastapi), NOT Postgres schema/index work…

ericrisco/rsc-harness · 84 tokens

broker-integration

Integrate a new Indian broker into OpenAlgo, or modify an existing broker plugin. Use when wiring up a broker's auth/login, orders, quotes, depth, history, funds, margin, symbol master, or WebSocket streaming; when a broker does not appear in the login dropdown or fails to load; or when debugging broker-specific…

marketcalls/openalgo · 85 tokens