Using LLMs For Code

File size
4.4KB
Lines of code
83

Using LLMs For Code

On how to use LLMs to write code.

10 Principles

  1. Set reasonable expectations: Treat LLMs as a "fancy autocomplete" or an "over-confident pair programming assistant" that augment your abilities but will make mistakes.
  2. Account for training cut-off dates: Be aware of the model's knowledge cut-off date, as it won't be aware of newer libraries or breaking changes.
  3. Context is king: The quality of the output depends on the context provided. This includes the entire conversation history. Start new chats to reset context when needed. Provide examples of code to guide the model.
  4. Ask for options: Use LLMs for initial research to explore possibilities and different ways to implement a feature.
  5. Tell them exactly what to do: Be authoritarian and provide detailed instructions, including function signatures. This is often faster than writing the code yourself.
  6. You have to test what it writes: You are still responsible for delivering working software. Always test the code generated by the LLM.
  7. Remember it’s a conversation: Don't accept the first output. Refactor, ask for changes, and iterate until you get the desired result.
  8. Use tools that can run the code for you: Tools that can execute the generated code in a loop are powerful for iteration.
  9. "Vibe-coding" is a great way to learn: For non-critical projects, embracing a rapid, less-critical approach can be a fun and effective way to build intuition for what works.
  10. Be ready for the human to take over: LLMs are not a replacement for human experience. Know when to step in and solve a problem yourself.

Resources