python-anti-patterns

Reviews Python code against a checklist of common anti-patterns and their fixes.

Updated Apr 23, 2026
One-click install
npx skills add https://github.com/SanketAdlak/PDMProjectDesign --skill python-anti-patterns-sanketadlak
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-anti-patterns
Source: https://github.com/SanketAdlak/PDMProjectDesign/tree/main/.agents/skills/python-anti-patterns
Command: npx skills add https://github.com/SanketAdlak/PDMProjectDesign --skill python-anti-patterns-sanketadlak

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Python codebases often accumulate subtle bad practices—bare exception handlers, blocking calls in async code, hard-coded secrets, mixed I/O and business logic—that cause bugs, outages, and maintenance pain. This Skill provides a structured checklist to catch these issues during code review, before merge, or while debugging. ## Core Features & Use Cases - Categorized Anti-Pattern Reference: Covers infrastructure, architecture, error handling, resource management, type safety, and testing anti-patterns, each with BAD/GOOD code examples. - Quick Review Checklist: A 14-point checklist to run through before finalizing implementations or merging pull requests. - Fix Summary Table: Maps each anti-pattern to its concrete remediation, such as centralized retry decorators, Pydantic validation, repository pattern, and context managers. - Use Case: Before merging a pull request, run through the checklist to verify there are no bare except blocks, no blocking calls in async functions, and that all public functions have type hints. ## Quick Start Review my Python code for common anti-patterns and list any issues found with recommended fixes.

Frequently Asked Questions about python-anti-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I review Python code for common anti-patterns?

Use a categorized checklist covering infrastructure, architecture, error handling, resources, type safety, and testing. Compare your code against known BAD patterns like bare except blocks, hard-coded config, and blocking calls in async functions, then apply the documented fixes.

What are the most common Python error handling mistakes?

The most common mistakes are bare `except Exception: pass` blocks that silently swallow bugs, ignoring partial failures in batch processing, and missing input validation at API boundaries. Fix these by catching specific exceptions, returning BatchResult objects, and validating with Pydantic.

Why does my async Python code run slowly?

Blocking calls like `time.sleep()` or synchronous `requests.get()` inside async functions freeze the entire event loop. Replace them with `asyncio.sleep()` and async-native libraries like httpx.AsyncClient to restore concurrency.

Should I retry failed requests at multiple layers in Python?

No. Double retry—where both the application and the HTTP client retry—multiplies attempts and can amplify outages. Retry at exactly one layer and know your infrastructure's built-in retry behavior before adding your own.

When should I not use this anti-pattern checklist?

This checklist focuses on what to avoid, not positive design guidance. For architecture and design pattern recommendations, use a dedicated design patterns resource instead. It also does not replace automated linters or type checkers.