python-coding

Enforce modern Python coding conventions for documentation, style, logging, and imports.

Updated Mar 17, 2023
One-click install
npx skills add https://github.com/IainMcl/dotfiles --skill python-coding-iainmcl
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-coding
Source: https://github.com/IainMcl/dotfiles/tree/main/claude/skills/python-coding
Command: npx skills add https://github.com/IainMcl/dotfiles --skill python-coding-iainmcl

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers adhere to modern Python coding conventions, improving code readability, maintainability, and reducing errors.

Core Features & Use Cases

  • Documentation Standards: Enforces docstrings and type hints for clarity.
  • Modern Syntax: Promotes the use of f-strings and modern type hinting syntax.
  • Logging Best Practices: Guides on effective logging, especially for exceptions and context.
  • Module Import Organization: Recommends top-level imports for cleaner code structure.
  • Use Case: When writing a new Python function, consult this Skill to ensure it includes a clear docstring and appropriate type hints. When refactoring existing code, use it to identify opportunities to adopt f-strings and improve logging.

Quick Start

Ensure all new Python functions include a docstring and type hints.

Frequently Asked Questions about python-coding

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

FAQPage Schema
What are modern Python coding conventions for functions?

Python coding conventions enforce documentation standards through clear docstrings and type hints. They also promote modern syntax like f-strings and structured logging to improve code readability and maintainability across software development workflows.

How do I enforce type hinting and docstrings in Python code?

You enforce type hinting and docstrings by applying modern Python coding conventions to your development workflow. This involves requiring adherence to best practices for function documentation, modern type hinting syntax, and structured logging before code is finalized.

What is the best way to organize module imports in Python?

The best way to organize module imports in Python is to place them at the top level of your scripts. Modern Python conventions recommend top-level imports to ensure a cleaner code structure and improve overall readability.

How do I implement structured logging for Python exceptions?

Implement structured logging for Python exceptions by following logging best practices that capture effective context. Modern conventions guide developers on how to log exceptions properly, ensuring maintainable and readable code during error handling.

When should I refactor existing Python code to use f-strings?

You should refactor existing Python code to use f-strings when adopting modern Python coding conventions. Refactoring provides an opportunity to replace older formatting methods, identify improvements, and align your codebase with current best practices.