Live data from Hacker News

Ask HN: How can I get better at using AI for programming?

news.ycombinator.com

101–110 of 491 posts

Re: Ask HN: How can I get better at using AI for programming?

#101
post #44

Earlier quoted context omitted.

Try to keep it under 1k tokens or so. We will show you a warning if it might be too big. Ours is maybe half that size. We remove from it with every model release since smarter models need less hand-holding. You can also break up your CLAUDE.md into smaller files, link CLAUDE.mds, or lazy load them only when Claude works in nested dirs. https://code.claude.com/docs/en/memory

1k tokens, google says thats about 750 words. That's actually pretty short, any chance you could post a few samples of instructions or even link to a publicly available file CLAUDE.md you recommend?

That is seriously short. I've asked Claude Code to add instructions to CLAUDE.md and my one line request has resulted in tens of lines added to the file.

Re: Ask HN: How can I get better at using AI for programming?

#102
A largely undiscussed part of AI use in code is that it's actually neither easy nor intuitive to learn max effectiveness of your AI output.

I think there's a lot of value in using AIs that are dumb to learn what they fail at. The methods I learned using gpt3.5 for daily work still transaltes over to the most modern of AI work. It's easy to understand what makes AI fail on a function or two than understanding that across entire projects.

My main tips:

1. More input == lower quality

Simply put, the more you can focus your input data to output results the higher quality you will get.

For example on very difficult problems I will not only remove all comments but I will also remove all unrelated code and manually insert it for maximum focus.

Another way to describe this is compute over problem space. You are capped in compute so you must control your problem space.

2. AI output is a reflection of input tokens and therefore yourself.

If you don't know what you're doing in a project or are mentally "lazy" AI will fail with death by a thousand cuts. The absolute best use of AI is knowing EXACTLY what you want and describing it in as few words as possible. I directly notice if I feel lazy or tired in a day and rely heavily on the model I will often have to revert entire days of work due to terrible design.

3. Every bad step of results from an AI or your own design compound problems as you continue.

It's very difficult to know the limits of current AI methods. You should not be afraid of reverting and removing large amounts of work. If you find it failing heavily repeatedly this is a good sign your design is bad or asking too much from it. Continuing on that path reduces quality. You could end up in the circular debugging loops with every fix or update adds even more problems. It's far better practice to drop the entire feature of updates and restart with smaller step by step actions.

4. Trust AI output like you would stack overflow response or a medium article.

Maybe its output would work in some way but it has a good chance of not working for you. Repeatedly asking same questions differently or different angles is very helpful. The same way debugging via stack overflow was trying multiple suggestions to discover the best real problem.

Re: Ask HN: How can I get better at using AI for programming?

#103
post #10

Using voice transcription is nice for fully expressing what you want, so the model doesn't need to make guesses. I'm often voicing 500-word prompts. If you talk in a winding way that looks awkward when in text, that's fine. The model will almost certainly be able to tell what you mean. Using voice-to-text is my biggest suggestion for people who want to use AI for programming (I'm not a particularly slow typer. I can…

> I'm not a particularly slow typer. I can go 70-90 WPM on a typing test. However, this speed drops quickly when I need to also think about what I'm saying. Typing that fast is also kinda tiring, whereas talking/thinking at 100-120 WPM feels comfortable. This doesn't feel relatable at all to me. If my writing speed is bottlenecked by thinking about what I'm writing, and my talking speed is significantly faster, that…

Alternatively: some people are just better at / more comfortable thinking in auditory mode than visual mode & vice versa.

In principle I don't see why they should have different amounts of thought. That'd be bounded by how much time it takes to produce the message, I think. Typing permits backtracking via editing, but speaking permits 'semantic backtracking' which isn't equivalent but definitely can do similar things. Language is powerful.

And importantly, to backtrack in visual media I tend to need to re-saccade through the text with physical eye motions, whereas with audio my brain just has an internal buffer I know at the speed of thought.

Typed messages might have higher _density_ of thought per token, though how valuable is that really, in LLM contexts? There are diminishing returns on how perfect you can get a prompt.

Also, audio permits a higher bandwidth mode: one can scan and speak at the same time.

Re: Ask HN: How can I get better at using AI for programming?

#105
post #3

