Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
eyadsibai avatar

Python Patterns

  • 50 installs
  • 7 repo stars
  • Updated January 15, 2026
  • eyadsibai/ltk

Helps with python tasks.

About

python patterns is a Claude Code skill for python. It helps solo builders move faster with AI-assisted development.

  • python patterns
  • Python
  • AI-coding skill

Python Patterns by the numbers

  • 50 all-time installs (skills.sh)
  • Ranked #153 of 290 Python skills by installs in the Skillselion catalog
  • Data as of Jul 30, 2026 (Skillselion catalog sync)
npx skills add https://github.com/eyadsibai/ltk --skill python-patterns

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs50
repo stars7
Last updatedJanuary 15, 2026
Repositoryeyadsibai/ltk

What it does

Helps with python tasks.

Files

SKILL.mdMarkdownGitHub ↗

Python Patterns

Guidance for writing idiomatic, modern Python code.

Modern Python Features (3.9+)

FeaturePurposeKey Concept
Type hintsStatic analysisdef func(x: str) -> int:
DataclassesStructured dataAuto __init__, __repr__, etc.
Context managersResource cleanupwith statement guarantees cleanup
DecoratorsCross-cutting concernsWrap functions to add behavior
Async/awaitConcurrent I/ONon-blocking operations

---

Type Hints

Modern syntax (3.10+): Use | for unions, built-in types for generics.

OldModern
Optional[str]`str \
Union[str, int]`str \
List[str]list[str]
Dict[str, int]dict[str, int]

Key concept: Type hints are for tooling (mypy, IDEs) - no runtime enforcement.

---

Dataclasses vs Alternatives

UseFor
@dataclassMutable data with methods
@dataclass(frozen=True)Immutable, hashable
NamedTupleLightweight, tuple semantics
TypedDictDict with known keys
PydanticValidation, serialization

---

Context Managers

Use for any resource that needs cleanup: files, connections, locks, transactions.

Pattern: Acquire in __enter__, release in __exit__ (or use @contextmanager with yield)

---

Decorators

PatternUse Case
Simple decoratorLogging, timing
Decorator with argsConfigurable behavior
Class decoratorModify class definition
@functools.wrapsPreserve function metadata

---

Async Python

When to use: I/O-bound operations (HTTP requests, DB queries, file I/O)

When NOT to use: CPU-bound operations (use multiprocessing instead)

ConceptPurpose
async defDefine coroutine
awaitSuspend until complete
asyncio.gather()Run multiple concurrently
async withAsync context manager
async forAsync iteration

---

Pythonic Idioms

Instead ofUse
if len(x) > 0:if x:
for i in range(len(x)):for item in x: or enumerate()
d.has_key(k)k in d
try/if exists (LBYL)try/except (EAFP)
Manual swapa, b = b, a

---

Project Structure

my_project/
├── src/my_package/     # Source code
├── tests/              # Test files
├── pyproject.toml      # Project config
└── README.md

Key concept: Use src/ layout to prevent import confusion.

---

Tooling

ToolPurpose
ruffFast linter + formatter
mypyType checking
pytestTesting
uv/pipDependencies

Resources

  • Python docs: <https://docs.python.org/3/>
  • Real Python: <https://realpython.com/>

Related skills

Pythonbackend

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.