Keep code organized by responsibility and centralize reusable logic. Concretely:

How to apply:

  1. Audit the codebase for duplicates of plugin loading, prompt handling, and dataset parsing; create single utilities and adjust callers to import them.
  2. Move all prompt/text/password/select calls to a utils.prompt_* module and ensure main.py uses those helpers; domain objects must accept parameters rather than interact with users.
  3. When extracting code, carry over type annotations and return types; add or preserve unit tests for behavior that was previously duplicated.
  4. Replace flag-heavy control flow with clearer branching or loops and prefer context managers for resource lifecycle.

Benefits: improved readability, fewer subtle behavioral regressions, simpler testing, and stronger static typing — all aligning with code style and maintainability goals.