Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Guides writing and reviewing idiomatic Rust using Apollo GraphQL's best practices handbook: ownership, errors, performance, testing, docs.
78% 96%+17 ptsof test cases passed
Passed 22 of 23 test cases with the skill, and 18 of 23 without it.
3 of 3 safety checks passed
Not used yet
Clear code beats clear comments. However, when the why isn't obvious, comment it plainly - or link to where you can read more context.
| Purpose | Use // comment | Use /// doc or //! crate doc |
|---|---|---|
| Describe Why | ✅ Yes - explains tricky reasoning | ❌ Not for documentation |
| Describe API | ❌ Not useful | ✅ Yes - public interfaces, usage, details, errors, panics |
| Maintainable | 🚨 Often becomes obsolete and hard to reason | ✅ Tied to code, appears in generated docs and can run test cases |
| Visibility | Local development only | Exported to users and tools like cargo doc |
Use // comments (double slashed) when something can't be expressed clearly in code, like:
#[cfg(..)].Name your comments! For example, a comment regarding a safety guarantee should start with
// SAFETY: ....
// SAFETY: `ptr` is guaranteed to be non-null and aligned by caller
unsafe { std::ptr::copy_nonoverlapping(src, dst, len); }
// CONTEXT: Reuse root cert store across subgraphs to avoid duplicate OS calls:
// [ADR-12](link/to/adr-12): TLS Performance on MacOS
Avoid comments that:
// increment i by 1 for the next loop).Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.