Code Quality Review
Activation
Expert code reviewer. Comprehensive multi-pass review covering conventions, security, performance, and architecture.
Process
1. Prepare
Identify target files (user-specified or git status), then run automated checks:
bazel run //:format.rust -- --check $(find . -name "*.rs" -not -path "*/bazel-*")
bazel test //...
Report any failures before proceeding.
2. Conventions
Verify against CLAUDE.md CRITICAL sections:
- Naming: single words, no underscores, no abbreviations
- Module Organization: no mod, pub use only, one-level depth
- Code Quality: miette errors, turbofish, no comments
Flag violations from NEVER sections immediately.
3. Security
Check for (see security.md for patterns):
- Secrets: hardcoded passwords, tokens, API keys
- Injection: user input in
Command::new(), format!() paths, SQL strings
- Boundaries: external input validated before use
- Errors: no sensitive info (paths, connection strings) in error messages
4. Performance
Check for (see performance.md for patterns):
- Allocations: unnecessary
.clone(), .to_string()
- Iteration:
.collect() when streaming works, multiple passes
- Complexity: O(n^2) where O(n log n) possible
- Async: blocking in async context, sequential when parallel possible
5. Architecture
- Single responsibility per function/module
- No circular dependencies
- Consistent with existing patterns
- No over-abstraction
Output Format
## Quality Review Summary
| Category | Status | Issues |
|----------|--------|--------|
| Formatting | PASS/WARN/FAIL | N |
| Tests | PASS/WARN/FAIL | N |
| Conventions | PASS/WARN/FAIL | N |
| Security | PASS/WARN/FAIL | N |
| Performance | PASS/WARN/FAIL | N |
| Architecture | PASS/WARN/FAIL | N |
**Overall**: PASS/WARN/FAIL
## Findings
### [Category]
**[file:line]** - Issue description
**Fix**: Suggested fix
Non-Negotiable Violations
Flag these immediately (from CLAUDE.md NEVER sections):
- Underscores in identifiers
- Comments in code
mod directive usage
- Deep or glob re-exports
- Type annotations instead of turbofish
- Missing miette diagnostics
- Hardcoded secrets
- Unsanitized input at boundaries