AI assistant specialized in Python development following Bitsec-AI practices with strict preservation of documentation, comprehensive testing, and AI-friendly coding standards
A specialized Python development assistant that enforces Bitsec-AI coding standards, emphasizing comprehensive documentation preservation, robust error handling, type safety, and AI-friendly practices.
This skill guides development with the following priorities:
1. **Configuration Management**: Use environment variables for all configuration
2. **Robust Error Handling**: Comprehensive error handling with context capture and logging
3. **Comprehensive Testing**: Use pytest and pytest plugins exclusively (never unittest)
4. **Detailed Documentation**: Complete docstrings (PEP 257) and README files
5. **AI-Friendly Coding**: Clear, well-annotated code optimized for AI-assisted development
**ABSOLUTE REQUIREMENTS - NEVER VIOLATE:**
Example:
```python
def process_data(input: str, max_retries: int = 3) -> dict[str, any]:
"""Process input data with retry logic."""
pass
```
Example:
```python
def calculate_metrics(data: list[dict]) -> dict[str, float]:
"""
Calculate performance metrics from input data.
Args:
data: List of dictionaries containing raw measurement data
Returns:
Dictionary containing calculated metrics with metric names as keys
Raises:
ValueError: If data list is empty or contains invalid entries
"""
pass
```
Example:
```python
def test_process_valid_data() -> None:
"""
Test that process_data correctly handles valid input.
Verifies that the function returns expected output format
and all required fields are present.
"""
result = process_data("valid_input")
assert isinstance(result, dict)
assert "status" in result
```
Example:
```python
import logging
logger = logging.getLogger(__name__)
def risky_operation(param: str) -> bool:
"""Execute operation with comprehensive error handling."""
try:
logger.info(f"Starting operation with param: {param}")
# operation logic
logger.debug("Operation completed successfully")
return True
except ValueError as e:
logger.error(f"Invalid parameter value: {param}", exc_info=True)
raise
except Exception as e:
logger.error(f"Unexpected error in operation: {e}", exc_info=True)
raise
```
Before completing any task, verify:
1. **Read existing code** - Understand current structure and documentation
2. **Preserve documentation** - Never delete comments, docstrings, or logging
3. **Add type annotations** - Ensure all code is fully typed
4. **Write/update docstrings** - Follow PEP 257 for significant changes
5. **Implement changes** - Apply requested modifications
6. **Add tests** - Create pytest tests with full annotations
7. **Verify preservation** - Confirm no documentation was removed
This skill is optimized for AI-assisted development with a strong emphasis on maintainability, clarity, and comprehensive documentation. The absolute prohibition on deleting comments, docstrings, logging, and other documentation ensures that codebases remain well-documented and traceable over time.
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/python-development-with-bitsec-standards/raw