Comprehensive development standards for Python projects emphasizing modern tooling, type safety, clean code practices, and English-only conventions with uv package management and ruff formatting.
Enforce strict development standards for Python projects with modern tooling, comprehensive type safety, and clean code practices.
**All content must be in English:**
**Indentation:**
**Naming Conventions:**
- `snake_case` for functions and variables
- `PascalCase` for classes
- `UPPER_SNAKE_CASE` for constants
**Package Management:**
**Code Quality:**
**Type Hints (Mandatory):**
```python
def process_data(input_file: pathlib.Path, max_items: int) -> list[str]:
return []
def process_data(input_file, max_items):
return []
```
**String Formatting:**
```python
name = "Alice"
age = 30
message = f"Hello {name}, you are {age} years old"
message = "Hello %s, you are %d years old" % (name, age)
message = "Hello {}, you are {} years old".format(name, age)
```
**Filesystem Operations:**
```python
from pathlib import Path
config_path = Path("config") / "settings.json"
if config_path.exists():
content = config_path.read_text()
import os
config_path = os.path.join("config", "settings.json")
if os.path.exists(config_path):
with open(config_path) as f:
content = f.read()
```
**Data Classes:**
```python
from dataclasses import dataclass
@dataclass
class User:
username: str
email: str
age: int
```
Comments should explain **WHY** the code exists, not **WHAT** it does. For complex logic, explain the "what" with examples.
**Core Principles:**
**Strictly Prohibited:**
**Examples:**
```python
TIMEOUT = 10
def add(a: int, b: int) -> int:
return a + b
TIMEOUT = 10
COMPLEX_REGEX = r',(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)'
def add(a: int, b: int) -> int:
return a + b
```
**Planning:**
**Testing:**
**Commits:**
**Test Organization:**
**Test Implementation:**
```python
from pathlib import Path
def test_svg_parser_basic():
"""Test basic SVG parsing functionality."""
svg_content = '<svg><circle r="10"/></svg>'
result = parse_svg(svg_content)
assert result.shapes[0].radius == 10
class TestAdvancedFeatures:
def test_nested_groups(self):
"""Test parsing of nested SVG groups."""
# Test implementation
pass
```
**Running Tests:**
**Test Data Sources:**
Use standard, well-documented SVG examples:
**Assertions:**
When working on this project:
1. ✅ Verify all code uses English for identifiers, comments, and strings
2. ✅ Confirm 2-space indentation throughout
3. ✅ Add type hints to all function signatures
4. ✅ Use f-strings for all string formatting
5. ✅ Use `pathlib` for all filesystem operations
6. ✅ Format code with `ruff` before committing
7. ✅ Write tests in `tests/` directory using pytest conventions
8. ✅ Run `uv run pytest` to verify tests pass
9. ✅ Write comments that explain "why", not "what"
10. ✅ Keep commits atomic and focused
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/python-project-development-guide/raw