python-anti-patterns

python-anti-patterns is a skill for Claude Code, Codex from julianobarbosa/claude-code-skills. It costs 39 tokens per session (2,117 once invoked), scanned A, a copy of python-anti-patterns, MIT.

A checklist of common Python anti-patterns, meaning code patterns that often make software harder to maintain or more likely to fail. It focuses on mistakes to avoid during development and review.

In plain words
What is it for?
Use it when reviewing, refactoring, debugging, teaching, or setting Python coding standards.
Why use it?
It helps reveal repeated design problems, debugging traps, and maintainability issues before they become harder to fix.

Skill for Claude CodeCodex

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

Good fit Use it when reviewing, refactoring, debugging, teaching, or setting Python coding standards.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/julianobarbosa/claude-code-skills/python-anti-patterns
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 julianobarbosa/claude-code-skills --skill python-anti-patterns
Clone the repo
git clone --depth 1 https://github.com/julianobarbosa/claude-code-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-anti-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/julianobarbosa/claude-code-skills/python-anti-patterns.svg)](https://agentmods.dev/skills/julianobarbosa/claude-code-skills/python-anti-patterns)
Your own site
<a href="https://agentmods.dev/skills/julianobarbosa/claude-code-skills/python-anti-patterns"><img src="https://agentmods.dev/badge/skills/julianobarbosa/claude-code-skills/python-anti-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 39 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,117 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin 86% copy Near-identical to another mod 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.00039 $0.02117
Opus 5 $0.00019 $0.01059
Sonnet 5 $0.00008 $0.00423
Haiku 4.5 $0.00004 $0.00212

Measured 4d ago against content hash dbaf6f5f1c81, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

python-anti-patterns 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 4d 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.

return requests.get(url, timeout=30)
Origin

This is a copy

86% identical to python-anti-patterns — 12 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

skills/python-anti-patterns/SKILL.md · 360 lines

How it starts

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

Python Anti-Patterns Checklist

A reference checklist of common mistakes and anti-patterns in Python code. Review this before finalizing implementations to catch issues early.

When to Use This Skill

  • Reviewing code before merge
  • Debugging mysterious issues
  • Teaching or learning Python best practices
  • Establishing team coding standards
  • Refactoring legacy code

Note: This skill focuses on what to avoid. For guidance on positive patterns and architecture, see the python-design-patterns skill.

Infrastructure Anti-Patterns

Scattered Timeout/Retry Logic

# BAD: Timeout logic duplicated everywhere
def fetch_user(user_id):
    try:
        return requests.get(url, timeout=30)
    except Timeout:
        logger.warning("Timeout fetching user")
        return None

def fetch_orders(user_id):
    try:
        return requests.get(url, timeout=30)
    except Timeout:
        logger.warning("Timeout fetching orders")
        return None

Fix: Centralize in decorators or client wrappers.

# GOOD: Centralized retry logic
@retry(stop=stop_after_attempt(3), wait=wait_exponential())
def http_get(url: str) -> Response:
    return requests.get(url, timeout=30)

Double Retry

# BAD: Retrying at multiple layers
@retry(max_attempts=3)  # Application retry
def call_service():
    return client.request()  # Client also has retry configured!

Fix: Retry at one layer only. Know your infrastructure's retry behavior.

Hard-Coded Configuration

# BAD: Secrets and config in code
DB_HOST = "prod-db.example.com"
API_KEY = "sk-12345"

def connect():
    return psycopg.connect(f"host={DB_HOST}...")

Fix: Use environment variables with typed settings.

# GOOD
from pydantic_settings import BaseSettings

class Settings(BaseSettings):
    db_host: str = Field(alias="DB_HOST")
    api_key: str = Field(alias="API_KEY")

settings = Settings()

Architecture Anti-Patterns

Exposed Internal Types

Read the full file on GitHub · 360 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. 4d ago First seen · 360 lines · 39 tokens per session scan A dbaf6f5f1c81

Subscribe to this mod's changes

python-anti-patterns is a skill published in the GitHub repository julianobarbosa/claude-code-skills (10 stars, last pushed 12d ago), licensed MIT. It adds 39 tokens to every session and 2,117 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). It is 86% identical to python-anti-patterns, differing in 12 lines, and is treated as a copy.

Related

Other skills, from other repositories

mcore-linting-and-formatting

Linting and formatting for Megatron-LM. Covers running autoformat.sh, tools (ruff, black, isort, pylint, mypy), and code style rules.

NVIDIA/skills · 44 tokens

plankton-code-quality

Write-time code quality enforcement using Plankton — auto-formatting, linting, and Claude-powered fixes on every file edit via hooks.

loulanyue/awesome-claude-notes · 34 tokens

code-review-python

Provides Python-specific code review rules for the dh code-reviewer agent. Activates on pyproject.toml or .py file detection — enforces uv, ruff, ty, pytest, type annotation, error handling, and Python 3.11+ idioms including pathlib, match statements, and modern union syntax.

Jamie-BitFlight/claude_skills · 68 tokens

adversarial-python

Use this skill to gate Python code (floors 3.10+, rules verified through 3.14) with a pass/fail adversarial review — a single blind reviewer subagent judges a diff or file set against 20 decidable rules hunting two failure modes. First, code modern Python makes unnecessary — branch ladders over match/registries…

pproenca/dot-skills · 224 tokens

verify-language

Language-specific verification for Python, TypeScript/JavaScript, and Go. Checks type safety, language idioms, and best practices. Use when asked to "verify language", "check types", or for language-specific checks.

Aurite-ai/agent-verifier · 48 tokens

python-services

Python patterns for CLI tools, async parallelism, and backend services. Use when building CLI apps, async/parallel Python, FastAPI services, background jobs, or configuring Python project tooling (uv, ruff, ty).

iliaal/whetstone · 48 tokens