logoalt Hacker News

Prevent cognitive debt by manually retyping LLM-generated code

334 pointsby mpweihertoday at 9:32 AM280 commentsview on HN

Comments

npras1today at 1:00 PM

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.

That is what will create new neurons and new connections, which is what will keep away the cognitive decline.

And the constraint of not having to use llms will enhance creativity.

Actually, the constraints llms add to your code are more in number than the former. llms code in only the specific ways they've been trained on. So you won't ever come across of other ways.

Off the top of my head.. here's RubyQuiz.com [0] which I came across when I was learning ruby more than a decade ago. Looking at the many user-submitted solutions (you have to download the zip file!) you'll see completely different ways the problems were solved.

Sure, many won't be deemed efficient or standard by today's llm or rubocop checks, but looking at their code.. and retyping them and seeing them work.. was crucial in how I was able to think in Ruby for solving coding problems.

I did the same with Go too, with the "learn go with tests" guide [1].

[0] - http://rubyquiz.com/

[1] - https://quii.gitbook.io/learn-go-with-tests

show 10 replies
estebarbtoday at 12:35 PM

This will cause cognitive debt anyway. As mentioned in https://arxiv.org/pdf/2509.21972v1: "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. These processes cannot occur through passive consumption of syntactically correct but semantically hollow responses. Without this deeper cognitive work, learners risk mistaking linguistic fluency for understanding, thereby undermining the very goals of education".

Personally, I don't think we will ever be able to reconcile using LLMs and cognitive debt. Even before LLMs we were aware if it: we knew people moving to managerial/PM roles eventually get their coding skills rusted. Well, now we are all in those managerial roles...

show 3 replies
f311atoday at 10:49 AM

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. Even if there is an explanation of why the code is written in such a way, you did not come up with it, and you don't know alternative solutions. It is a practice for memorizing, not for building your intuition.

A better option is to write it yourself first and ask LLMs for better options. They are pretty good at it, especially when you need to optimize hot loops.

show 15 replies
jesse_dot_idtoday at 8:52 PM

In the life of the LLM, we're still in the phase where we're all on the floor playing with these toys. It's strange to assume cognitive debt is an absolute outcome in this new paradigm of engineering when nobody really knows what the future holds. Personally, I feel like I have more time to think, not less, but that's also just my experience. Part of the fun of this is that we're all science experiments right now.

I'm just kind of enjoying the feeling of riding on the swell of a gigantic wave for once instead of feeling like I'm starting from behind it.

waherntoday at 10:26 AM

Good advice yesterday, good advice today, and good advice tomorrow.

I don't remember if I read this advice or just intuited it myself (perhaps after some hard lessons), but it's a programming habit I've kept for as long as I can remember (I started coding in the 90s). If I feel rushed, e.g. someone looking over my shoulder, and I copy+paste something, it always leaves me with a sense of unease. It creates a memory & comprehension hole that sticks out like a sore thumb, even for seemingly simple snippets. You can't really be sure it's simple without stepping through it carefully, and simple can be deceptive because it's usually the interactions and assumptions wrt surrounding code that lead to surprises. Typing out code manually gives you time and space to consider the broader picture.

WhyComboNadirtoday at 2:47 PM

Lots of reactions here, but if it works for you then that's great.

For me I feel that LLMs have exploded (in a good way) my cognitive capabilities. I'm now the general of an army, rather than playing the role of a soldier. Of course that means that I lose the experience of being the lonely soldier, but it is a no-brainer tradeoff for me.

