AI & LLMs · Guide · AI & Prompt Tools
How to Use Aider
Installing aider, --model flag, /add and /drop, edit formats (diff, whole, udiff), git integration, and voice coding.
Aider is a pair-programming CLI that edits files in your repo and commits the changes directly to git. You run it from inside a project, give it a goal in plain English, and it proposes diffs one turn at a time — with every accepted change landing as its own git commit.
Advertisement
What Aider actually does
Aider loads the files you add to the chat into an LLM’s context, then asks the model to produce either a unified diff or a whole-file rewrite depending on the edit format it negotiated for your model. When you accept, Aider applies the edit and runs git commit with a message it wrote. Undo is just git reset --hard HEAD~1, so there is no magic state to untangle.
Installing
python -m pip install aider-install aider-install
The installer puts Aider in its own isolated environment so it will not fight your project deps. Set ANTHROPIC_API_KEY or OPENAI_API_KEY in your shell profile before the first run.
A first session
cd my-project aider --model sonnet src/handlers.py src/handlers_test.py
Inside the prompt, describe the change: “add retry with exponential backoff to the fetch_user handler, and extend the existing test to cover three retries.” Aider will edit both files, run the test command if you set one, and commit. Use /add and /drop to manage the file set, /undo to roll back the last commit, and /ask when you want to discuss without editing.
Picking a model
Claude Sonnet and GPT-class frontier models are the sweet spot for whole-file edits on real code. Aider’s own leaderboard is the best live reference — it measures edit-format compliance, not just raw code quality, which is what actually breaks agents in practice. For cost-sensitive work, use an --architect plus --editor-model split so a strong reasoner plans and a cheaper model writes.
Configuration pitfalls
Drop a .aider.conf.yml at the repo root to pin model, edit format, lint command and test command. Aider will run your linter and tests after each edit and feed failures back into the next turn — this is the single biggest quality win and most users skip it. Add .aider* to .gitignore so chat history and cache do not leak into commits.
When Aider shines
Bounded changes across two to six files where you want atomic commits and a clean diff trail. Bug fixes with a reproducing test are ideal: write the failing test, tell Aider to make it pass, watch it iterate.
When not to use it
Greenfield apps where you do not yet have a repo structure — Aider assumes you know which files to put in context, and its retrieval is weaker than IDE-integrated agents. Also avoid it for “read the whole repo and tell me how auth works” exploration; tools like Cline or Cursor index the codebase and will answer faster.
Advertisement