Generating incremental code

Hello,
I’m trying to refactor and improve some legacy code by using agents: my idea was to have a Crew identify how to improve the code and rewrite it to be more extensible.

I was pretty successful in getting to generate a good decomposition of responsabilities and create some skeleton code of all the classes and methods to be implemented but I’m now stuck trying to figure out the best strategy to generate not only the skeleton but runnable code: I tried to generate one full file in a single shot and, whereas it succeed for smaller files, it usually fails because of the LLM context being too small. Is there any strategy and/or suggestion about how I might be trying to solve this?

I feel what you’re looking for is Cursor. You have a 14-day free trial. I’m not saying this couldn’t be done with CrewAI, but you’re reinventing the wheel.

Thanks for your reply, @rokbenko . I know the specific problem of code generation can be solved with specific tools but, what I’m trying to do here, is finding a solution that works in different use cases. I mentioned the code refactoring example but I had the very same problem with generating a long text where I had only the outline of specific paragraphs and I wanted to expand them to be complete. Is there any way of achieving this using Crews?