- REFACTOR_ROADMAP.md - Complete implementation guide (18 issues with detailed tasks)
- REFACTOR_ISSUES.md - Quick reference and execution strategy
- 18 GitHub Issues (#65-#82) - Ready to track and execute
All issues created with proper labels and milestone organization:
| Issue | Title | Labels |
|---|---|---|
| #65 | Create mutation hooks to replace direct repository calls | refactor, architecture, quick-win |
| #66 | Extract currency conversion logic from repository to engine | refactor, architecture, quick-win, testability |
| #67 | Centralize FX conversion utility and eliminate duplication | refactor, duplication, quick-win |
| #68 | Add named constants for epsilon values | refactor, documentation, quick-win |
Impact: Fixes 8 boundary violations, eliminates 6+ duplications, enables testability
| Issue | Title | Labels |
|---|---|---|
| #69 | Create ExpenseService to separate orchestration | refactor, architecture, service-layer, testability |
| #70 | Create TripService for multi-step operations | refactor, architecture, service-layer |
| #71 | Centralize error handling with factories | refactor, duplication, error-handling |
| #72 | Replace singleton FxRateProvider with Context | refactor, architecture, testability |
Impact: Establishes service layer pattern, eliminates 20+ error duplications, removes global state
| Issue | Title | Labels |
|---|---|---|
| #73 | Create centralized validation utilities | refactor, duplication, validation |
| #74 | Create centralized formatting utilities | refactor, duplication |
| #75 | Add JSDoc contracts to public APIs | documentation |
Impact: Eliminates 3 validation duplications, 12+ formatting duplications, improves API clarity
| Issue | Title | Labels |
|---|---|---|
| #76 | Restrict module exports to public APIs only | refactor, architecture |
| #77 | Add ESLint rules to enforce boundaries | tooling, architecture |
| #78 | Add architecture tests with dependency-cruiser | tooling, architecture |
| #79 | Create ARCHITECTURE.md documentation | documentation, architecture |
Impact: Prevents regressions, automates architecture enforcement, comprehensive onboarding docs
| Issue | Title | Labels |
|---|---|---|
| #80 | Add runtime invariant checks | refactor, testability |
| #81 | Add floating-point documentation | documentation |
| #82 | Create contribution guide | documentation |
Impact: Enhanced debugging, clearer rationale, contributor onboarding
Week 1: Foundation 🔥
- #65 - Create mutation hooks (fixes 8 violations, 2-4 hours)
- #66 - Extract conversion logic (enables testing, 1-2 hours)
- #67 - Centralize FX utility (prevents drift, 1 hour)
- #68 - Named constants (clarity, 15 min)
- #69 - ExpenseService (biggest improvement, 4-6 hours)
- #70 - TripService (pattern consistency, 3-4 hours)
Week 2: Duplication & Standards 7. #71 - Error factories (20+ duplications, 4-6 hours) 8. #72 - Context over singleton (testability, 2-3 hours) 9. #73 - Validation utilities (3 duplications, 2-3 hours) 10. #74 - Formatting utilities (12+ duplications, 2-3 hours)
Week 3: Long-Term Hardening 11. #79 - ARCHITECTURE.md (high value documentation, 3-4 hours) ⭐ 12. #76 - Restrict exports (encapsulation, 1 hour) 13. #77 - ESLint rules (enforcement, 3-4 hours) 14. #75 - JSDoc contracts (API clarity, 4-6 hours) 15. #78 - Architecture tests (optional, 4-6 hours)
Optional: 16. #80, #81, #82 - As time permits
Track these metrics as you close issues:
| Metric | Before | After Target | Key Issues |
|---|---|---|---|
| Boundary Violations | 8 screens | 0 | #65 |
| Business Logic in Repos | 3 modules | 0 | #66, #69, #70 |
| FX Conversion Duplication | 6+ locations | 1 utility | #67 |
| Error Handling Duplication | 20+ manual | Centralized | #71 |
| Validation Duplication | 3 implementations | 1 utility | #73 |
| Formatting Duplication | 12+ toFixed calls | 1 utility | #74 |
| Module Encapsulation | Leaky | Enforced | #76 |
| Architecture Violations | Unknown | 0 (enforced) | #77, #78 |
| Architecture Docs | None | Complete | #79 |
After completing all issues:
- ✅ Zero boundary violations (screens use hooks, not repositories)
- ✅ Pure business logic fully testable without database
- ✅ Single source of truth for conversion, validation, formatting
- ✅ Consistent error handling across entire codebase
- ✅ Clear separation of concerns (engine → service → repository → hooks → screens)
- ✅ Gold standard pattern applied across all modules
- ✅ Comprehensive architecture documentation
- ✅ Automated enforcement prevents regressions
- ✅ Pure functions with 100% coverage
- ✅ Service layer testable with mocked dependencies
- ✅ No global state (Context-based injection)
- ✅ Clear decision tree: "where does this code go?"
- ✅ Contribution checklist for new code
- ✅ Automated linting catches violations before review
- ✅ Faster onboarding with ARCHITECTURE.md
- Read the roadmap: REFACTOR_ROADMAP.md
- Start with #65: Create mutation hooks (highest priority)
- Work sequentially: Each issue builds on previous ones
- Track progress: Close issues as PRs merge
- Update metrics: Verify improvements after each milestone
- REFACTOR_ROADMAP.md - Detailed implementation guide for all 18 issues
- REFACTOR_ISSUES.md - Quick reference and execution strategy
- GitHub Issues #65-#82 - Track progress
- CLAUDE.md - Existing project documentation
- AGENTS.md - Agent role system
This is a behavior-preserving refactor. The app should work identically after each change. Focus on:
- Clarity over cleverness
- Explicit boundaries over convenience
- Predictable, boring architecture
The goal is not to add features, but to make the existing codebase maintainable at scale.
- Milestone 1 (Quick Wins): 1-2 days ⭐ Highest ROI
- Milestone 2 (Service Layer): 3-4 days
- Milestone 3 (Centralization): 2-3 days
- Milestone 4 (Enforcement): 2-3 days
- Milestone 5 (Optional): 1-2 days
Total: 12-16 days for full completion
80% Value: First 8 issues (#65-#72) provide ~80% of the benefit in ~1 week
- Review REFACTOR_ROADMAP.md for implementation details
- Start with Issue #65 (mutation hooks)
- Create a branch:
git checkout -b refactor/milestone-1-quick-wins - Complete issues #65-68 in sequence
- Open PR with all 4 fixes together (or one PR per issue if you prefer)
- Verify success metrics
- Move to Milestone 2
Good luck! The architecture is already strong—these changes will make it excellent. 🚀