| name | finstack-consistency-reviewer |
| description | Reviews finstack-quant code for cross-module consistency: naming conventions, pattern drift, Rust/Python/WASM naming triplets, builder/error/module conventions, and convention inventory updates. Use when the user asks to make patterns consistent, unify naming, check conventions, or find pattern drift. Prefer finstack-simplify for dedupe/API-surface consolidation and finstack-refactor for implementation changes. |
Consistency Reviewer
Reviews code for consistency across the codebase. Unlike other reviewers that focus on correctness, performance, or simplicity, this skill ensures similar things are done the same way everywhere.
Quick Start
When asked to review for consistency, produce output in this format:
## Consistency Review: [scope]
### Summary
[1-2 sentence overview of findings]
### Findings
#### [SEVERITY] [Category]: [Title]
**Where:** file1.rs:L10, file2.rs:L20
**Pattern A:** `description of one approach`
**Pattern B:** `description of divergent approach`
**Recommendation:** [which pattern to standardize on and why]
Severity Levels
| Level | Meaning |
|---|
| Blocker | Public API inconsistency that confuses users or breaks expectations |
| Major | Internal pattern divergence that increases maintenance burden |
| Minor | Cosmetic inconsistency or missed std-lib opportunity |
| Nit | Style preference, acceptable if intentional |
Review Checklist
Work through each category. For every check, compare at least 3 instances across different modules before flagging.
1. Naming Conventions
Rust:
Python bindings:
WASM bindings:
Cross-binding:
2. Pattern Consistency
Error handling:
Builders:
Trait implementations:
Module structure:
3. Missed Rust Std-Lib & Language Features
4. Duplicate & Near-Duplicate Functionality
5. API Surface Consistency
6. Documentation Consistency
Review Process
- Scope: Identify the modules/crates under review
- Inventory: List all instances of each pattern category within scope
- Compare: For each category, identify the dominant pattern and any deviations
- Classify: Is the deviation intentional (documented) or accidental (drift)?
- Recommend: For each inconsistency, recommend which pattern to standardize on
Decision Framework
When two patterns conflict, prefer:
- Majority wins: The pattern used in more places (lower migration cost)
- Std-lib idiomatic: The pattern closer to Rust conventions
- Public-facing: The pattern used in public APIs (harder to change)
- Newer code: The pattern in recently-written code (likely reflects current intent)
Output Template
## Consistency Review: [scope]
### Summary
Found X findings (Y blocker, Z major, W minor, V nit) across N files.
### Findings
#### [BLOCKER] Naming: Builder method prefix inconsistency
**Where:** discount_curve.rs:L1012 (`set_interp()`), hazard_curve.rs:L45 (`knots()`)
**Pattern A:** `set_` prefix on setter methods (3 occurrences)
**Pattern B:** bare name for setter methods (12 occurrences)
**Recommendation:** Standardize on bare names (majority pattern, more ergonomic)
#### [MAJOR] Pattern: Error module location
**Where:** core/src/error/mod.rs, portfolio/src/error.rs, scenarios/src/error.rs
**Pattern A:** `error/mod.rs` with submodules (1 crate)
**Pattern B:** `error.rs` flat file (3 crates)
**Recommendation:** Use `error.rs` for crates with <5 error variants, `error/mod.rs` for larger
### Convention Inventory
[Optional: table of all patterns found and their locations for reference]
Additional Resources