Perform comprehensive code reviews for the Tepora project, covering Rust, React, and architecture.
This skill enables the agent to perform comprehensive code reviews for the Tepora project, a privacy-focused local LLM assistant with episodic memory (EM-LLM) built with Rust, Tauri, React, and TypeScript.
Trigger this skill when:
Understand Tepora's unique characteristics:
Review must cover:
# Before starting, understand project structure
# Use list_dir and view_file to explore
ls -R /path/to/tepora-project
cat /path/to/tepora-project/README.md
cat /path/to/tepora-project/docs/architecture/ARCHITECTURE.md
Output: Brief summary of project state and review scope.
Determine what to review:
For PR Review:
# If reviewing a specific PR or branch
git diff --name-only main...feature-branch
git diff main...feature-branch
For Module Review: Focus on specific directories:
Tepora-app/src-tauri/ - Rust backendTepora-app/src/ - React/TS frontenddocs/ - Documentation.github/ - CI/CD workflowsFor Full Project Review: Review all major components systematically.
For each file reviewed, apply the appropriate checklist:
# Run automated checks first
cd Tepora-app && cargo clippy --all-features -- -D warnings
cd Tepora-app && cargo fmt -- --check
cd Tepora-app && cargo test
Manual Review Checklist:
Ownership & Lifetimes
Error Handling
Result and Option used appropriately?? operator?Concurrency & Safety
Arc and Mutex used correctly?unsafe code justified and documented?Tauri Integration
#[tauri::command]?EM-LLM Specifics
Performance
Example Analysis Output:
### File: src-tauri/src/memory/episodic.rs
**Strengths:**
- ✅ Good use of `serde` for serialization
- ✅ Proper error handling with custom `MemoryError` type
- ✅ Thread-safe access with `Arc<RwLock<T>>`
**Issues:**
- ⚠️ Line 45: Unnecessary `.clone()` on `episode_id` - can use reference
- ⚠️ Line 78: Consider using `BTreeMap` instead of `HashMap` for sorted keys
- ❌ Line 120: Sensitive data (user content) stored without encryption
**Recommendations:**
1. Add encryption layer for stored memories
2. Implement LRU cache for frequently accessed memories
3. Add comprehensive unit tests for edge cases
# Run automated checks
cd Tepora-app && npm run type-check
cd Tepora-app && npm run lint
cd Tepora-app && npm test
Manual Review Checklist:
Type Safety
any)?React Best Practices
Component Design
Accessibility
Cyber Tea Salon UX
Example Analysis Output:
### File: src/components/ChatInterface.tsx
**Strengths:**
- ✅ Good separation of chat logic into custom hook
- ✅ Accessible with proper ARIA labels
- ✅ Smooth scroll-to-bottom animation
**Issues:**
- ⚠️ Line 34: Missing dependency in useEffect array (`userId`)
- ⚠️ Line 67: Inefficient - re-creating `handleSubmit` on every render
- ❌ Line 89: Using `any` type for message object
**Recommendations:**
1. Add `userId` to useEffect dependencies or use useCallback
2. Wrap `handleSubmit` in `useCallback` with proper dependencies
3. Define explicit `Message` interface
4. Consider virtualization for long chat histories
Always check:
Data Privacy
Input Validation
Dependencies
cargo audit
npm audit
Secrets Management
grep -r "password\|secret\|api_key" --include="*.rs" --include="*.ts" src/
# Rust performance
cargo build --release
cargo bench # if benchmarks exist
# Frontend bundle analysis
npm run build
npx vite-bundle-visualizer
Check:
Create a comprehensive report using this template:
# Tepora Code Review Report
**Date**: [Current Date]
**Reviewer**: AI Agent
**Scope**: [PR #XXX / Module / Full Project]
**Status**: [✅ Approved / ⚠️ Minor Changes / ❌ Major Changes]
---
## Executive Summary
[2-3 sentence overview of findings]
## Strengths 🎯
1. [Positive finding 1]
2. [Positive finding 2]
3. ...
## Critical Issues ❌
### Issue 1: [Title]
- **File**: `path/to/file.rs:123`
- **Severity**: Critical
- **Description**: [What's wrong]
- **Impact**: [Why it matters]
- **Fix**: [How to resolve]
- **Code Example**:
```rust
// Before
[problematic code]
// After
[suggested fix]
[Same format as Critical]
[Same format, but less urgent]
[Discussion of architectural patterns, consistency, scalability]
[Privacy, data protection, vulnerability assessment]
[Speed, memory, resource usage analysis]
[Summary paragraph with overall assessment]
Next Steps: [What should happen next]
## Advanced Review Techniques
### 1. Architectural Pattern Recognition
Identify and validate patterns:
- **Command Pattern**: Tauri commands for frontend-backend communication
- **Repository Pattern**: EM-LLM memory storage abstraction
- **Observer Pattern**: React state management
- **Factory Pattern**: Agent creation and management
### 2. Privacy-First Validation
For Tepora specifically, always verify:
```rust
// ✅ Good: Local storage
let memory_path = app_data_dir().join("memories.db");
// ❌ Bad: External API call without user consent
let response = reqwest::get("https://api.example.com/log")
.await?;
Look for memory-intensive operations:
// ⚠️ Potential issue: Loading entire history into memory
let all_memories: Vec<Episode> = db.get_all_episodes()?;
// ✅ Better: Pagination or streaming
let recent_memories = db.get_episodes_paginated(0, 50)?;
Verify thread safety:
// ✅ Good: Proper synchronization
let state = Arc::new(RwLock::new(AppState::new()));
// ❌ Bad: Shared mutable state without synchronization
static mut GLOBAL_COUNTER: i32 = 0;
Unnecessary Cloning
// ⚠️ Bad
fn process(data: Vec<String>) {
for item in data.clone() { ... }
}
// ✅ Good
fn process(data: &[String]) {
for item in data { ... }
}
Blocking in Async Context
// ❌ Bad
async fn load_memory() {
std::thread::sleep(Duration::from_secs(1)); // blocks executor
}
// ✅ Good
async fn load_memory() {
tokio::time::sleep(Duration::from_secs(1)).await;
}
Infinite Re-render Loop
// ❌ Bad
useEffect(() => {
setState({ ...state, updated: true });
}); // Missing dependency array!
// ✅ Good
useEffect(() => {
setState({ ...state, updated: true });
}, [/* dependencies */]);
Type Coercion Abuse
// ⚠️ Bad
const userId = props.user as any;
// ✅ Good
interface User { id: string; name: string; }
const userId: string = props.user.id;
Always structure your review output as follows:
User: "Review the memory module in src-tauri/src/memory/mod.rs"
Agent Response:
I'll review the memory module following the Tepora code review workflow.
[Runs automated checks]
[Views the file]
[Analyzes code]
[Generates detailed report]
Here's my review:
# Memory Module Review
## Summary
The memory module implements the core EM-LLM functionality. Overall structure is solid, but found 3 critical issues related to encryption and 2 performance optimizations.
[... detailed findings ...]
After each review:
This skill integrates with:
Be aware of:
A successful review:
Remember: The goal is not just to find bugs, but to help Tepora become the best "memory-enhanced" AI companion it can be, while maintaining its privacy-first, user-friendly ethos.