Refactor, optimize, and standardize the entire Flutter codebase into a scalable, modular, high-performance system.
- Single responsibility per module
- No duplicated logic
- Unified data pipeline
- Zero layout instability in reader
- Performance-first decisions
- Scan full repo
- Identify:
- Dead code
- Duplicate logic
- Over-engineered structures
- Heavy assets
- Output structured refactor plan
- Apply refactor step-by-step
- Validate after each change
- Update memory.md continuously
- Run static checks
- Ensure no broken imports
- Validate build success
- NEVER break reader engine stability
- NEVER introduce unnecessary dependencies
- ALWAYS centralize logic
- ALWAYS update memory.md after changes
Feature-first modular system:
lib/ core/ features/ shared/
NO FLAT STRUCTURES.
- Avoid rebuild-heavy widgets
- Use ValueNotifier / Riverpod
- Precompute tokens
- No runtime parsing during playback
- Remove unused assets
- Compress images (WebP)
- Strip debug logs
- Use tree shaking
- Avoid heavy packages
REMOVE:
- Unused imports
- Dead files
- Duplicate widgets
- Test junk not used
MERGE:
- Utility files
- Repeated UI components
All actions must be logged in:
/memory.md
Scan repo → return issues
Apply structural improvements
Reduce size + improve performance
Check build + errors
Reconstruct reader engine cleanly
ON FILE CHANGE:
- Re-run dependency graph check
ON BUILD FAIL:
- rollback last step using memory.md
ON NEW FEATURE:
- place inside correct feature module
- Structured
- No verbosity
- Code-first