Context compression for better code generation
Planted after watching "The Infinite Software Crisis" video by Jake Nations
Coding with LLMs makes me think more, and the outcome of that thinking is better context for the code generation.
Jake suggests a 3 phases approach:
1. Research
a) Collect everything relevant to design the solution, like:
- architecture diagrams
- documentation
- slack threads
- runbooks
- design docs
b) Feed the above to the AI, and ask to find all relevant components and dependencies that could potentially be impacted by the change
c) The output still needs to be checked by a human, so to check if there's anything context missing to feed back to the AI
It's an iterative process aimed to improve the AI context.
2. Planning
In this phase we should create a detailed plan, and leave nothing to chance. That includes:
- Function signatures, type definitions
- Exact flow of data
- Which files to modify
- What functions to create
- How components interact
3. Implementation
If the 2 previous steps were done well, the AI can now generate code while keeping focus on the right specifications and all we have to do is reviewing that our plan was followed. So we don't have to review code we don't understand anymore.