Using Claude
Revise earlier messages aggressively as you refine what you actually want.
Quiz for understanding first. Give context, ask a checkpoint question, then ask the real thing.
Use “problem decomposition”: break down the task into bite-sized pieces.
This post exists because my fiancé wanted advice on a thing and I wrote something quick and dirty to relay this information and she deemed it blog post material. But it had to be redacted a lot to make it fit to post publicly.
Some people have trouble getting LLMs to write useful code for them. Here I explain what I think works and what does not.
What not to do
The first step in writing a program is identifying the problem you’re solving. You sort of know “where you are now” and you sort of know “where you want to end up” and maybe you know some stuff about constraints and requirements between those places.
Do not try to go directly from “the state before you know what your problem even is” to “done”. You will have a bad time, like the bad time my example user is having below:
This conversation sucks! The user dumps multiple complex requirements without any specifics. The core problem is that the thing they are asking for is confused.
Worse, they’re likely to try to “fix” it by getting into an argument with the chatbot. At which point they’ll be given a monkeypatch, which has a good chance of not working. And when they ask for a fix-for-the-fix, now they’re getting “a monkeypatch for the already incorrectly monkeypatched code”. In the classic case, the user ends up alternating between two stable, broken states. The “fixes” just turn broken state A into broken state B (or vice versa).
In my experience people who press on with this strategy end up getting mad at computers. Doing so is unhealthy and doesn’t get the work done, so, I’d recommend avoiding this.
What to do
Use these strategies:
If you find yourself in an unproductive aggravating loop: revise your earlier messages aggressively as you refine your understanding of what you want.
Quiz for understanding first. If the task needs the model to interpret complex input correctly, don’t immediately ask your real question. First give it the context, then ask a “checkpoint question”. If it passes, now ask the real thing. If it fails, you caught the misunderstanding early.
Use “problem decomposition” aggressively to break down the task into bite-sized pieces. Have the bot write code that finishes off those bite-sized pieces. The remainder of the post concerns this strategy.
Using LLMs for programming is, ideally, something like having a combination rubber duck and grunt-worker. Discuss the task until you understand the task. Walk the bot through the process of breaking the task down. Doing this is often easier than doing it yourself.
More on quizzing
The quiz question should be something where you already know the answer, & a wrong answer reveals a fundamental misunderstanding. e.g. you are going to have it do data retrieval. Data indexing is described relative to values in column a. Row 1 is for column titles. So the values in A are +1 relative to the row numbers. Ask it to retrieve the item in row 55 (or any other row). If it isn’t on the same page no sense trying to proceed yet.
Problem decomposition example
Below is a very heavily redacted conversation that went especially well.
Throughout this post, chatbot responses have been censored to remove business-specific content. Anywhere you see [...] or [redacted], that’s where something was cut.
Breaking the problem down is a skill. If you don’t know how to do this: ask the model. e.g. What are the separable stages of this problem?. We do so here.
So now the context contains the input code and a bunch of nitpicking about the exact thing being done. This is good so far. We then gave it a bit more context about other people’s past attempts to solve the problem. This seems useful but isn’t really worth posting verbatim so I’ll skip ahead to the next notable thing:
We then hammer out the exact shape data is expected to be at the beginning and end of each “module”. So far we’re just creating “documentation”.
At this point the bot returned a slick, helpful implementation of the first step. And with handholding similar to the above, it was able to do the same for the other five stages. Problem was broken down into tiny little pieces and the questions in the conversation history are pruned for only being the exact question we want to be asking.
If I get an unhelpful answer then it is very likely I have asked the wrong question. The most likely cause of asking the wrong question is “not knowing what it is I actually want”. Go back and try again until the conversation is the idealized version of the conversation, where you always ask the exact right questions. This avoids the problem of having endless cascades of “fixes” – simply generate code that is already either correct or close enough to correct that you can trivially correct it on the spot.
Overall I came away from this task feeling like I understood it better than when I went in, and also like I had to do approximately no work to get that understanding, and to get the work product. I think this generalizes fairly well. As of 2025, chatbots are much better about not hallucinating stuff. So they are extremely good at writing boilerplate, and you can transform many tasks into boilerplate by breaking them down over and over and over until they assume the shape of “write 10 boilerplate things”, which you then have the chatbot write. Ez Ez GG!