使用教程
Aider 最适合在 Git 仓库里对少量文件做精确修改。第一次使用时,不要把整个项目都交给它。
只让 Aider 看少量文件
bash
aider src/login.js src/api.js --model openai/YOUR_MODEL_ID进入提示符后输入:
text
Explain the login flow in these two files. Do not modify code.修改指定文件
text
Fix the missing error message when login fails. Only modify the files already added to the session.添加文件到会话
text
/add src/components/LoginForm.jsx查看改动
text
/diff撤销改动
text
/undo获取帮助
text
/help推荐工作流
- 在 Git 仓库中运行 Aider。
- 每次只添加和任务相关的文件。
- 先让 Aider 解释问题,再让它修改。
- 修改后查看 diff。
- 运行测试或构建命令。
- 不满意就使用
/undo。
不要一开始就把整个项目都加进会话。文件越多,成本越高,也越容易让模型分散注意力。
适合的任务示例
text
Add edge-case handling to the current function and explain why.text
Fix the code based on this test failure. Only modify the current file.text
Extract this duplicated logic into a function while preserving behavior.