First you have to be very specific with what you mean by idiomatic code - what’s idiomatic for you is not idiomatic for an LLM. Personally I would approach it like this: 1) Thoroughly define step-by-step what you deem to be the code convention/style you want to adhere to and steps on how you (it) should approach the task. Do not reference entire files like “produce it like this file”, it’s too broad. The document sho…

With the current generation of model, it really isn't necessary to restart every time you don't like something. Certainly this depends on the model. Most of my recent experience is with Claude Sonnet/Opus and Gpt-5.x. I very often, when reviewing code, think of better abstractions or enhancements and just continue asking for refactors inline. Very very rarely does the model fall off the rails. I suppose if your unit…

Yes I too have found newer models (mostly Opus) to be much better at iterative development. With that being said if I have very strong architectural/developmental steer on what I believe the output should be [mostly for production code where I thoroughly review absolute everything] it’s better to have a documented spec with everything covered rather than trying to clean up via an agent conversation. In the team I’m in we keep all plan.mds for a feature, previously before AI tooling we created/revised these plans in Confluence, so to some degree reworking the plan is more an artefact of the previous process and not necessarily a best practice I don’t think.

Re: Ask HN: How can I get better at using AI for programming?

#106
I use Claude. It's really good, but you should try to use it as Boris suggests. The other thing I do is give it very careful and precisely worded specs for what you want it to do. I have the habit, born from long experience, of never assuming that junior programmers will know what you want the program to do unless you make it explicit. Claude is the same. LLM code generators are terrific, but they can't second guess unclear communication.

Using carefully written specs, I've found Claude will produce flawless code for quite complex problems. It's magic.

Re: Ask HN: How can I get better at using AI for programming?

#107
For your task, instead of a direct translation, try adding a "distillation" step in between. Have it take the raw format and distill the important parts to yaml or whatever, then take the distillation and translate that into the new format. That way you can muck with the yaml by hand before translating it back, which should make it easier to keep the intent without the spaghetti getting in the way. Then you can hand-wire any "complexities" into the resulting new code by hand, avoiding the slop it would more likely create.

It may even be worth having it write a parser/evaluator that does these steps in a deterministic fashion. Probably won't work, but maybe worth a shot. So long as it does each translation as a separate step, maybe at least one of them will end up working well enough, and that'll be a huge time saver for that particular task.

Re: Ask HN: How can I get better at using AI for programming?

#108
post #63
post #37

Hey, Boris from the Claude Code team here. A few tips: 1. If there is anything Claude tends to repeatedly get wrong, not understand, or spend lots of tokens on, put it in your CLAUDE.md. Claude automatically reads this file and it’s a great way to avoid repeating yourself. I add to my team’s CLAUDE.md multiple times a week. 2. Use Plan mode (press shift-tab 2x). Go back and forth with Claude until you like the plan b…

Does the same happens if I create an AGENTS.md instead?

Use AGENTS.md for everything, then put a single line in CLAUDE.md:

  @AGENTS.md

Re: Ask HN: How can I get better at using AI for programming?

#109
post #10

Using voice transcription is nice for fully expressing what you want, so the model doesn't need to make guesses. I'm often voicing 500-word prompts. If you talk in a winding way that looks awkward when in text, that's fine. The model will almost certainly be able to tell what you mean. Using voice-to-text is my biggest suggestion for people who want to use AI for programming (I'm not a particularly slow typer. I can…

> I'm not a particularly slow typer. I can go 70-90 WPM on a typing test. However, this speed drops quickly when I need to also think about what I'm saying. Typing that fast is also kinda tiring, whereas talking/thinking at 100-120 WPM feels comfortable. This doesn't feel relatable at all to me. If my writing speed is bottlenecked by thinking about what I'm writing, and my talking speed is significantly faster, that…

I don’t feel restricted by my typing speed, speaking is just so much easier and convenient. The vast majority of my ChatGPT usage is on my phone and that makes s2t a no brainer.

Re: Ask HN: How can I get better at using AI for programming?

#110
post #10

Using voice transcription is nice for fully expressing what you want, so the model doesn't need to make guesses. I'm often voicing 500-word prompts. If you talk in a winding way that looks awkward when in text, that's fine. The model will almost certainly be able to tell what you mean. Using voice-to-text is my biggest suggestion for people who want to use AI for programming (I'm not a particularly slow typer. I can…

Speech also uses a different part of the brain, and maybe less finger coordination.
Post reply on HN