Skip to content

Commit 2ee3725

Browse files
committed
extend llm guidance
1 parent 9d85466 commit 2ee3725

1 file changed

Lines changed: 46 additions & 6 deletions

File tree

src/llm-guidance.md

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,60 @@
1-
# Running LLMs
1+
# Working with LLMs
22

33
This is a non-binding list of suggestions for working with LLMs.
44
This is not our moderation policy; see [Forge][LLM policy].
55

6-
## Review bots
6+
[LLM policy]: https://forge.rust-lang.org/policies/llm-usage.html
7+
8+
## Automated checks and LLM review
79

810
- If a more reliable tool, such as a linter or formatter, already exists for the language you're writing, we strongly suggest using that tool instead of or in addition to the LLM.
911
- Configure LLM review tools to reduce false positives and excessive focus on trivialities, as these are common, exhausting failure modes.
1012
- Wherever possible, ask an LLM to *generate a linter*, which you then tell it to run.
1113
This both saves on token costs, and allows people who are not using an LLM to run the analysis.
12-
- Note that LLMs sometimes demonstrate a preference for LLM output, particularly output from the same model.
14+
- LLMs sometimes prefer LLM-generated output, particularly output from the same
15+
model. Treat LLM review as advisory, and do not rely on the model that
16+
produced a change as its only reviewer.
1317

14-
## LLM-authored code
18+
## Writing LLM-created code
1519

16-
- We recommend, but do not require, using a second LLM for adversarial local review before publishing your changes.
20+
- We recommend, but do not require, using a different model for adversarial
21+
local review before publishing your changes. This does not replace human
22+
self-review.
1723
- Mass renames or rewrites should *strongly* prefer using a proper syntax rewrite tool, such as [`ast-grep`].
1824
You may use an LLM for generating the instructions for that tool, but you should be very cautious about performing the rewrite directly with an LLM.
1925

20-
[LLM policy]: https://forge.rust-lang.org/policies/llm-usage.html
26+
[`ast-grep`]: https://astgrep.com/
27+
28+
## Reviewing LLM-created code
29+
30+
Point people to [#llm-mentoring](https://rust-lang.zulipchat.com/#narrow/channel/606558-llm-mentoring/) liberally.
31+
Deal with low-quality PRs by closing the PR and asking the author to follow the "solicited" rule in the Forge policy.
32+
Deal with borderline PRs by asking the author to do work that shows they're paying attention; it's ok to ask for that work before you've put much time into review yourself.
33+
For example, ask them to reproduce the bug, explain the change in their own
34+
words, identify relevant edge cases, or add or justify tests.
35+
36+
If you find yourself suggesting the same fixes on multiple PRs,
37+
consider adding them to the dev-guide.
38+
39+
## Disclosure guidelines
40+
41+
Disclose the *extent* and *purpose* of your LLM use.
42+
We don't care which model you used, but we do care whether you used the LLM to
43+
implement the idea or to come up with it.
44+
Write the disclosure yourself. You may use an LLM to privately review a
45+
disclosure you have written, but not to draft or rewrite it.
46+
47+
**Good** examples:
48+
49+
> LLM disclosure: I wrote the three commits by hand after viewing profiling data. I used an LLM to review the commits before submitting. The LLM identified that ImplString::is_negative was no longer used, so I removed that field by hand.
50+
51+
> Created with the help of Claude Code, which:
52+
> - traced the missing cache hits to the unconditional return(pass) by inspecting Fastly vs CloudFront headers,
53+
> - reviewed the git history to understand why the snippet was added, and
54+
> - made the VCL change.
55+
56+
**Bad** examples:
57+
58+
> 🤖 Generated with Claude Code
59+
60+
> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

0 commit comments

Comments
 (0)