Loading...
Loading...
Production-ready code implementation following approved designs. Writes clean, tested, documented code. Zero linting violations. All code includes tests.
npx skill4agent add terraphim/terraphim-skills implementationcargo clippycargo fmt[ ] Code compiles without warnings
[ ] All clippy lints pass
[ ] Code is formatted with rustfmt
[ ] Unit tests written and passing
[ ] Integration tests if applicable
[ ] Documentation for public API
[ ] Error handling is complete
[ ] No TODO comments left unaddressed
[ ] CHANGELOG updated if needed// Use thiserror for library errors
#[derive(Debug, thiserror::Error)]
pub enum MyError {
#[error("failed to process: {0}")]
Processing(String),
#[error(transparent)]
Io(#[from] std::io::Error),
}
// Use anyhow in applications
fn main() -> anyhow::Result<()> {
// ...
}#[derive(Default)]
pub struct ConfigBuilder {
timeout: Option<Duration>,
retries: Option<u32>,
}
impl ConfigBuilder {
pub fn timeout(mut self, timeout: Duration) -> Self {
self.timeout = Some(timeout);
self
}
pub fn build(self) -> Config {
Config {
timeout: self.timeout.unwrap_or(Duration::from_secs(30)),
retries: self.retries.unwrap_or(3),
}
}
}// Prefer tokio for async runtime
use tokio::sync::mpsc;
// Use channels for communication
async fn worker(mut rx: mpsc::Receiver<Task>) {
while let Some(task) = rx.recv().await {
process(task).await;
}
}Self?#[must_use]unwrap()expect()unsafe