rustgrade: a Rust scanner for the habits coding agents leave behind
说明与用途
rustgrade 是一个快速的 Rust 语法扫描器,能够检测由编码代理留下的常见反模式,并帮助修复它们,支持与 AI 编码平台集成。
问题
Agents often generate Rust code with subtle anti‑patterns (e.g., .unwrap(), locks held across .await, unsafe blocks without comments) that compile but degrade quality.
结果
In 27 Claude Code runs, rustgrade reduced .unwrap()/expect in library code from 5 to 0 when used via a hook or a short section in CLAUDE.md, with negligible cost increase.
工作流
- 1. Install rustgrade via cargo binstall
- 2. Run rustgrade scan or audit on a crate
- 3. For agents, enable the rustgrade skill or use /audit or /harden commands
- 4. Review findings in CI or agent feedback
- 5. Fix flagged code or silence with rustgrade: allow(...) comments
证据
I counted .unwrap()/expect in library code with cargo clippy --lib, so test code doesn't count.
rustgrade scan and rustgrade audit work in a terminal or in CI, with --fail-on thresholds and SARIF output for GitHub code scanning.
The scanner took about 20 ms on a 445‑line file on my machine, which is fast enough to run on every single edit an agent makes.
- 记录日期: 2026-11-01T07:28:50.566Z