# Aider Mastery

> Aider CLI AI pair programmer -- architect mode, git integration, repo map (tree-sitter + PageRank), multi-model config, CONVENTIONS.md, and lint-and-fix workflows.

- Skill: `leolin990405/aider-mastery` (Agent Skill)
- Install (CLI): `npx get-skill add leolin990405/aider-mastery`
- Raw SKILL.md: https://api.skillmd.com/api/skills/leolin990405/aider-mastery/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: LeoLin990405 (https://skillmd.com/u/leolin990405)
- Updated: 2026-11-11
- Page: https://skillmd.com/skills/leolin990405/aider-mastery

---


# Aider Mastery

## Architecture

Open-source, CLI-based AI pair programmer with deep git integration. Terminal-native, works with any LLM.

**Git-first**: Every AI change auto-committed with descriptive messages. Full undo via `git revert`.

**Repo Map**: tree-sitter parses source → NetworkX graph models relationships → PageRank ranks relevance → binary search fits token budget.

## Chat Modes

| Mode | Command | Purpose |
|------|---------|---------|
| Code | `/code` | Direct code editing (default) |
| Architect | `/architect` | Two-model: architect proposes, editor implements |
| Ask | `/ask` | Q&A without editing |
| Help | `/help` | Aider usage help |

### Architect Mode

Best for complex refactoring:
1. **Architect model** (o1-preview, Claude Sonnet) proposes solution
2. **Editor model** (DeepSeek, o1-mini) converts to file edits
3. o1-preview + DeepSeek achieved **85% on SWE-bench**

## Configuration

### `.aider.conf.yml`

```yaml
model: claude-3-5-sonnet-20241022
architect: true
editor-model: deepseek-chat
editor-edit-format: diff

map-tokens: 1024
map-refresh: auto

auto-commits: true
dirty-commits: true
attribute-author: true

auto-lint: true
lint-cmd: "eslint --fix"
auto-test: false
test-cmd: "npm test"

read:
  - CONVENTIONS.md
  - docs/architecture.md

stream: true
pretty: true
```

### CONVENTIONS.md

```markdown
## Style
- Use 2-space indentation
- Prefer const over let
- Use async/await over .then()

## Architecture
- Services in src/services/
- One class per file
- All public methods must have JSDoc

## Testing
- Co-locate tests: foo.test.ts next to foo.ts
- Use vitest for unit tests
- Minimum 80% coverage for new code
```

Load: `aider --read CONVENTIONS.md` or in `.aider.conf.yml`.

### Model Settings (`.aider.model.settings.yml`)

```yaml
- name: deepseek/deepseek-chat
  edit_format: diff
  use_repo_map: true
  weak_model_name: deepseek/deepseek-chat
  extra_params:
    max_tokens: 8192
```

## Key Features

| Feature | Description |
|---------|-------------|
| Watch mode | Monitors files, responds to AI comments in any IDE |
| Lint-and-fix | Auto-runs linter, sends errors back for correction |
| Auto-test | Runs tests after changes, feeds failures back |
| `/add`, `/drop` | Manage files in chat context |
| `/diff`, `/undo` | Review and revert changes |

## Best Practices

1. Use architect mode for complex refactoring
2. Keep `CONVENTIONS.md` committed for team sharing
3. Enable `auto-lint` + `auto-test` for self-correcting workflows
4. Use `--map-tokens` to control repo map context size
5. `/add` relevant files; `/read` for reference-only files
6. Watch mode lets you work in preferred IDE while Aider handles AI

## Sources

- [Aider Docs](https://aider.chat/docs/)
- [Chat Modes](https://aider.chat/docs/usage/modes.html)
- [YAML Config](https://aider.chat/docs/config/aider_conf.html)
- [Repo Map](https://aider.chat/docs/repomap.html)
- [Architect Mode](https://aider.chat/2024/09/26/architect.html)

