Python Patterns
Idiomatic Python patterns covering type hints, error handling, context managers, and comprehensions for maintainable code.
- CCM score
- 64 of 100
- skills.sh installs
- 15.6K
- GitHub stars
- 312.6K
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers readability, explicit configuration, and EAFP-style exception handling as core principles for writing and reviewing Python
- Includes type hint guidance for Python 3.9+ built-in generics, type aliases, TypeVar, and Protocol-based duck typing
- Enforces specific exception handling over bare
except, with exception chaining viafromand custom exception hierarchies - Designed for writing, refactoring, and reviewing Python code where idiomatic structure, typing, or PEP 8 is in question
Install
$ npx -y skills add affaan-m/ecc --skill python-patterns -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
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.
Details
- Repository
- github.com/affaan-m/ecc
- Categories
- Python, Code Review & Quality
- First seen
- Jul 14, 2026
Questions
What does the python-patterns skill do for Python developers?
The python-patterns skill brings Pythonic idioms, PEP 8 standards, type hints, and best practices to Python code, covering readability, EAFP exception handling, context managers, comprehensions and generators, and data classes. It is meant for writing, reviewing, and refactoring Python code and for designing Python packages and modules.
Where does python-patterns rank among Python skills?
On the Python category page, python-patterns ranks in the top 10 Python skills. Other skills in the category include python-performance-optimization, python-design-patterns, async-python-patterns, python-code-style, and uv-package-manager.
How do I install the python-patterns skill?
Run npx -y skills add affaan-m/ecc --skill python-patterns -y in your project to install it. Once installed, the agent can apply these Python patterns when you write or review code, especially when idiomatic structure, typing, or PEP 8 is in question.
More from affaan-m/ecc
All 257- Springboot Patterns15.5K
- Api Design15.3K
- Market Research15.3K
- Postgres Patterns15.2K
- Frontend Slides15.2K
- Django Patterns15.2K
- Tdd Workflow15K
- Rust Testing14.8K
- Prompt Optimizer14.5K
- Java Coding Standards14.5K
- Django Security14.4K
- Python Testing14.3K
- Laravel Security14.3K
- Android Clean Architecture14.3K
- Article Writing14.3K
- Cpp Coding Standards14.3K
- Springboot Security14.2K
- Liquid Glass Design14.2K
- Database Migrations14.1K
- E2e Testing14.1K
- Strategic Compact14K
- Laravel Patterns13.8K
- Verification Loop13.6K
- Codebase Onboarding13.6K
Similar to Python Patterns
More Pythonpython-expertpersonamanagmentlayer/pcl278 installsExpert Python guidance covering Python 3.12+ idioms, async/await, type hints, and common design patterns.
python-best-practicesalleneubank/claude-code2.2K installsType-first Python idioms that make illegal states unrepresentable, plus exception chaining, logging, and type checker choices.
python-anti-patternswshobson/agents14.3K installsChecklist of common Python anti-patterns, with a fix for each, to review before merging or finalizing code.
pythonmindrally/skills1.1K installsBroad Python guidance covering style, data analysis, web frameworks, error handling, and performance.
error-handlingaffaan-m/ecc9.1K installsPatterns for typed errors, retries, circuit breakers, and user-facing failure messages across TypeScript, Python, and Go.
python-type-safetywshobson/agents13.6K installsPython type-safety guidance covering type hints, generics, protocols, and strict mypy or pyright checking.