python-best-practices

Review Python code for import organization, async-first design, and pytest conventions.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/christophevg/c3 --skill python-best-practices-christophevg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-best-practices
Source: https://github.com/christophevg/c3/tree/main/skills/python
Command: npx skills add https://github.com/christophevg/c3 --skill python-best-practices-christophevg

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It prevents common Python code quality and security mistakes by providing consistent, repeatable best-practice guidance during day-to-day development.

Core Features & Use Cases

  • Consistent formatting & structure: Enforces a predictable style (2-space indentation, imports at the top, no inline imports).
  • Correct import organization: Promotes fully qualified imports and proper __init__.py re-exports to avoid ImportError-class problems.
  • Maintainable design & testing patterns: Recommends parameterization, configuration grouping via classes, pytest conventions, and async-first architecture; also covers security-safe error handling and credential logging rules.

Use case examples:

  • A developer refactoring a Python service wants fewer regressions by following established module/import patterns and async-safe testing guidance.
  • A team standardizes how new endpoints, clients, and tests are written to reduce security leaks (like logging secrets) and improve test reliability.

Quick Start

Ask the AI: “Review my Python change for best practices in indentation, imports, error handling, async-first design, and pytest patterns, and return a concise checklist of fixes.”

Frequently Asked Questions about python-best-practices

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

FAQPage Schema
What are the best practices for organizing Python imports to avoid ImportError?

Python import best practices enforce top-level, fully qualified module imports and proper `__init__.py` re-exports to prevent ImportError-class problems and ensure module maintainability across editing sessions.

How do I review my Python code for security and credential logging mistakes?

Review Python code for security by checking that internal errors are not exposed and credentials are never logged. Apply guarded security practices during development to prevent common credential leaks and ensure safe error handling.

What is the best way to structure Python tests using pytest conventions?

The best way to structure Python tests is following pytest conventions, utilizing parameterization and configuration grouping via classes to improve test reliability and maintain consistent testing strategies across your codebase.

Does this Python best practices guidance apply to async-first architecture?

Yes, this Python best practices guidance applies to async-first architecture by recommending specific async-safe testing guidance and architectural patterns that reduce regressions when refactoring Python services.

How do I standardize Python code formatting and indentation for a team?

Standardize Python code formatting by enforcing a predictable style with 2-space indentation, top-level imports, and no inline imports to ensure consistent structure and maintainability across team development workflows.