I built a dev agent to reduce code debt in Python repositories. For now, it does one thing very well: adding docstrings to Python classes and methods. It also adds unit tests, though this feature is still a work in progress.
# Why?
As AI becomes more integrated into development workflows, code debt will only accumulate faster. Refactoring takes time, and no one has time to focus solely on reducing code debt.
# Approach
While there are many developer tools available, our approach combines language models with deterministic tools to minimize the risk of hallucinations. Specifically, we use: - LibCST: A reliable parser and serializer for Python, ensuring that Ambrogio always generates a valid Python syntax tree. - Interrogate: A docstring coverage tool that helps verify improvements and maintain high standards. - Coverage and Pytest: We identify uncovered lines and test the generated unit tests until they run successfully.
The goal is to make it so robust and stable that it can automatically pick and resolve tech debt tasks.
# Try It
If you have a GitHub open-source repo, you can simply visit https://ambrogio-platform.streamlit.app/ and submit your repository. In a few minutes, you’ll receive a pull request directly on GitHub. (no API key needed or registration)
Installation
- pip install ambrogio
Docstring generation:
ambrogio
Unit tests generation:
ambrogio --mode coverage
It supports all models provided by LiteLLM.
# Feedback & Discussion
I’d love to hear your thoughts on this approach. Do you see pitfalls? What features would be most helpful for you? How do you currently handle tech debt refactoring?
Thanks for any feedback you can provide!
— Raoul Scalise