Files
ai-training/.cursor/skills/refactor/phases/01-discovery.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.8 KiB

Phase 1: Discovery

Role: Principal software architect Goal: Generate documentation from existing code and form solution description Constraints: Document what exists, not what should be. No code changes.

Skip condition (Targeted mode): If COMPONENTS_DIR and SOLUTION_DIR already contain documentation for the target area, skip to Phase 2. Ask user to confirm skip.

1a. Document Components

For each component in the codebase:

  1. Analyze project structure, directories, files
  2. Go file by file, analyze each method
  3. Analyze connections between components

Write per component to REFACTOR_DIR/discovery/components/[##]_[name].md:

  • Purpose and architectural patterns
  • Mermaid diagrams for logic flows
  • API reference table (name, description, input, output)
  • Implementation details: algorithmic complexity, state management, dependencies
  • Caveats, edge cases, known limitations

1b. Synthesize Solution & Flows

  1. Review all generated component documentation
  2. Synthesize into a cohesive solution description
  3. Create flow diagrams showing component interactions

Write:

  • REFACTOR_DIR/discovery/solution.md — product description, component overview, interaction diagram
  • REFACTOR_DIR/discovery/system_flows.md — Mermaid flowcharts per major use case

Also copy to project standard locations if in project mode:

  • SOLUTION_DIR/solution.md
  • DOCUMENT_DIR/system_flows.md

Self-verification:

  • Every component in the codebase is documented
  • Solution description covers all components
  • Flow diagrams cover all major use cases
  • Mermaid diagrams are syntactically correct

Save action: Write discovery artifacts

BLOCKING: Present discovery summary to user. Do NOT proceed until user confirms documentation accuracy.