Prevent cognitive debt by manually retyping LLM-generated code – insights from Hacker News discussion
Prevent cognitive debt by manually retyping LLM-generated code
Ankur Sethi avoids cognitive debt in his personal projects by asking LLMs to generate code in chat and then typing every line himself, rather than letting the model edit files directly.
The Problem of Cognitive Debt with LLMs
Using LLMs to one‑shot entire features leaves the author unsatisfied and disoriented, and reviewing AI‑generated pull requests is not enjoyable. He fears the industry is accumulating cognitive debt that will have to be repaid soon.
I fear the software industry is taking on a large amount of cognitive debt that we'll have to pay back very soon. There will come a time when we no longer understand how large parts of our digital infrastructure are put together. I might not personally be able to change the course of the entire industry, but I can at least make sure I completely understand the software I put out into the world. Anything else would be professional malpractice.
The Manual Retyping Workflow
The author gives the LLM explicit instructions to only show proposed edits and commands in chat, never to modify the repository.
I want to understand every line of code that goes into this project. Never create, edit, move, rename, or delete project files unless I explicitly ask you to do so. Instead, show me every proposed edit in the chat so I can type it in manually.
Do not run commands that modify project files, install dependencies, or change repository state unless I explicitly request that action. Instead, show me those commands in the chat so I can run them manually.
I'm an experienced developer. Do not explain syntax, APIs, programming concepts, or implementation details unless explicitly asked.
By typing each line, he builds a mental model of how the code fits into the existing codebase, can look up unfamiliar APIs, and detects hallucinations or bad design choices.
As I manually type every single line of LLM generated code into my editor, I build up a mental model of how it works and fits into my existing codebase. If I don't understand an API or algorithm, I can stop to look it stop to look it up, or just ask the LLM to explain it.
Typing the code myself forces me to slow down, which means I'm more likely to detect hallucinations or bad design choices the LLM might have made. I can clean up the code as I go, reorganizing it, refactoring it, adding comments, and generally adapting it to my own taste.
This workflow also creates a spatial map of the codebase, making future changes and prompting the LLM easier.
Benefits of Manual Typing
The author finds the approach slower than fully delegating to the LLM (about 2× speedup instead of 10×) but values deeper understanding over raw productivity.
Using LLMs this way allows me to work faster than not using LLMs at all, but I'm still slower than those who are willing to allow the machine to think for them. Instead of being 10x faster, I'm probably only 2x faster. But what I lose out on in terms of speed, I gain in terms of a deeper understanding of my code.
He likens the practice to the traditional advice of typing out examples from books or forums when learning to program.
Manually typing LLM‑generated into my codebase feels like the exact same learning process. It might not be the most efficient way to work with an LLM, but I value comprehension over productivity.
Community Reactions
Commenters on Hacker News expressed a range of views, from support to criticism, and suggested alternative strategies.
Supportive or analogous practices
- @wahern: "Good advice yesterday, good advice today, and good advice tomorrow. … Typing out code manually gives you time and space to consider the broader picture."
- @bandrami: "As an aside, back in the days of Stack Exchange I would always type out manually whatever answer I found to make sure I understood WTF I was adding to the system."
- @andai: "The Zed Shaw method!"
- @FailMore: mentions using SmallDocs to stay in touch with LLM‑produced code.
- @sltr: cites the generation effect as a reason typing improves knowledge retention.
- @twoquestions: "This is what I'm doing right now to learn Electron, I essentially had Opus write me a tutorial to write the application I want to have, and I'm modifying bits and pieces as I go."
Critiques of the approach
- @npras1: "Big no for retyping llm generated code by hand. But a big yes for still typing code by hand, and not leaving it to the llm. Except it has to be the code generated by your brain."
- @estebarb: quotes an arxiv paper: "When students rely on these outputs as a substitute for their own reasoning or critical engagement, the learning process is fundamentally compromised. Genuine learning requires the active construction of meaning, integration of knowledge, and reflective engagement with content."
- @f311a: "This does not sound fun. It's better to work on your side projects with manual coding. You will learn more. Retyping things is inefficient for learning. It's like trying to retype calculus solutions — you don't learn from it."
- @petcat: "This is just a miserable career of 'paint‑by‑number' because people can't be bothered to have a creative thought about their professional work or programming hobbies."
- @a2128: "As someone who, at a point, would copy homework from someone else, copy book reports from online, and use the answer sheets to complete assignments, I can tell you this strategy is long known to accumulate and not prevent cognitive debt."
Alternative suggestions
- @smegma2: "Seems like an ok solution, but what about doing something like the opposite? Write out the scaffolding and general shape of the code (classes, interfaces, function signatures), and have the LLM fill it in."
- @reacweb: "Generate code using LLM on a small project, then copy manually toward your big project."
- @overthenexttwod: argues that outsourcing thinking to an LLM yields a weaker mental model than writing the code yourself, and suggests treating LLMs as independent agents to steer rather than as productivity boosters.
- @jruz: describes downgrading to a $20 plan and asking questions without letting the LLM write code.
Conclusion
The author’s manual retyping method aims to preserve understanding while still benefiting from LLM assistance for boring tasks. Hacker News discussion shows the technique resonates with some as a modern take on traditional learning‑by‑typing, while others view it as inefficient or unnecessary, proposing instead to write code personally and use LLMs only for review, scaffolding, or question‑answering.
Sources
Related
- Dispatch
- Dispatch
- Dispatch
- Dispatch
- Dispatch