My LLM usage pattern
So, this post is mainly for detailing my experience using LLMs (hate the broad usage of the term, but heh) over the last week for writing a ton of code. The main tools I’ve been using is Zed (absolutely love this code editor who ’ve done a great job with their AI integrations) plus Aider (CLI tool for pair programing with an LLM), both free tools. Both configurable to use a variety of LLM models based on the API key provided. I am a fan of Anthropic’s Claude 3.5 Sonnet model which I trust to write great code for me. In terms of cost, looking at the API cost in the Anthropic console tells me I have used approx $10 worth of tokens over the past month.
By far the simplest flow I’ve been using is the inline assist in Zed. You just highlight some code, Hit Ctrl-Enter and type in a prompt, and it just rewrites to the code. I’ve been using it to fix simple bugs. Copy-pasting error log into prompt and adding a fix to it. Filling in simple boiler plate code like write a fastapi health check endpoint, fill in this postgres db url to connect to XYZ DB on localhost.
A second flow I’m been using is the Zed Assistant Panel. Think of it like an empty plain text notepad. You type in a prompt. The response is then appended after your text in the notepad. It might seem like the standard chat interface, but the fact that it is all happening in a plain text buffer (allows you to delete certain context, start afresh by just deleting all the text, etc) with great keyboard shortcuts makes the experience really great. I’ve used it for generating benchmarking scripts, for getting help debugging an harder issue and even plain old general non-code related help. Honestly I’ve been using this more than the native Claude.AI chat which is a much slower web application.
A third more janky non-intuitive flow is using Aider for me. I usually ask it implement a feature all together. I tried replacing DB calls in a typescript (which I know very little of) and writing basic CRUD endpoints. The generated code usually doesn’t work due to some simple mistake, but spoting and fixing the mistake is pretty straightforward. In some cases, especially when involving existing code, it prefered to rewrite the entire thing instead of making a small and simple pragmatic change, in which cases it was useless and I just undid the changes it made.