rust
Instructions for working in Rust codebases
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Instructions for working in Rust codebases
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
ask questions until shared understanding is reached
summarize the current session into a concise, well-structured document for the purpose of persisting important information across agent sessions
use for working with jj (jujutsu) version control system
invoked by the user to identify refactoring opportunities in the codebase
| name | rust |
| description | Instructions for working in Rust codebases |
Choose from these libraries if you need any of this functionality:
Prefer small functions, if a function is more than a screen height, try to split it up. If match arms get big, extract them into functions.
Unless there is a clear benefit, performance or otherwise, always prefer immutable variables.
Prefer organizing the code such that any structs have a new() -> Result<Self> method that takes any necessary arguments for construction and returns either Ok(self) or an error (thiserror custom error, or an anyhow error depending on where it is). Avoid interior mutability if possible.
If possible, always use iterators, maps and filters instead of for loops. Also for working with Options and Results.
Prefer &str and Cow<str> over String, .to_string(). Use references over calling clone if possible.
Always prefer proper error handling or at least an .expect() with a good description.
If a component needs to be shared or needs multiple implementations, create a trait with the public methods, then for each implementation create a struct with it's config and internal state, but then for impl Trait for Struct implement the methods such that they call a free-standing module-internal fn that just takes the minimum parameters and can be tested in isolation.
After any major code interventions, always run the following:
cargo fmt
cargo clippy --all-targets