python

Standardize Python typing, FastAPI patterns, and coding conventions across a codebase.

Updated May 15, 2021
One-click install
npx skills add https://github.com/JustinFirsching/dotfiles --skill python-justinfirsching
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python
Source: https://github.com/JustinFirsching/dotfiles/tree/main/opencode/.config/opencode/skill/python
Command: npx skills add https://github.com/JustinFirsching/dotfiles --skill python-justinfirsching

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Helps Python teams adopt consistent coding conventions, robust typing, and scalable FastAPI patterns to reduce bugs and improve readability.

Core Features & Use Cases

  • No Mutable Default Arguments: avoids common pitfalls by using None defaults and initialization.
  • No Wildcard Imports: encourages explicit imports for clarity and maintainability.
  • Use logging, Not print: promotes structured logging over ad-hoc prints.
  • No global Keyword: advocates explicit state management to improve testability.
  • Always Use Type Hints for Function Signatures: enforces explicit type information for better tooling.
  • FastAPI Patterns: provides guidance on routing, Pydantic models, DI, and error handling for API services.

Quick Start

Audit a Python project for typing discipline, and FastAPI patterns, then generate a set of concrete improvements.

Frequently Asked Questions about python

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

FAQPage Schema
How do I standardize Python coding conventions and type hints across a codebase?

To standardize Python coding conventions and type hints, enforce explicit type information for function signatures, avoid mutable default arguments, and eliminate wildcard imports. This improves code readability and reduces bugs.

What is the best way to structure routing and dependency injection in FastAPI?

The best way to structure FastAPI patterns involves applying specific guidelines for routing, Pydantic models, dependency injection, and error handling. This ensures scalable API services and consistent code quality.

Why should I use logging instead of print statements in Python projects?

You should use logging instead of print statements in Python projects to promote structured logging over ad-hoc prints. This approach enhances debugging, state management, and overall testability by avoiding the global keyword.

Does this Python typing guidance work with asynchronous patterns and FastAPI?

Yes, this Python typing guidance works with asynchronous patterns and FastAPI. It delivers concrete examples and practical rules for improving type hints, routing, and dependency injection specifically for asynchronous API design.

How do I audit an existing Python project for typing discipline and FastAPI patterns?

To audit a Python project for typing discipline and FastAPI patterns, generate a set of concrete improvements. This process checks for explicit type hints, proper routing structures, and standard coding conventions.

When should I avoid mutable default arguments and wildcard imports in Python?

You should avoid mutable default arguments and wildcard imports in Python when initializing functions to prevent common pitfalls. Using None defaults and explicit imports ensures clarity, maintainability, and robust typing practices.