This commit is contained in:
Paul Gauthier 2024-08-28 08:26:14 -07:00
parent e7f4ef9c23
commit fb93e204f1
2 changed files with 30 additions and 11 deletions

View file

@ -2,3 +2,4 @@ You can send long, multi-line messages in the chat in a few ways:
- Paste a multi-line message directly into the chat. - Paste a multi-line message directly into the chat.
- Enter `{` alone on the first line to start a multiline message and `}` alone on the last line to end it. - Enter `{` alone on the first line to start a multiline message and `}` alone on the last line to end it.
- Use Meta-ENTER to start a new line without sending the message (Esc+ENTER in some environments). - Use Meta-ENTER to start a new line without sending the message (Esc+ENTER in some environments).
- Use `/clipboard` to paste text from the clipboard into the chat.

View file

@ -6,21 +6,39 @@ description: Tips for AI pair programming with aider.
# Tips # Tips
- Think about which files need to be edited to make your change and add them to the chat. - **Add just the files that need to be edited to the chat.**
Aider can help the LLM figure out which files to edit all by itself, but the most efficient approach is to add the needed files to the chat yourself. Take a moment and think about which files will need to be changed.
- Don't add *everything* to the chat, just the files you think need to be edited. Aider can often figure out which files to edit all by itself, but the most efficient approach is for you to add the files to the chat.
Aider also sends the LLM a [map of your entire git repo](https://aider.chat/docs/repomap.html). - **Don't add lots of files to the chat**, just the files you think need to be edited.
So the LLM can see all the other relevant parts of your code base. Too much irrelevant code will distract and confuse the LLM.
- Large changes are best performed as a sequence of thoughtful bite sized steps, where you plan out the approach and overall design. Walk the LLM through changes like you might with a junior dev. Ask for a refactor to prepare, then ask for the actual change. Spend the time to ask for code quality/structure improvements. Aider uses a [map of your entire git repo](https://aider.chat/docs/repomap.html)
- It's always safe to use Control-C to interrupt aider if it isn't providing a useful response. The partial response remains in the conversation, so you can refer to it when you reply to the LLM with more information or direction. so is usually aware of relevant classes/functions/methods elsewhere in your code base.
It's ok to add 1-2 highly relevant files that don't need to be edited,
but be selective.
- **Break your goal down into bite sized steps.**
Do them one at a time.
Adjust the files added to the chat as you go: `/drop` files that don't need any more changes, `/add` files that need changes for the next step.
- For more complex changes, use `/ask` to
[discuss a plan first](modes.html).
Once you are happy with the approach, just say "go ahead" without the `/ask` prefix.
- Use Control-C to interrupt aider if it isn't providing a useful response. The partial response remains in the conversation, so you can refer to it when you reply with more information or direction.
- **If aider gets stuck** trying to make a change, try:
- Using `/clear` to discard the chat history and make a fresh start.
- Can you `/drop` any extra files?
- Consider using `/ask` to discuss a plan before aider codes.
- If aider is hopelessly stuck,
just code the next step yourself and try having aider code some more after that.
Pair program with aider.
- If your code is throwing an error, - If your code is throwing an error,
use the `/run` [in-chat command](/docs/usage/commands.html) use the `/run` [in-chat command](commands.html)
to share the error output with the aider. to share the error output with the aider.
Or just paste the errors into the chat. Let the aider figure out and fix the bug. Or just paste the errors into the chat. Let the aider figure out and fix the bug.
- If test are failing, use the `/test` [in-chat command](/docs/usage/commands.html) - If test are failing, use the `/test` [in-chat command](commands.html)
to run tests and to run tests and
share the error output with the aider. share the error output with the aider.
- {% include multi-line.md %}
- LLMs know about a lot of standard tools and libraries, but may get some of the fine details wrong about API versions and function arguments. - LLMs know about a lot of standard tools and libraries, but may get some of the fine details wrong about API versions and function arguments.
You can paste doc snippets into the chat to resolve these issues. You can paste doc snippets into the chat or
include a URL to docs in your chat message.
Aider will scrape and read the URL.
- {% include multi-line.md %}