Python Programming Guidelines
Paste the following prompt into your AI chat to install this skill:
Please install @user_f12a44b7/self-dev-python according to https://skillhub.cn/install/skillhub.md.
About this skill
Problem
Python code can run locally but still drift in style, dependencies, language version, and test coverage after review. This skill turns Python coding guidelines into concrete checks instead of linking to PEP 8 alone.
How It Works
It organizes the work around a pre-commit loop: validate syntax with py_compile, run focused pytest tests, and prefer Python 3.10+ features such as match statements, the walrus operator, and type hints. Dependency handling checks for uv first and falls back to pip, with project isolation through a virtual environment. Style rules cover 4-space indentation, snake_case functions and variables, PascalCase classes, UPPER_CASE constants, and import ordering by stdlib, third-party, and local groups. Common patterns include docstrings, pathlib, context managers, and f-strings.
Boundaries
The guidance is best for new projects and shared repositories where Python 3.10+ is supported. It does not replace architecture, performance tuning, or security audits; teams that require strict PEP 8 line length of 79 should treat the 88-character default as a Black-style convention.
Use Cases
- Set import order, naming, and indentation for a new Python repository to match PEP 8.
- Before a PR, verify Python 3.10+ features, type hints, and focused pytest unit tests.
- Choose a uv or pip virtual environment for data scripts and handle I/O with pathlib and context managers.
- Run py_compile and pytest before commit to catch hardcoded secrets and mutable default arguments.
Best For
- Engineers maintaining Python utility libraries who need consistent naming, imports, and testing.
- Backend developers reviewing LLM-generated code against PEP 8 and Python 3.10+ features.
- Engineers maintaining data pipelines who want standards for dependencies, I/O, type hints, and pre-commit checks.
- Open-source contributors who need a checklist for pytest, docstrings, and anti-patterns before review.
Related Skills
A one-shot coding agent built on Claude Code CLI that runs non-interactively, supports a specified workdir, and can be monitored in the foreground or background.
Preview and confirm file sorting by extension, with recursive cleanup, ignore rules, and transactional rollback.
An engineering assistant for static HTML/CSS/JS pages, design-token extraction, IE8-compatible review, and structured delivery.
An engineering workflow for requirement analysis, scenario modeling, risk planning, quality gates, testing, and knowledge capture, with lightweight, standard, and full modes.