Skip to main content

Performance

  1. Minimize WASM binary size with opt-level = "z" and LTO.
  2. Keep prompts concise and cap max_tokens.
  3. Batch indexing and process in chunks for large datasets.

User Experience

  1. Log progress for long operations.
  2. Provide clear, actionable error messages.
  3. Handle missing permissions without crashing.

Code Quality

Error Handling

let data = clipboard::read_text()
    .map_err(|e| format!("Failed to read clipboard: {}", e))?;

Testing

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_feature() {
        // Test your app logic
    }
}

Documentation

/// Analyzes code and returns suggestions.
///
/// # Arguments
/// * `code` - The source code to analyze
///
/// # Returns
/// Analysis results as a formatted string
fn analyze(code: &str) -> Result<String> {
    // ...
}