<aside>

On this page:

</aside>

<aside>

Expanse Docs

🧠 Product Docs

🤖 Prompting Tips

LLM Directory

Prompting Tips & Tricks

Prompt Library

💻 Use Cases

For Work

For Fun

📚 Resources

Prompt Engineering Resources

🍄 About Expanse

Meet the team

</aside>

Tips & Tricks to Coding with AI

Coding with AI can dramatically accelerate your workflow, but poor prompting habits can lead to problematic code and long and frustrating conversations with the AI. Developing good AI coding habits will save you tokens, time and resources all while receiving fast and valuable AI responses to speed up your coding workflows.

<aside> 🥡

Key Takeaways


1. Start new Threads often

Every message you send provides the AI with the information and ‘context’ to generate a relevant response. However, each time you send a message, your entire chat history gets sent too**.** Therefore, longer conversations have a higher likelihood of confusing previous messages/contexts which can cause it to output broken or irrelevant code.

To combat this, keep your Threads concise and start new Threads at the start of every task. This way, you will reduce the likelihood of the AI incorrectly drawing on previous contexts.

Why this matters

Tips on using Threads

Summarize your Thread

If you need to draw on context from previous Threads, ask the AI for a summary at the end of a chat, then refine and reuse it in future conversations. Simply ask the AI to summarize your discussion, copy that summary to a fresh thread, and say "Let's continue from here." See the prompt below.

Summarize thread.png

<aside> 💡

Edit Messages to Branch Responses

When you need to modify multiple files, or want to compare results, consider Editing the Message and branching the conversations.

Now, you can switch between results while preserving the same context from previous messages.

Edit message toggle.png


2. Use Focus Mode

Giving the AI too much previous context in the form of multiple messages with long blocks of code can cloud it’s ability to generate relevant responses.

To keep your responses focused and relevant, use Expanse in Focus mode, this way, the AI will only respond to the current message sent without interpreting any of the previous messages in the Thread.

Chat Focus Mode.png

You can seamlessly switch modes by toggling the chat/focus button in the top left of the window.

Why this matters


3. Keep Temperature to Zero

Adjusting an LLM’s temperature controls the creativity of an AI’s responses. Since most coding workflows should not require much “creativity,” you should set your temperature to 0 to produce more focused, concise, and precise outputs.

Temperature.png

Adjust your temperature by clicking on the LLM selector and dragging the slider to 0%. You can also set your default temperature by going to Space Settings.

Why this matters


4. Upload Relevant Files & Info

When coding with AI, only share the files directly related to your current task to help the AI focus on what's important.

<aside> 💡

</aside>

  1. Share the specific code you want to modify
"Below is a section of code from my weather app. Please refactor this code: {{CODE}}"
  1. Prompt the AI to only output the new code/changes
"Please add a feature to display the coordinates of eah location. Output only the new code and let me know where to paste it in the script"
  1. Test the changes in your development environment and if any errors appear, copy and paste the error descriptions and send back to the AI and repeat the process
"I think there is a naming error in my code. Please identify the issue and return the correctly named code."

<aside> 💡

</aside>


Treat your Role as a “knowledge base”

All the information in your Role gets directly attached to every message you send. This means, all the instructions and context you include in a Role will always be sent to the AI so it doesn’t forget the instructions.

Pastry chef prompt.png