You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -120,6 +120,11 @@ See `docs/engineering-standards.md` for the full rationale and additional testin
120
120
### Arithmetic in Tests
121
121
Do not suggest using `checked_add`, `checked_mul`, `checked_sub`, `saturating_add`, or similar checked/saturating arithmetic in test code — this includes `#[cfg(test)]` modules, integration test crates, and e2e test crates. Raw arithmetic operators (`+`, `-`, `*`, `/`) are fine in tests — overflow will cause a panic, which is the desired behavior in tests.
122
122
123
+
### Trait Naming
124
+
Traits should model a single capability, and be named after the action, not as an agent noun derived from it: `ReadContractState`, not `ContractStateReader`. This follows std-idiomatic patterns (`From*`/`Into*`/`To*` conversions). This applies to new traits and opportunistic renames, existing traits may deviate from this principle.
125
+
126
+
See `docs/engineering-standards.md` §Name capability traits after the action for the full rationale and a `Don't` / `Do` example.
127
+
123
128
### Code Comments
124
129
Default to writing no comments. Add one only in case one of the following applies:
125
130
- the *why* is non-obvious: an invariant, a constraint, a surprising behavior;
@@ -131,8 +136,12 @@ Avoid comments that are:
131
136
- explaining common knowledge or terminology;
132
137
- burdening the reader with non-relevant information;
133
138
139
+
AI-generated code tends to arrive with obvious comments: restating what the next line does, labeling steps (`// setup`, `// send the request`), or narrating the edit that produced the code. Strip these before submitting. Keep a comment only if it says something the code cannot; if a reader can reconstruct it from the names and types on the same screen, delete it. This applies doubly in tests, where the `// Given` / `// When` / `// Then` structure already tells the story.
140
+
134
141
Prefer concise comments, using correct terminology.
135
142
143
+
In doc comments, reference other items with rustdoc intra-doc links (`` [`Foo`] ``), not plain `` `Foo` `` backticks. CI rejects broken links in everything rustdoc documents (test code is outside its view), and only linked references are checked at all; a plain backtick reference rots silently when the item is renamed. A backticked word that merely looks like an item (an algorithm name, a type from a crate we do not depend on, a `cfg(test)` item invisible to rustdoc) stays a plain code span.
144
+
136
145
See `docs/engineering-standards.md` §Write helpful code comments for the full rationale and a `Don't` / `Do` example.
0 commit comments