python-standards

Enforce PEP 8, strict type hints, and pathlib in Python 3.11+ code.

Updated Jan 4, 2025
One-click install
npx skills add https://github.com/PorkChopExpress86/TaxProtest-Django --skill python-standards-porkchopexpress86
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-standards
Source: https://github.com/PorkChopExpress86/TaxProtest-Django/tree/main/.agent/skills/python-statndards
Command: npx skills add https://github.com/PorkChopExpress86/TaxProtest-Django --skill python-standards-porkchopexpress86

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill enforces rigorous Python coding standards, ensuring code is type-safe, maintainable, and adheres to modern best practices, preventing common errors and improving collaboration.

Core Features & Use Cases

  • Strict Type Hinting: Mandates type hints for all functions and attributes using modern Python syntax (str | None, list[int]).
  • Pathlib Enforcement: Replaces os.path.join with pathlib.Path for robust path manipulation.
  • Data Structure Standardization: Promotes pydantic.BaseModel or @dataclass over raw dictionaries.
  • Use Case: When writing new Python modules or refactoring existing ones, this Skill ensures adherence to these standards, leading to more reliable and understandable codebases.

Quick Start

Apply modern type hinting and pathlib to the provided Python script.

Frequently Asked Questions about python-standards

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

FAQPage Schema
How do I enforce strict type hinting and PEP 8 standards when refactoring Python code?

Enforce strict type hinting and PEP 8 standards by mandating modern Python 3.11+ syntax like `str | None` and `list[int]` for all functions and attributes, ensuring production-grade, type-safe, and maintainable codebases.

What is the best way to replace os.path.join with pathlib for robust path handling in Python?

The best way to replace `os.path.join` with pathlib for robust path handling is to enforce `pathlib.Path` for all path manipulation, ensuring modern Python conventions and preventing common path-related errors in production environments.

When should I use pydantic BaseModel or dataclasses instead of raw dictionaries in Python?

You should use `pydantic.BaseModel` or `@dataclass` instead of raw dictionaries to standardize data structures, ensuring type safety, data validation, and improved maintainability across your Python modules.

Does modern Python 3.11+ syntax support type-safe coding standards for production environments?

Yes, modern Python 3.11+ syntax supports type-safe coding standards for production environments by enabling strict type hinting using modern conventions like `str | None` and `list[int]`, which prevents common errors and improves collaboration.

How do I write production-grade Python code that adheres to authoritative coding standards?

Write production-grade Python code by adhering to authoritative coding standards that mandate strict type hinting, enforce `pathlib.Path` for path handling, and promote `pydantic.BaseModel` or `@dataclass` over raw dictionaries for robust data structures.