Always externalize configuration values rather than hardcoding them directly in the code. This improves maintainability, enables easier configuration changes, and ensures consistency across the codebase.
Key practices:
Example:
# Instead of this:
main_system = """Act as an expert software developer."""
# Do this:
from . import prompt_manager
yaml_prompt_entry = prompt_manager.get_prompt_value('ComponentName', 'main_system')
# And when reading files, respect user configuration:
# Instead of:
with open(file_path, 'r', encoding='utf-8') as file:
content = file.read()
# Use utilities that honor user settings:
content = io.read_text(file_path) # Respects --encoding setting
This approach makes the codebase more flexible, easier to maintain, and respectful of user-defined settings.
Enter the URL of a public GitHub repository