File Structure Organize Workflow
Reorganize project file structure to follow a consistent pattern that makes it easy to find and add new files.
Objective
Reorganize the project directory structure for clarity and consistency.
Environment
- A project with an inconsistent file structure
- Team agreement on the target structure
- A search tool for finding import references
Steps
1. Document current structure
Map the existing file structure and identify inconsistencies.
Expected state: A diagram or list of the current structure is created.
2. Plan target structure
Design the target structure following the team agreed pattern.
Expected state: A target structure plan is documented.
3. Move files
Move files to their new locations, updating import paths as needed.
Expected state: All files are in their new locations with correct imports.
4. Verify build
Run the build and test suite to confirm nothing is broken after the reorganization.
Expected state: The build succeeds and all tests pass.
Decision points
Feature-based or layer-based?
- Feature-based for large apps
- Layer-based for small apps
Use feature-based for projects with many features; layer-based is fine for small, simple projects.
Expected outcome
The project follows a consistent file structure that is documented and verified by a passing build.
Verification
Run the build and full test suite; confirm all imports resolve correctly.
Cleanup
Use git to revert the reorganization if the build fails and cannot be quickly fixed.
Implementation Notes
-
Document current structure — Map the existing file structure and identify inconsistencies. Expected state: A diagram or list of the current structure is created.
-
Plan target structure — Design the target structure following the team agreed pattern. Expected state: A target structure plan is documented.
-
Move files — Move files to their new locations, updating import paths as needed. Expected state: All files are in their new locations with correct imports.
-
Verify build — Run the build and test suite to confirm nothing is broken after the reorganization. Expected state: The build succeeds and all tests pass.
Common Pitfalls
- Feature-based or layer-based? Options: Feature-based for large apps / Layer-based for small apps. Recommendation: Use feature-based for projects with many features; layer-based is fine for small, simple projects.
Quick Reference
# Execute the workflow steps as documented above
echo "Workflow completed successfully"