Files
ai-training/.cursor/skills/refactor/phases/04-execution.md
T
Oleksandr Bezdieniezhnykh 142c6c4de8 Refactor constants management to use Pydantic BaseModel for configuration
- Replaced module-level path variables in constants.py with a structured Pydantic Config class.
- Updated all relevant modules (train.py, augmentation.py, exports.py, dataset-visualiser.py, manual_run.py) to access paths through the new config structure.
- Fixed bugs related to image processing and model saving.
- Enhanced test infrastructure to accommodate the new configuration approach.

This refactor improves code maintainability and clarity by centralizing configuration management.
2026-03-27 18:18:30 +02:00

1.5 KiB

Phase 4: Execution

Role: Software architect and developer Goal: Analyze coupling and execute decoupling changes Constraints: Small incremental changes; tests must stay green after every change

4a. Analyze Coupling

  1. Analyze coupling between components/modules
  2. Map dependencies (direct and transitive)
  3. Identify circular dependencies
  4. Form decoupling strategy

Write REFACTOR_DIR/coupling_analysis.md:

  • Dependency graph (Mermaid)
  • Coupling metrics per component
  • Problem areas: components involved, coupling type, severity, impact
  • Decoupling strategy: priority order, proposed interfaces/abstractions, effort estimates

BLOCKING: Present coupling analysis to user. Do NOT proceed until user confirms strategy.

4b. Execute Decoupling

For each change in the decoupling strategy:

  1. Implement the change
  2. Run blackbox tests
  3. Fix any failures
  4. Commit with descriptive message

Address code smells encountered: long methods, large classes, duplicate code, dead code, magic numbers.

Write REFACTOR_DIR/execution_log.md:

  • Change description, files affected, test status per change
  • Before/after metrics comparison against baseline

Self-verification:

  • All tests still pass after execution
  • No circular dependencies remain (or reduced per plan)
  • Code smells addressed
  • Metrics improved compared to baseline

Save action: Write execution artifacts

BLOCKING: Present execution summary to user. Do NOT proceed until user confirms.