While most AI code generation examples show how to quickly bootstrap a new web application, I was curious how far an AI coding assistant can take me in an existing, non-trivial codebase – one with a Java backend, automated tests, APIs (OpenAPI), PostgreSQL database migrations (Liquibase). I decided to explore the open-source AI tool aider, applying it to one of my projects: hsadmin-NG.
How to Use aider AI Coding Assistant
aider is an open source command-line tool for coding with LLMs (Large Language Models) such as GPT (OpenAI), Claude (Anthropic), or Gemini (Google) and others.
aider allows you to easily analyze and edit code files by chatting with an AI in your terminal. It works across languages, and lets you iteratively build, refactor, and fix code. And it’s surprisingly effective — if you know how to guide it.
Warning
|
aider sends your code to the selected LLM provider. If you’re working on proprietary or sensitive code, make sure you understand what that means. In my case, the project is open source, so this isn’t a blocker. For more details, see the aider privacy policy. |
Installation
Assuming you have Python 3 and pipx
installed:
pipx install aider-chat
To use OpenAI’s vision models or other advanced capabilities:
pipx inject aider-chat openai --include-apps
To use Google’s Gemini:
pipx inject aider-chat google-generativeai --include-apps
Configuration
You need to provide your API key depending on the model:
export OPENAI_API_KEY="your-api-key-here"
export GEMINI_API_KEY="your-api-key-here"
These can be added to your .bashrc
or .zshrc
.
Basic Workflow
Before you start, it’s suggested having a CONVENTIONS.md
file in your project.
This files contains rules for the aider AI coding agent, see .aider.conf.yaml
.
Find my CONVENTIONS.md for this project in my git repository..
-
Go to the project root
-
Run the AI agent
aider
-
Add files you want aider to work with:
/add path/to/file.java another/file.yaml
-
Chat with the AI, e.g., "Add field X to entity Y and update the DB schema"
-
Let aider propose changes. You can confirm or skip each diff.
-
Exit with
/quit
For more commands seen aider's usage documentation.
Example Session: Adding a Field to an Existing Entity
My use case is adding a notes
field to the partner_details
table and related code (Java entity, patcher, Liquibase, OpenAPI, tests).
I initially tried to just ask aider to figure it all out, e.g. like this:
$ aider
/ask
My use case is adding a `notes` field to the `partner_details` table and related code (Java entity, patcher, Liquibase, OpenAPI, tests).
Where do I need to add field `notes`?
That didn’t work too well. Even with advanced models like GPT-4 or DeepSeek’s reasoning model, it missed files or proposed unnecessary ones. Of course, I tried different ways of phrasing my question - nothing worked well enough.
So I pre-selected all relevant files using good old grep
:
aider `grep -rl registrationOffice src/main/java/ src/test/java/ src/main/resources/api-definition src/main/resources/db/`
Then I told aider:
I want to add a text field
notes
to the database tablehs_office.partner_details
and related files. Files to amend have already been added to aider AI. Please apply all required changes for Java production+test-code, add the Liquibase changeset and amend the OpenAPI-Spec.
After letting aider propose and apply all changes, I ran the tests (using my custom test alias gw-test
) and found one issue:
The field was added in test data, but not asserted anywhere. I asked aider:
Please doublecheck if you followed all conventions. Any other amendments necessary to support the new field
notes
in the partner details?
It suggested more changes, some useful, some not so useful. Eventually, I decided to just revert some test data changes with git and re-ran the tests. All tests passed now.
The resulting changes can be found in this git commit.
Determinism and Randomness
Keep in mind that LLMs operate with a parameter called temperature which introduces randomness. So the AI might not always produce the same result for the same input.
Sometimes that’s helpful. Sometimes it’s annoying. Be prepared.
Security: What Does aider Access?
I wanted to know which files aider actually opens. So I traced it with strace
:
strace -f -t -e trace=file -o build/aider.strace aider ...
In a second terminal:
tail -f build/aider.strace | grep -oP '"\K[^\n"]+(?=")'
All accessed files made sense. Of course, there’s no guarantee — it’s still a local app running with your user permissions.
There is a Docker image, but it’s pretty restricted. If you need advanced features (like vision or Gemini), you might need to rebuild the image with extra support.
Summary
aider is a promising tool for LLM-driven development. Though, it won’t yet fully understand the domain logic or large code base structures — but if you provide the right files and instructions, it can save a lot of time.
It acts somewhat like an entry level programmer, as it needs a senior to provide some rules and guidance.
I’m definitely looking forward how aider and the LLMs will improve in the future. But I also think they’ll always need somebody who knows how to guide them to read the intended goal. Anyway, the software development industry is at the brim of a disruptive change.
Any comments about this article are welcome on X.
Twitter
Facebook
Reddit
LinkedIn
StumbleUpon
Email