Prevent cognitive debt by manually retyping LLM-generated code
Article URL: https://ankursethi.com/blog/prevent-cognitive-debt-by-manually-retyping-llm-generated-code/ Comments URL: https://news.ycombinator.com/item?id=49153374 Points: 253 # Comments: 210
Despite my previous statements in April, I continue to utilize coding assistants on my personal projects. While I find one-shotting entire features unfulfilling and disorienting, I appreciate their utility in swiftly progressing through monotonous aspects of my projects. However, allowing my coding assistant unrestricted access to my projects results in an overwhelming amount of cognitive debt.
I may dislike the prospect of meticulously studying the Django documentation to comprehend how to incorporate tagging into my website, but I still desire a fundamental understanding of its underlying workings. Although I could review each line of code generated by the LLM, this is what most developers are presumed to do in the year 2026.
Robots submit pull requests; humans review them. It is a novel era. Yet, I do not relish reviewing AI-generated pull requests. Trudging through hundreds of lines of overly-defensive, poorly-commented, subtly erroneous code is not an enjoyable endeavor. I may reluctantly perform this task for an employer—ensuring they become an ex-employer as soon as possible—but I certainly won't do it for my personal projects.
The pleasure derived from personal projects stems from the process, not the outcome. Therefore, what course should I take? How can I harness the power of LLMs without surrendering control of my work and cognition to the machine? My solution, albeit inefficient and perhaps comical, involves instructing my coding assistant to generate code in the chat, then manually adjusting it myself.
I have integrated these instructions into all the agent files within my personal projects: Adopting this approach enables me to work at a pace comparable to utilizing LLMs, yet I am slower than those who are content to let the machine think for them. Rather than being 10 times faster, I am likely merely 2 times faster. Although I sacrifice speed for a more profound understanding of my code, I gain in terms of comprehension.
As I manually input each line of LLM-generated code into my editor, I construct a mental model of how it operates and integrates with my existing codebase. If I am unclear about an API or algorithm, I can pause to research it or simply ask the LLM to clarify. Typing the code myself compels me to slow down, which enhances my likelihood of identifying hallucinations or inadequate design choices made by the LLM.
I can refine the code as I go, restructuring it, refactoring it, incorporating comments, and adapting it to my own preferences. Crucially, this workflow facilitates the development of a spatial map of my codebase. I am familiar with where every functionality resides within the codebase. When I need to make modifications, I know precisely where to implement them.
This method not only boosts my efficiency within my projects but also aids in better prompting and instructing the LLM in the future. Having employed this workflow for several months, it has proven beneficial for me. I intend to continue using this approach as long as feasible. I am apprehensive about the software industry amassing a substantial amount of cognitive debt that we will eventually need to repay.
At some point, we may struggle to comprehend how significant portions of our digital infrastructure are constructed. While I may not personally possess the ability to alter the trajectory of the entire industry, I can ensure that I fully grasp the software I release into the world. Anything less would constitute professional negligence.
Written by urgent.news from Hacker News Best's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.
This story
This is one outlet's version. Read the fullest account.
