python-code-style

Enforce Python method ordering, timezone-aware datetimes, and circular-import avoidance.

Updated Jan 25, 2026
One-click install
npx skills add https://github.com/gestrich/python-architecture --skill python-code-style
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: python-code-style
Source: https://github.com/gestrich/python-architecture/tree/main/plugin/skills/python-code-style
Command: npx skills add https://github.com/gestrich/python-architecture --skill python-code-style

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Python codebases often drift into inconsistent layouts, making maintenance harder. This Skill provides a cohesive set of conventions for organizing service classes and modules, ensuring readable APIs, reliable datetimes, and safe imports.

Core Features & Use Cases

  • Standard Method Organization: enforce the recommended order (special methods, class/static methods, public, private) to improve readability and onboarding.
  • Timezone-Aware Datetimes: promote timezone-aware datetimes and eliminate naive timestamps across the codebase.
  • Circular Import Avoidance: guide refactors to remove one-way dependencies and reduce import-time issues.
  • Modern Type Annotations: encourage typing techniques like Self, future annotations, and clean type hints in interfaces and dataclasses.
  • Module-Level Organization: apply structured module patterns for dataclasses, public APIs, and utilities.

Quick Start

Start by inspecting a Python module and reorganize its class and functions to follow the recommended method ordering, convert naive datetimes to timezone-aware ones, and remove circular imports.

Frequently Asked Questions about python-code-style

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is the recommended method ordering for Python service classes?▼

Python service classes should follow a standard method order: special methods, class methods, static methods, public API methods, and private helpers. This ordering improves readability and onboarding.

How do I avoid circular imports when refactoring Python modules?▼

To avoid circular imports in Python modules, guide refactors to remove one-way dependencies and reduce import-time issues. This ensures safe imports across the codebase.

Why should I use timezone-aware datetimes in Python?▼

Timezone-aware datetimes in Python eliminate naive timestamps across the codebase, ensuring reliable datetime operations. This promotes consistent and safe time handling in services.

How do I apply modern type annotations in Python dataclasses and interfaces?▼

Modern type annotations in Python use techniques like Self and __future__ annotations to provide clean type hints in interfaces and dataclasses. This ensures consistent typing across modules.

What's the best way to organize Python modules for maintainability?▼

The best way to organize Python modules is applying structured patterns for dataclasses, public APIs, and utilities. This provides a cohesive set of conventions for clean, maintainable services.

Does this Python code style convention require any external dependencies?▼

No, this Python code style convention requires no external dependencies. It provides examples and patterns directly to enforce functional requirements like method ordering and type annotations.