top of page
Clearer Thinking Team

Boosting Your Productivity With AI: Using AI for Coding


Contents

(Click any of these links to go directly to that section)




General tips


LLMs can be extremely helpful in coding, significantly speeding up the development process. If you’re going to use an LLM in this way, you should think about doing the following things:


  • Define the Task: Clearly specify what the code needs to do. This includes outlining the functionality, inputs, outputs, and any specific requirements or constraints.


  • Select the Programming Language


  • Provide Context and Details: These might include things such as the coding environment, libraries to be used, or any existing code that needs to be integrated with.


And, once you’ve received code from the LLM you’re using, make sure you:


  • Review and Refine: Examine the generated code for correctness, efficiency, and adherence to best practices. Make adjustments or ask the LLM for modifications if necessary.


  • Test the Code: Run the code to ensure it works as intended and make any required debugging or refinements.


With this process in mind, what follows are some examples of ways you can use LLMs to help with your coding.



Generating code snippets:


LLMs can write code for you! Here’s an example, using a prompt with not much detail - if you specify more about what you need the code to do, you’ll get even better results!





Explaining difficult coding concepts


For discussion of this, see Breaking down a Concept




Suggesting improvements to existing code


LLMs are very good at suggesting improvements to existing code (though, as with any use case, they sometimes make mistakes). Here’s a simple example of an LLM providing code feedback:






Generating code documentation


Code documentation is written text or illustration that accompanies computer software or is embedded in the code itself, aiming to explain how the software works or how to use it. Of course, you should always review the output for accuracy and edit it if you notice any issues. Here’s an example of an LLM (Claude) automating this process:




Translating code between programming languages


Here's an example of Claude doing this:




Creating test cases or generating unit tests for code validation


Here’s an example of Claude doing this:


And here’s Claude’s explanation of what it did:



Refactoring code for optimization and readability


To refactor code is to modify it without changing its external behavior or functionality. You might do this in order to make it cleaner, more efficient, and easier to understand. Here’s an example of Claude helping with this:



And, again, Claude finishes by explaining what it did, showing you some of its abilities:






✉️ Send us your prompts! ✉️

If you have suggestions for additional uses of LLMs, we'd love you to send them to us (including an example prompt) at info@clearerthinking.org. If we like them, we may add them to our library and credit you where they appear.

Comments


bottom of page