Aider — AI Coding Tool Guide
Git-native AI pair programming in your terminal. Map-refine architecture, polyglot support, edit formats, and multi-model configuration for focused, high-quality edits.
Aider
Aider is a terminal-based AI pair programming tool deeply integrated with Git. It automatically commits changes with meaningful messages, works with most LLMs, and excels at focused, high-quality edits with its map-refine architecture.
What Makes Aider Different
- Git-native — Every change is automatically committed with descriptive, conventional commit messages
- Map-Refine architecture — Creates a repository map (full codebase structure), then refines targeted changes against it. This lets Aider understand your entire project while only editing the relevant files
- Edit formats — Uses structured search/replace blocks for precise, verifiable edits (not free-form code generation)
- Polyglot — Recognizes and edits most programming languages via tree-sitter
- Swe-bench leader — Top performer on the SWE-bench benchmark for real-world bug fixing
Getting Started
pip install aider-chat
export ANTHROPIC_API_KEY="sk-ant-..."
cd my-project
aider
Multi-Model Configuration
Aider supports different models for different tasks:
# .aider.conf.yml
model: claude-sonnet-4-20250514 # Primary model
weak-model: claude-haiku-4-20250514 # Cheap model for simple tasks
editor-model: claude-sonnet-4-20250514 # Model used for editing
Prompt Patterns
Aider works best with focused, specific prompts:
Scoped Feature
Add input validation to the signup form in src/forms/signup.tsx.
Fields: email (required, valid format), password (8+ chars,
1 uppercase, 1 number), name (required, 2+ chars).
Use zod schemas matching the pattern in src/lib/validators.ts.
Multi-File Refactoring
Refactor the database layer:
1. Move all raw SQL from src/routes/ into src/db/queries/
2. Create typed query functions with proper parameterization
3. Update route files to use the new query functions
4. Keep the existing test suite passing
Bug Fix with Context
The user search endpoint at src/api/users/search.ts returns
duplicate results when multiple search terms overlap.
Trace the query construction (starts at line 47), identify why
duplicates occur, and fix while maintaining the existing sort order.
Documentation Generation
Read src/services/payment.ts and generate:
1. JSDoc comments for all exported functions
2. A markdown doc at docs/payment-service.md covering:
- Architecture overview
- Function reference (signatures, parameters, returns)
- Error handling patterns
- Example usage
Configuration
.aider.conf.yml at project root or ~/.aider.conf.yml:
# Model settings
model: claude-sonnet-4-20250514
weak-model: claude-haiku-4-20250514
# Git settings
git: true
auto-commits: true
dirty-commits: true
attribute-author: true
# Edit settings
edit-format: search_replace # Structured search/replace edits
dark-mode: true
# File handling
read: [CONVENTIONS.md, README.md] # Files to read every session
auto-test: true # Run tests after edits
test-cmd: npm test # Test command
Key Edit Formats
| Format | Behavior |
|---|---|
search_replace | Structured find-and-replace (default, most reliable) |
diff | Unified diff patches |
whole | Rewrite entire file |
udiff | Unified diff with fuzz matching |
Map-Refine Architecture
Aider's two-phase approach:
-
Map — Scans and indexes the entire repo structure. Understands which files import which, where functions are defined, and how modules connect. This gives Aider a mental model of your project without reading every file.
-
Refine — For each prompt, Aider selects the most relevant files from the map, reads them, and generates precise edits. The map ensures it doesn't miss cross-file impacts.
This is why Aider excels at tasks like "rename this function everywhere" or "change this type across the codebase" — the map tells it every place the function/type is used.
Related Pages
- Tool Comparison — Aider vs other AI coding tools
- Prompt Chaining (Prompts Section) — Multi-step workflows
- SWE-bench Explorer (Agents) — SWE-bench methodology (Aider's primary benchmark)
Related Articles
Prompt Engineering in GitHub Copilot
Prompt patterns for GitHub Copilot chat, inline edits, and agent mode. Master workspace context, slash commands, step-by-step feature patterns, PR-focused prompting, and common pitfalls.
AI Coding Tools — Prompt Engineering & Configuration
Complete guides for Claude Code, OpenCode, Gemini CLI, Cursor, GitHub Copilot, and more. Tool-specific prompt patterns, configuration files, and setup guides for every major AI coding assistant.
Continue.dev — AI Coding Tool Guide
Open-source AI code assistant. Local model support, custom slash commands, configuration, and integration with Ollama, LM Studio, and cloud APIs.