I think my problem is that I am "lazy", but I honestly have no idea how to prompt in a non-lazy way. I feel like if I had a specific algorithm in mind, for example, then I could just code it myself. Here is an example:
> i am building a distributed queue. i am using hashicorp memberlist to know when new nodes are added or removed. each node has a shard and replica number in its memberlist metadata. i am using hashicorp raft to set up replication.
> Currently, my memberlist only has a single member and raft is set up to bootstrap with itself as the only node. What logic do I need to write in the memberlist delegate to ensure nodes are correctly added to their shard? this should be reliable - the cluster should never be left in an unstable state, or a state where we attempt to process membership changes while a node is still in a candidate state.
What should I be doing instead?
I will say that Copilot is sometimes embarrassingly wrong. It’s strange how brilliant it can be at times and how incredibly dumb it can be other times. I think that just comes as part of the technology right now, but I have made it write quite complex code using the above approach. This approach does, however, require you to understand how the problem should be solved as to have Copilot understand enough to take over.
LLM outputs are like clay, you have to sculpt it.
Treat it like an intern and a rubber duck.
It may be able to suggest the names of existing algorithms, but unless they’re absurdly common or simple it’s unlikely to be able to implement them for you.
If you need to come up with your own algorithm, prompt it to ask you questions to clarify your own thinking.
Document in plain English how you want your algorithm to work.
Stub out APIs yourself, and add comments describing what each function/method should do. Have the AI come up with and implement test cases. Then have it implement the methods to pass those test cases. Then debug.
Better ask Claude simple questions in the browser, review the answer, research a little when in doubt, and translate the solution.
My prompts are minimal, just like they used to work in the old search engine days:
> Linux C++ inter process comunication
That brings me the most used mechanisms with advantages and examples.