Delv
Aider
Getting Started Guide

How to Use Aider

A practical guide to get you up and running with Aider. Written by Delv Editorial, Delv Team.

Getting started with Aider

In this guide, you'll learn how to set up Aider, the open-source AI pair programming tool that enhances your coding experience directly in the terminal. By the end, you'll be able to edit code in your local Git repository using advanced language models.

Step 1: Sign up and set up

  1. Go to the Aider website and check the installation instructions for your operating system.
  2. Open your terminal and clone the Aider repository with the command:
git clone https://github.com/yourusername/aider.git
  1. Navigate into the cloned directory:
cd aider
  1. Install the necessary dependencies using:
npm install
  1. Set up your API keys for the language models you want to use (e.g., GPT-4 or Claude). Follow the documentation in the repository for specific instructions on configuring these keys.

Step 2: Your first code edit

  1. Open your terminal and navigate to your local Git repository where you want to use Aider.
  2. Start Aider by running:
node aider.js
  1. Type a command to request a code suggestion. For example:
Suggest a function to calculate the factorial of a number.
  1. Aider will respond with a code snippet. You can accept it by typing yes or modify it as needed.
  2. If you accept the suggestion, Aider will automatically edit your code file.

Step 3: Get better results

  • Use clear and specific prompts when asking for code suggestions. For instance, instead of "Help me with a loop," specify "Create a for loop that iterates through an array of numbers."
  • Regularly update Aider and its dependencies to ensure you have the latest features and bug fixes. Use:
git pull origin main
  npm update

Pro tip

When working on larger projects, keep a list of common prompts that work well for you. This can save time by letting you quickly access effective suggestions without having to think of new requests each time.

Common mistake to avoid

Many beginners forget to configure their API keys properly. Ensure that you have set the environment variables for your API keys as per the instructions in the Aider documentation. Missing or incorrect keys will prevent Aider from generating suggestions.