Configs2026年5月7日·1 分钟阅读

.aider.conf.yml — Production Aider Configuration

Drop-in `.aider.conf.yml` template with project Aider settings — auto-test, lint, model split, file ignores. Production-tested from 36K-star community.

Agent 就绪

这个资产可以被 Agent 直接读取和安装

TokRepo 同时提供通用 CLI 命令、安装契约、metadata JSON、按适配器生成的安装计划和原始内容链接,方便 Agent 判断适配度、风险和下一步动作。

Needs Confirmation · 66/100策略:需确认
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:New
入口
Asset
通用 CLI 安装命令
npx tokrepo install 553b65cc-501c-4012-97d9-ed08ca3c6415

简介

.aider.conf.yml 是 Aider 的项目级配置文件。一次设好模型、lint 命令、测试命令、自动加入的文件、绝不能动的文件,每次跑 aider 自动读,不用重复打 flag。适合团队标准化 Aider 在某个仓库里的行为。需要 Aider 0.40+。装机时间 30 秒。


直接用这份模板

# .aider.conf.yml — 提交进仓库根目录

# 模型选择(architect/editor 分离省 token)
model: claude-3-5-sonnet-20241022
editor-model: claude-3-5-haiku-20241022
weak-model: claude-3-5-haiku-20241022

# 每次编辑后自动跑
auto-test: true
test-cmd: "pytest -x --no-cov"
lint: true
auto-lint: true
lint-cmd:
  - "python: ruff check --fix"
  - "javascript: eslint --fix"

# 仓库行为
git: true
auto-commits: true
attribute-author: true
attribute-committer: true
gitignore: true

# 文件
read:
  - README.md
  - docs/architecture.md
  - .clinerules
file:
  - src/main.py

# 绝不能编辑(secrets、生成代码、vendored)
no-edit:
  - .env
  - .env.*
  - "*.lock"
  - "package-lock.json"
  - "yarn.lock"
  - "src/generated/**"

# 成本 / 速度旋钮
cache-prompts: true
map-tokens: 1024
max-chat-history-tokens: 8000

按仓库覆盖

Aider 会同时读 ~/.aider.conf.yml(用户级)和 .aider.conf.yml(仓库级)。仓库级覆盖用户级。常用模式:用户级设默认 API key 和模型偏好,仓库级加项目专属 lint 命令和 read 文件。

Watch 模式

watch-files: true

设上之后,Aider 监听编辑器里的 AI 注释标记(# AI:// AI:),保存时自动编辑文件。在 VS Code 或 vim 里直接触发 Aider,不用切窗口。


FAQ

Q: .aider.conf.yml 放哪? A: 项目专属放仓库根目录。用户级默认放 ~/.aider.conf.yml。两个可以共存 —— 都定义了某个设置时仓库级赢。

Q: no-edit 跟 .gitignore 啥关系? A: Aider 默认就尊重 .gitignore(gitignore: true flag)。no-edit 是额外的保护:那些已经入了 git 但你不想 Aider 改的文件 —— 比如生成代码、lock 文件、.env 模板。

Q: architect/editor 分离真能省钱? A: 能 —— 长重构通常省 60-80%。Architect(Sonnet)用贵 token 规划一次改动;Editor(Haiku,10 倍便宜)执行实际编辑。一行小改动的节省更小。


🙏

来源与感谢

Pattern derived from Aider documentation. Licensed under Apache-2.0.

Aider-AI/aider — ⭐ 36,000+

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产