Hacker News new | ask | show | jobs
by sum1ren 658 days ago
When I'm using genai to write some code for me, I lose the internal mental state of what my code is doing.

As such, when I do have to debug problems myself, or dream up ideas of improvements, I no longer can do this properly due to lack of internal mental state.

Wonder how people who have used genai coding successfully get around this?

3 comments

I use Claude and there's a couple things I'd suggest.

1) You need to be the boss with the AI being your assistant. You are now a project manager coming up with strict requirements of what you'd like done. Your developer (AI) needs context, constraints and needs to be told exactly what you'd like created without necessarily diving into the technical details.

2) Planning - you need to have a high level plan of roughly how you'd like to structure your code. Think of it like you're drawing the outline and AI is filling in the gaps.

3) Separation of concerns - use software principles to drive your code design. Break problems down into separate components, AI is good at filling in components that are well defined.

Once you change your thinking to a higher level, then you can maintain flow state. Of course the AI isn't perfect and will make mistakes - you do need to question it as you go. The more creative you become with a solution the harder time the AI will have and sometimes you'll have to break out and fix things up yourself.

For me it's a huge productivity boost.

Go over the code again and again like you would if you'd written it yourself. Keep iterating on the code yourself without having the AI generate everything. In a current project I have everything internalised because I'm constantly going through the code and improving upon it myself (and using the AI to do boilerplate), even though much of it was initially generated. I'll still have the AI generate code in plenty of places, but I don't let it take over the thinking for me unless I'm unsure about something, then I ask it for possible solutions and ideas, then I go over those solutions myself.
This is the problem I have with it. It breaks me out of the flow state that’s so important to writing good code.