Enforces snake_case naming, PascalCase classes, docstrings, 79-char lines, list comprehensions, and comprehensive test coverage with edge case validation.
Enforces Python coding standards with snake_case naming, PascalCase classes, comprehensive docstrings, 79-character line limits, list comprehensions, and rigorous code review practices including test coverage and edge case validation.
When writing or reviewing Python code, follow these guidelines:
1. **Naming Conventions**
- Use `snake_case` for all variable and function names
- Use `PascalCase` (UpperCamelCase) for all class names
- Choose meaningful, descriptive names based on usage
2. **Documentation**
- Include docstrings for all functions and classes
- Docstrings should describe purpose, parameters, and return values
3. **Code Formatting**
- Limit all lines to 79 characters maximum
- Break long lines appropriately while maintaining readability
4. **Python Idioms**
- Prefer list comprehensions over traditional loops when creating lists
- Avoid global variables; use function parameters and return values instead
5. **Code Clarity**
- Provide inline comments explaining complex code sections
- Keep logic clear and maintainable
When reviewing code, ensure:
1. **Test Coverage**
- All functions have appropriate test coverage
- Tests cover normal operation and edge cases
2. **Input Validation**
- Validate all user inputs to prevent invalid states
- Handle boundary conditions properly
3. **Edge Cases**
- Check for edge cases specific to the domain (e.g., winning conditions, draw scenarios)
- Ensure all possible code paths are tested
4. **Code Quality**
- Code is free of runtime errors and warnings
- Logic is properly separated from user interface concerns
- No global variables are used
```python
def CalculateTotal(Items):
Total = 0
for item in Items:
Total += item['price']
return Total
```
```python
def calculate_total(items):
"""
Calculate the total price of all items.
Args:
items: List of dictionaries containing item information with 'price' key
Returns:
float: Sum of all item prices
"""
return sum(item['price'] for item in items)
```
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/python-style-guide-enforcer/raw