Anyway, I have to go now so I can push my car to the grocery store (so I don't forget how to walk), me and my giant calves will be back in a few hours.

All meant in good spirit. Keep doing what you're doing, thanks for sharing, and hope people are kind and only give good natured ribbings.

show 5 replies
bodashtoday at 8:52 PM

Similar to where we simply ask LLM to leave 20% of the work undone: humantodo.dev

jruztoday at 10:21 AM

What I did is kinda similar, I downgraded to $20 plan and just ask questions and almost never let it write the code, and if I can I use the web ui like the good old days and not spend my CLI tokens.

mahamitoday at 3:22 PM

In my love(?)-hate relationship with "vibecoding", even I tried this approach. For a while it worked, though that "while" didn't last as long as the months OOP has been riding this wave. Though, the vibes have usually been off, so I wish I could keep both thinking of and writing that code which adds negligibly to shareholder value. I say "wish" because a part of me has definitely been hijacked, in much the same way as the addictive type of social media. Sometimes I feel like I need a serious intervention.

show 1 reply
bandramitoday at 10:39 AM

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.

show 1 reply
PlayerTootoday at 7:51 PM

I am currently betting on LLMs being significally better than even top engineers with good 'taste' within the next 5 years so I am focused on learning how to drive AI better. Anyone thing I should alter my apporoach/thinkig?How?

bztzttoday at 8:47 PM

this is how I did "AI coding" (for unfamiliar languages/frameworks/etc.) back in the GPT-3.5/4 days. Except I'd also test each line to verify it actually did what I thought it did.

a2128today at 11:13 AM

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

show 5 replies
petcattoday at 11:04 AM

> manually retyping LLM-generated code

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.

Software developers think that they are being clever with these kinds of strategies to "keep their skills sharp", but unfortunately the entire industry knows about this, and especially the upper management who are already eliminating these assembly line, JIRA-ticket-taker software jobs en masse.

show 2 replies
blitzartoday at 12:13 PM

Sounds like a devious plan to turn me from a self diagnosed 10x developer (& Founder, CEO, Serial Entrepreneur) into a plain old 1x regular Joe.

daun_geetoday at 10:09 AM

This is a new form of prayer for those who can't break their religious addiction to LLM code generators.

show 1 reply
summarybottoday at 5:48 PM

Pretty crazy idea. I know I sometimes just "wave through the motions" when I'm taking notes.

For example, when I am reading a book, I often take notes of my favorite quotes/sentences/things that stick out or perk up my ears. Usually if I own the book or it's a used copy of mine I make a note of the page number on the very last blank page(s) and write out the full sentence/quote. Then when I go back months or years later I just open to the last page and can find all my favorite/important quotes. Most 200 page books typically have ~20 useful sentences for me to reference [going forward] - it's basically like making your own index or table of contents.

That long aside, just to say, if I'm not "very aware" or "consciously mindful" of what I'm copying down or writing, I'm able to do it very well on autopilot without etching anything into my memory -- as if no recallable moment gets etched into the wet cement of the brain unless I'm actively "hip to it." I wonder if others have this "autopilot" problem.

overthenexttwodtoday at 4:54 PM

I share the author's sentiment. I also think it's important to fully understand a codebase I own. So much is naturally lost when you let LLMs generate code for you, and the mental model of what the added code does is one of the biggest losses. When you write code by hand, you build that model as you go, and it's enormously helpful later - when adding a feature, or when debugging behavior you didn't expect.

I've been trying to address this by telling LLMs primarily how the code should be structured, rather than only what it should do. Still, any design I hand to an LLM will be underspecified in one way or another (if it were fully specified, it would just be code), and the LLM fills those gaps somehow - which adds to the cognitive debt, slowly but surely.

Retyping LLM-generated code is an interesting solution. You'd certainly end up understanding the generated code better than if you merely reviewed it, but I doubt it produces a mental model as reliable as the one you'd build writing the code yourself. The longer you think, the better your mental model gets - and outsourcing the thinking to an LLM means thinking less.

That said, I've started to wonder whether I'm solving the wrong problem. Should I really insist on an accurate mental model of the code I own? We'd find it strange for a non-engineering manager to try to fully understand every piece of code their reports produce. If that's the right analogy, then as LLMs' agentic capabilities improve, maybe we should stop treating LLMs as tools that boost our own productivity as a software engineer and start treating them as independent agents we manage and steer.

Mike-Kelnertoday at 6:14 PM

I've been asked several times how I use AI. My answer is - pretty much the same way I worked with developers on my team. I give a task, review the result for a reasonable amount of time - which might be close to zero for a minor front-end change - and then either accept it, change it myself, or ask for revisions.

That approach works well for me, so why would I retype AI-generated code? I wouldn't do that with code written by another developer, and their code can be just as buggy or weird in theory. You could argue that at least the developer knows how it works. That's true - for a week, a month, or a few years if you're lucky. Until he forgets or leaves.

AndreiCalazanstoday at 12:55 PM

It seems to me this is the same problem we previously had: how do we understand codebases we didn't write?

Creating while writing allowed us to build a mental context but in a unproductive way, it never scalled.

I believe we need to move onto a new way of reading codebases that go beyond reading line by line.

I know people have explored representing code in 3D spaces. I don't know the solution. But I believe that is the problem.

show 1 reply
dataviz1000today at 2:39 PM

Do mathematicians and physicists put away the calculator and computer (this always reminds me of the last scene from Star Wars) and do the computation by hand? A physicist isn't going to manually invert a 10,000x10,000 matrix.

Exactly as we don't write machine code letting the compiler do that, now and in the near future we won't be writing high level programming language code. We are moving towards working on a higher level of abstraction.

When I ask a frontier model to write a loop 10 different ways in Python and TypeScript and test the performance of each using a 1,000,000 iterations, it isn't creating cognitive debt. For the time being, I'm still racking my brain asking the question, how does garbage collection affect the performance.

show 1 reply
FailMoretoday at 1:22 PM

I empathise with this. I run a little open source project called SmallDocs [1][2] which Claude/Coding Agent invokes to generate easily human readable Markdown documents (and render code files).

You can ask Claude to "sdoc me an annotated code walkthrough of this MR" and it will produce something like this:

https://smalldocs.org/s/Ju9GOmWZ0JXTtzqCVfgt1q#k=6HBrpcCjIu7...

I use this a lot to stay in touch with the code the LLM is producing.

[1] https://smalldocs.org [2] https://github.com/espressoplease/smalldocs

show 1 reply
r0ze-at-hntoday at 11:03 AM

When I was younger and took over a codebase I open it up in one window and then type it back into another window. Not only did I catch/fix a crazy number of bugs, but I became a near expert overnight. Doing the typing would cause me to question everything, ask why we import something, why x is used and not y, etc.

I also tried where I would print out the code (with color) and then go read it with a red pen. Faster and similar results of forcing me to be able to read it enough to be "an editor" to the code.

And I have done the same for LLM-generated code and text, back in '23 this meant more taking their so-so output and then turning it into my own, but between now and then come up with a number of techniques to improve the AI output to more acceptable out of the gate so more learning than being inspired.

These are good techniques as it causes your own brain to rapidly learn the material, but no matter how good it is I have never met anyone else that does it so the real ponderable is assuming that everyone else doesn't do this and what does that mean?

nuneztoday at 3:07 PM

> 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 up, or just ask the LLM to explain it.

This is part of how I learned how to code! Well, sans LLMs. Instead of copypasta-ing code blocks from books, Expert Sexchange and Stack Overflow, I manually retyped everything, looked up what I didn't understand and changed what I could.

K0nservtoday at 10:43 AM

I'm taking a slightly different approach. I've started a project where I intentionally don't use agentic coding. I use LLMs for researcher and to learn, but write all the code by hand.

The goal is to maintain the taste, for lack of a better word, that I've developed over decades of programming.

Claude put me on to the concept "Étude", so I've taken to calling it my Étude project.

yktoday at 11:51 AM

Related, a writing advice I stole from Neal Stephenson is to write the first draft by hand. The thing is, there are a lot of small corrections where you kinda should change the text but nah, and if you already committed to copy the entire thing than you are already working at that sentence anyhow.

alex7otoday at 6:50 PM

To be honest I am thinking of an entirly different situation, ask the llm to create Red tests for you. Then implement them yourself. You don't waste time writing tests but you still need to spec what you implement properly so the llm can write good tests for it

sltrtoday at 11:12 AM

I am also worried about "cognitive debt". I hardly remember what I had Claude do, even hours later. Back in May, I advised of a similar mitigation, citing the "generation effect" as the reason typing the code would make you remember it better:

> For your next ticket or feature, engage with your LLM as you normally would to produce a design and implementation plan, but with that plan in hand, make the mechanical edits yourself...You can expect this to improve your knowledge retention compared to merely reading a diff. You want to go slower now so that later you can go at all.

https://www.slater.dev/2026/05/type-your-code/

vavooomtoday at 5:32 PM

What's the right middle ground approach to this? I agree that inevitably my more advanced software approaches at work have been compromised by reliance on LLMs, especially given encouragement from management. Are there specific prompts/instructions people find that allow for learning and iterative development without slowing down the actual development cycle too much? I want to keep learning and keep my skills sharp but it feels like a losing battle.

show 2 replies
androiddrewtoday at 5:31 PM

So I always make sure I take a crack at doing what I want first. Then I ask for an AI review and it usually has a more efficient way to get the job done.

For example I had a working linear decay velocity boost function added to a godot scene and it's suggested refactoring actually reduced lines of code just today. So kind of happy when that works out, but yes I also applied the changes manually so I would grok them and hopefully remember it better.

1shoonertoday at 3:03 PM

This is really the distinction between the mentality of a technical manager and an individual contributor.

Managers never got to write and internalize every line of code anyway. Arguably their essential skill is producing useful stuff without needing to do so. So is that 'cognitive debt'? When I use an agent to code, I do the same things: I validate the direction, organization, and core decisions, but delegate the details. It's an intentional calculation of risk, managing the scope of future problems if there's a failure of implementation somewhere.

It's a question of where you put the value of cognitive focus. I don't understand 'line by line' how my car's ICE works, even though it will likely impact me at some point, because while I might be able to fix it myself if it breaks, the likely applied solution will be to delegate that work anyway.

jmartricantoday at 5:15 PM

In highschool, my history teacher's home work assignments were to write out the notes he created and handed out for us. Essentially the assignments were to read chapters from the text-book, then copy the notes by hand and hand them in. It seemed odd. But I think their is some wisdom to it. As you writing it out, you are slowly reading what you are writing... even if you do not mean to.

ozgrakkurttoday at 10:24 AM

You are cooked if you can’t actually write better code than llm. Try reading some books or documentation

show 4 replies
Kim_Bruningtoday at 11:06 AM

Manually typing in code is an underappreciated trick in a lot of circumstances. It's one of the fastest ways to get to grips with a certain piece of code, a new library, or some methodology.

This was true when I first learned to program, and is still true today. And I do find myself manually typing in really critical code. In those cases even if I do have an LLM alongside these days, LLM suggestions also then get manually typed.

twoquestionstoday at 12:29 PM

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. It's been enlightening thus far, and the bot isn't always right so I still need to look up documentation on occasion.

reacwebtoday at 2:00 PM

Generate code using LLM on a small project, then copy manually toward your big project. This reduces the context (and the cost) for the LLM and gives you many small projects where you can experiment ideas with more agility.

pton_xdtoday at 3:26 PM

Retyping LLM code sounds absolutely miserable and soul crushing. Like hand copying the HTML produced by page generators... why would you do that to yourself.

jspdowntoday at 11:12 AM

I never had so little free time as I have these days. Most of my time is spent at work or with my lovely family.Love my family, and work is great.

The thing is that, probably like many of you, I love going deep in a side project, even if it lands nowhere. With so little time, working on them has become a very frustrating activity.

This is where I found my trap... do more with very little time by delegating to an LLM. You get dopamine shots, the feeling of achieving something but the cognitive dept is just crazy. So much that the activity becomes almost meaning less. After couple of months doing this, I'm not even sure it's a good use of this time. I get very little satisfaction on the long run.

I don't have a solution to this problem, not even sure there one. I think I have to accept that this is an activity that takes time, and only time gives the real gratification.

_benjtoday at 11:28 AM

This resonates with me. The concept of cig it I've debt was something I've been experiencing but didn't have a name for it.

I think it is worth noting that not all code is equal... One could argue that adding a library is in some ways similar to copy/pasting code in as much as, one doesn't know what the code is doing, and yet that doesn't leave me with a sense of unease!

So it might be that as I'm working with an LLM there are parts (boring, as the author calls them) that are not worth "knowing" how they work, something uninteresting or that a correct output is all that us needed, I'm totally fine having the agent write that code, but the sections I need to know how they work, I think it might make sense to write those by hand!

show 1 reply
cleverKnighttoday at 7:58 PM

> 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.

"professional malpractice" LOL. This is so dumb. I can't believe this shit is getting upvoted.

Velocifyertoday at 5:28 PM

I simply never ask LLMs questions specific to my codebase (except for finding what function/file does something, because that is annoying), and instead use generic questions.

m4xptoday at 11:03 AM

Hard disagree, it's proven that its the actual discovery process that's makes us improve at tasks. Blindly typing will make you just good at typing.

I do think there is absolutely no way a learner should be using ai for code generation. I think code analysis is the only acceptable usecase.

smegma2today at 4:27 PM

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. That seems more important for understanding.

4b11b4today at 5:13 PM

Hah I was just thinking I should switch to colemak that I only let myself continue with for 2 months and re-type out all the domain (types, etc) for this project I'm working on

risingsubmarinetoday at 11:33 AM

I've used LLMs in a similar way and I'm reminded of learning to draw / paint.

At the very beginning stages you might be tempted to trace over an image but this builds a very shallow understanding. Instead you should quickly move onto replicating work you admire by sight. Consider the form, volume and values, conceptualise them in your mind and try to apply them in whatever medium you are using. This helps form your own mental model of the process. Eventually you can start using those techniques on original works.

I'm currently rethinking language learning too in a similar manner. Comprehensible input, shadowing. That sort of thing.

throwthrowuknowtoday at 11:00 AM

Pair programming with the LLM is a better approach. You can take either role and even take turns. It’s slower but gives ample time to read everything and push back on decisions or receive feedback and review on your own decisions.

Greenpantstoday at 11:23 AM

Alternatively, what I tend to do after receiving generated code is a lot of asking "why?".

I've learned things I wouldn't otherwise have learned because I hadn't considered using the tools the LLM recommends. It's also a way to eliminate some hallucinating, given that critical questions are posed as unbiased as possible. For that, I also like to open a new chat with a different model and asking open-ended questions about a recommended tool I don't know much about, to double-check that the original LLM was likely correct in its recommendation in the first place.

sandovertoday at 4:37 PM

Print this article out and put it in the scrapbook.

File next to that 1970's era classic, "Prevent cognitive debt by manually retyping compiler-generated assembler"

witxtoday at 10:41 AM

We're living in such a stupid time.

show 1 reply

🔗 View 50 more comments