1---2name: neo-python3description: Use this skill when writing, reviewing, debugging, or architecting Python 3.10+ code, including type hints, structural pattern matching, dataclasses, async/task groups, packaging-aware project structure, testability, and maintainability.4---56# Python 3.10+ Expert Skill78## Trigger On9- The user asks to write, debug, review, or refactor Python code.10- Working in a repository containing `*.py`, `pyproject.toml`, `requirements.txt`, `Pipfile`, or `poetry.lock`.11- Requires asynchronous programming (`asyncio`), type hinting, or modern Python feature recommendations.12- The project needs setup for testing frameworks (`pytest`) or static analysis tools (`ruff`, `mypy`).1314## Workflow151. **Perceive:**16 - Inspect the project root to identify package management tools: `pyproject.toml` (Poetry/PDM/Ruff), `requirements.txt` (pip), or `environment.yml` (Conda).17 - Probe for Python version requirements (ensure compatibility with 3.10+ minimum).18 - Identify the application type: Web API (FastAPI, Flask, Django), Data Science (Pandas, PyTorch), or CLI tools.192. **Reason:**20 - Evaluate if the current code follows modern Python (3.10+) idioms (e.g., `match/case`, `|` union types).21 - Decide if type checking (MyPy/Pyright) or auto-formatting (Ruff/Black) needs to be introduced.22 - Recommend appropriate architectural patterns based on project scale.233. **Act:**24 - Write Python code with complete Type Hints, prioritizing the `X | Y` syntax.25 - Prefer modern language features: `match` statements (3.10+), `TaskGroup` (3.11+), and new generic syntax (3.12+).26 - Ensure code passes static analysis and unit tests.2728## Coding Standards29- **Type Hinting:** Strongly recommended for all function signatures. Use 3.10+ union syntax like `list[int | str]`.30- **PEP 8 Compliance:** Follow official style guidelines. Recommended to use `ruff` as a linter and formatter for consistency.31- **Async Processing:** Use 3.11+ `asyncio.TaskGroup` to manage concurrent tasks.32- **Error Handling:** Use specific exception types and leverage 3.11+ `ExceptionGroup` and `except*` syntax.3334## Tooling Recommendations35- **Linter / Formatter:** `ruff` (high performance and highly integrated).36- **Type Checker:** `mypy` or `pyright`.37- **Testing:** `pytest` with `pytest-asyncio` or `pytest-cov`.38- **Package Management:** `Poetry` or `uv` to ensure dependency locking and environment consistency.3940## Deliver41- **Code Quality Report:** Identify parts that do not comply with 3.10+ modern syntax or PEP 8.42- **Best Practice Recommendations:** Provide specific refactoring suggestions, such as converting complex logic into `match/case` structures.43- **Validated Code:** Provide Python source code accompanied by test cases and passed type checks.4445## Validate46- Code must run in a Python 3.10+ environment.47- Functions should have Docstrings (following Google or NumPy styles).48- Complex logic should include unit tests.49- All public APIs should have complete type hints.5051## Documentation52### Official References53- [Python 3 Official Documentation](https://docs.python.org/3/)54### Internal References55- [Modern Python syntax evolution (3.10-3.14) and PEP 8 naming conventions](reference/coding-style.md)56- [Recommended modern Python 3.10 - 3.14 development patterns and best practices](reference/patterns.md)57- [Outdated Python practices to avoid, common pitfalls, and security traps](reference/anti-patterns.md)58- [Intelligent detection and management of Python project virtual environments and dependency tools](../neo-python-manager/SKILL.md)