The python-patterns skill provides developers with idiomatic Python conventions, type hints, and best practices for writing robust, maintainable code aligned with PEP 8 standards. It guides Python developers writing, reviewing, or refactoring code by emphasizing readability, explicit logic, and Python-preferred patterns like EAFP exception handling. The skill addresses the need for consistent, high-quality Python development by documenting core principles and modern techniques including type annotations, type aliases, and protocol-based typing.

skills.sh installs
7K
GitHub stars
229.1K
last updated
Jul 14, 2026

Install

$ npx -y skills add affaan-m/everything-claude-code --skill python-patterns --agent claude-code

Installs into .claude/skills of the current project.

Files

Python Development Patterns

Idiomatic Python patterns and best practices for building robust, efficient, and maintainable applications.

When to Activate

  • Writing new Python code
  • Reviewing Python code
  • Refactoring existing Python code
  • Designing Python packages/modules

Core Principles

1. Readability Counts

Python prioritizes readability. Code should be obvious and easy to understand.

# Good: Clear and readable
def get_active_users(users: list[User]) -> list[User]:
    """Return only active users from the provided list."""
    return [user for user in users if user.is_active]


# Bad: Clever but confusing
def get_active_users(u):
    return [x for x in u if x.a]

2. Explicit is Better Than Implicit

Avoid magic; be clear about what your code does.

# Good: Explicit configuration
import logging

logging.basicConfig(
    level=logging.INFO,
    format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)

# Bad: Hidden side effects
import some_module
some_module.setup()  # What does this do?

3. EAFP - Easier to Ask Forgiveness Than Permission

Python prefers exception handling over checking conditions.

Sponsors

Details

Repository
github.com/affaan-m/everything-claude-code
Category
Python

More from affaan-m/everything-claude-code

All 256

Recommended

More Python
1affaan-m avatarpython-patternsaffaan-m/eccPythonic idioms, PEP 8 standards, type hints, and best practices for building robust, efficient, and maintainable Python applications.6.7Kskills.sh installs
2affaan-m avatardjango-securityaffaan-m/everything-claude-codedjango security6.5Kskills.sh installs
3affaan-m avatardjango-patternsaffaan-m/eccDjango architecture patterns, REST API design with DRF, ORM best practices, caching, signals, middleware, and production-grade Django apps.6.2Kskills.sh installs
4pydantic avatarbuilding-pydantic-ai-agentspydantic/skillsBuild AI agents with Pydantic AI — tools, capabilities (including on-demand loading), structured output, streaming, testing, and multi-agent patterns. Use when 6.2Kskills.sh installs
5affaan-m avatardjango-securityaffaan-m/eccDjango security best practices, authentication, authorization, CSRF protection, SQL injection prevention, XSS prevention, and secure deployment configurations.6.1Kskills.sh installs
6vintasoftware avatardjango-expertvintasoftware/django-ai-pluginsExpert Django backend development guidance. Use when creating Django models, views, serializers, or APIs; debugging ORM queries or migrations; optimizing databa5.9Kskills.sh installs