Pre-action boundary checking — validates agent tool calls against declared capabilities and task contracts
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Idiomatic Rust patterns from official guidelines
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
설치 방법 보기설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.
Apply idiomatic Rust patterns and best practices from official documentation.
Safety without garbage collection
Zero-cost abstractions
Fearless concurrency
Ownership as a feature
crates:
style: snake_case or kebab-case
example: my_crate, my-crate
modules:
style: snake_case
example: my_module
types:
style: UpperCamelCase
example: MyStruct, MyEnum
traits:
style: UpperCamelCase
example: Iterator, Display
functions_methods:
style: snake_case
example: my_function, get_value
constants:
style: SCREAMING_SNAKE_CASE
example: MAX_SIZE
type_parameters:
style: single uppercase or CamelCase
example: T, E, Item
lifetimes:
style: short lowercase
example: 'a, 'b, 'static
macros:
style: snake_case!
example: vec!, println!
principles:
- Each value has exactly one owner
- References cannot outlive the data they reference
- Either one mutable reference OR many immutable references
prefer:
- "&T over T" when not needing ownership
- "&mut T over T" when modifying without consuming
- "T over Box<T>" when size is known at compile time
avoid:
- Clone when borrowing suffices
- RefCell unless interior mutability is needed
- Unsafe unless absolutely necessary
result_type:
- Return Result<T, E> for recoverable errors
- Use ? operator for propagation
- Define custom error types for libraries
option_type:
- Use Option<T> for nullable values
- Prefer map/and_then over match when appropriate
- Use unwrap_or, unwrap_or_else, unwrap_or_default
panic:
- Only for unrecoverable errors
- Use in tests with assert!, assert_eq!
- Avoid in library code
patterns: |
// Propagation with ?
fn read_file() -> Result<String, io::Error> {
let mut file = File::open("file.txt")?;
let mut contents = String::new();
file.read_to_string(&mut contents)?;
Ok(contents)
}
// Custom error type
#[derive(Debug)]
enum MyError {
Io(io::Error),
Parse(ParseIntError),
}
trait_design:
- Keep traits focused and small
- Use associated types for output types
- Implement standard traits: Debug, Clone, Default, PartialEq
standard_traits:
- Debug: for debugging output
- Clone: explicit duplication
- Default: default value construction
- PartialEq, Eq: equality comparison
- PartialOrd, Ord: ordering
- Hash: for HashMap keys
- Display: user-facing output
- From/Into: type conversion
generics:
- Use trait bounds to specify requirements
- Prefer impl Trait in argument position
- Use where clauses for complex bounds
stack_vs_heap:
- Stack: fixed-size, Copy types
- Heap: dynamic-size, Box, Vec, String
smart_pointers:
- Box<T>: heap allocation with single owner
- Rc<T>: reference counting (single-threaded)
- Arc<T>: atomic reference counting (multi-threaded)
- RefCell<T>: interior mutability
avoid_leaks:
- Drop trait for cleanup
- RAII pattern for resources
- Weak references to break cycles
send_sync:
- Send: safe to transfer between threads
- Sync: safe to share references between threads
primitives:
- Mutex<T>: mutual exclusion
- RwLock<T>: multiple readers or one writer
- Arc<T>: thread-safe reference counting
- mpsc: channels for message passing
patterns: |
// Shared state with Arc and Mutex
let counter = Arc::new(Mutex::new(0));
let counter_clone = Arc::clone(&counter);
thread::spawn(move || {
let mut num = counter_clone.lock().unwrap();
*num += 1;
});
// Message passing
let (tx, rx) = mpsc::channel();
thread::spawn(move || {
tx.send(value).unwrap();
});
let received = rx.recv().unwrap();
guidelines:
- Accept borrowed data when possible
- Return owned data when the caller needs it
- Use Into/AsRef for flexible parameters
- Implement standard conversion traits
constructors:
- new() for primary constructor
- with_* for alternative constructors
- Builder pattern for many parameters
methods:
- is_* for boolean queries
- as_* for cheap conversions (borrows)
- to_* for expensive conversions (copies)
- into_* for ownership transfers
rules:
- Document all public items
- Include examples in doc comments
- Use # Examples section
- Document panics, errors, safety
format: |
/// Brief description.
///
/// More detailed explanation if needed.
///
/// # Examples
///
/// ```
/// let result = my_function(42);
/// assert_eq!(result, 84);
/// ```
///
/// # Panics
///
/// Panics if the input is zero.
pub fn my_function(x: i32) -> i32 {
x * 2
}
layout:
- src/lib.rs or src/main.rs: crate root
- src/bin/: additional binaries
- tests/: integration tests
- benches/: benchmarks
- examples/: example programs
modules:
- One module per file
- mod.rs or filename.rs for module
- pub use for re-exports
When writing or reviewing Rust code:
아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.
로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.
아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.
Pre-action boundary checking — validates agent tool calls against declared capabilities and task contracts
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Auto-detect project context and optimize harness — deactivate unused agents/skills, suggest missing experts, generate project profile
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Adversarial code review using attacker mindset — trust boundary, attack surface, business logic, and defense evaluation
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Apache Airflow best practices for DAG authoring, testing, and production deployment
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Alembic migration patterns for naming conventions, safety checks, expand-contract, env.py configuration, and CI integration
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Pre-routing ambiguity analysis — scores request clarity and asks clarifying questions when needed (inspired by ouroboros)
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.