Prevent cognitive debt by manually retyping LLM-generated code
3 hours ago
- Using LLM coding assistants for one-shot features leaves the author unsatisfied and disoriented, but they still use them for boring parts.
- Allowing the assistant to freely roam creates cognitive debt; the author wants to understand the code, not just offload it.
- Reviewing AI-generated PRs is not enjoyable due to overly-defensive, badly-commented, and subtly incorrect code.
- The author's solution is to have the LLM generate code in chat and then manually type every line into the editor.
- Manually typing builds a mental model of the code, helps detect hallucinations and bad design, and allows for cleanup and refactoring.
- This workflow creates a spatial map of the codebase, aiding future changes and better prompting of the LLM.
- The approach is slower (2x instead of 10x) but prioritizes comprehension over productivity.
- The author compares this to the traditional advice of never copying and pasting code when learning.
- The author fears the industry is accumulating cognitive debt that will need to be paid back soon.