I use LLMs a lot for my coding, but I also almost always start with a clear scope such as "I have a Xarray DataArray with dimensions ..." and limit 'please write me code to ...' requests to specific clearly-defined tasks. In these cases, LLMs will (in my experience) use only the standard libraries I'd use anyway (xarray, pandas, numpy, etc...) and are a great help. Saves me heaps of time in writing boring standard functions which are easy to verify.
And when I get more adventurous I soon realise that I'm wasting time trying to get the LLM to solve the problem.