/add
Adds one or more files to the chat so Aider can edit them or use them as detailed context.
/add adds files to the current chat session. Aider can only edit files that are in the chat. If a new file that doesn't exist yet is given to /add, Aider remembers the filename and writes to it later instead of accidentally changing an existing file. Besides the added files, Aider also uses a map of the whole git repo, so it's aware of code outside the chat too.
๐ฌ AS A SHORT VIDEO
Adds one or more files to the chat so Aider can edit them or use them as detailed context.
โ WHEN TO USE IT?
Make a file editable
/add payment.py โ add the file to the chat before asking Aider to change it
Safely create a new file
/add utils/newfile.py before asking Aider to write a new helper function there โ this way the change lands in the new file instead of an existing one
โ WHEN NOT TO?
Adding many files just in case
Too much irrelevant code in the chat distracts the LLM; the docs recommend adding only the files actually needed.
Better: Add only the 1-2 truly relevant files and let the automatic repo map cover the rest
Only wanting to show a file as reference, not edit it
/add makes files directly editable โ unnecessary if the file should only serve as context.
Better: Use /read-only to add the file for reference only
SOURCES
- Aider Docs โ In-chat commands โ aider.chat
- Aider Docs โ Tips โ aider.chat