Python Style

Apply Python best practices when reviewing or writing code, including PEP 8, type annotations, docstrings, and common anti-patterns to avoid. Use when this capability is needed.

tomevault-io Updated

File contents

Python Style Skill

Apply Python best practices when reviewing or writing code.

Style Guidelines

  • Follow PEP 8 for formatting
  • Use type annotations for all public functions (PEP 484)
  • Write docstrings for public APIs (PEP 257)
  • Prefer f-strings over .format() or % formatting

Common Issues to Flag

  • Missing type annotations on public functions
  • Mutable default arguments (def foo(items=[]))
  • Bare except clauses (except: instead of except Exception:)
  • Using assert for validation (stripped in optimized mode)

References


Converted and distributed by TomeVault — claim your Tome and manage your conversions.

tomevault-io/skills-registry/tree/main/weakincentives--weakincentives--python-style commit 3e2749e71c

Frequently asked questions

npx skillmds@latest add tomevault-io/python-style-3