affaan-m avatar

Python Patterns

This one's your copilot for writing Python that doesn't make other developers wince. It pushes you toward PEP 8, type hints, and idiomatic patterns like EAFP over LBYL. You get concrete examples of dataclasses, context managers, proper exception chaining, and when to use generators instead of building massive lists in memory. Activate it when writing new code, reviewing PRs, or refactoring legacy stuff. The guidance is opinionated in a good way, preferring explicit over clever and readability over showing off. It won't turn bad code into good code automatically, but it'll nudge you toward patterns that age well.

skills.sh installs
6.7K
GitHub stars
300.3K
last updated
Aug 21, 2026

Install

$ npx -y skills add affaan-m/ecc --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/ecc
Category
Python
First seen
Jul 14, 2026

More from affaan-m/ecc

All 263

Recommended

More Python
1affaan-m avatardjango-securityaffaan-m/everything-claude-codedjango security6.5Kskills.sh installs
2affaan-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
3pydantic 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
4affaan-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
5vintasoftware 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
6affaan-m avatardjango-verificationaffaan-m/everything-claude-codedjango verification5.4Kskills.sh installs