HACKER Q&A
📣 gsuuon

How are you using LLM's for code?


I'd like to integrate AI into my workflow more but I'm still hand writing the vast majority of code.

I've found some success with sketching out the structure -- I'll write functions with type signatures and then an empty body with a comment of what I want and then go through all of these and let an LLM fill out the bodies. This works pretty well for simple functions but anything requiring more context requires a complete rewrite from me.

I'll also sometimes ask how to do a thing instead of searching, but then usually I'll still need to do a search anyways to verify it wasn't a hallucination.

These can be helpful speedups, but I feel like I'm still leaving a lot on the table. Does anyone heavily incorporate LLM's when coding? How are you using LLM's?


  👤 mikerg87 Accepted Answer ✓
Similar to your approach, I sketch out the signatures - ask the LLM to write the unit tests and then I write the actual implementation. If there is a hallucination in the test code, it shows up as a failing test that can be shaken out by some introspection. I enjoy writing the actual code but hate the tedium of writing tests. I’m also feel that I’m less likely to prompt the LLM into reproducing someone else’s code into my system. I know the probability isn’t zero but it doesn’t seem to be as likely.

👤 raxxorraxor
I don't heavily incorporate them, but I more and more ask for solutions and routines and compare them to mine. Manually, I haven't tried AI supported autocompletion or anything in that direction. I try to get them to do some busy work, but the results are mixed and if there is something domain specific it usually doesn't work. Just like you said, it would require context. Explicitly stating everything here is often more complex than the programming itself. Just uttered in a more imprecise language where you hope that your expression does make sense, statistically.

I imagine I want them to do some scaffolding on a keypress with certain query templates, but for many problems there already is a good implementation that I can just use.

Anyone tried to let AI do some codegolf? Someone graveyarded this good question:

https://codegolf.stackexchange.com/questions/107050/primes-w...


👤 helix278
I use it to generate repeating code patterns (like parse this list of numbers into this sum type). Or generate an FFI for something. Or ask general questions about things related to programming, which gives me directions to look further. Or I use it as rubber duck. But most programming is just done without LLM assistance.