SuperAPI AI Directory

refactor-structure

Coding & development

View repository

Updated 10-16 05:53

About this skill

Structure refactor workflow
  1. Inspect the current layout using the following commands to identify structural issues, such as oversized files, mixed responsibilities, misplaced modules, unclear names, and duplicated organization patterns.
    • find src -type f -not -path '*/__generated__/*' -print0 | xargs -0 wc -l 2>/dev/null | sort -rn | head -30
    • tree -h src
    • If the user specifies a directory, replace src with it.
  2. Reorganize the code by responsibility to improve cohesion and reduce coupling.
    • Split oversized files, group related modules, and create new directories only when they clarify ownership.
    • Update imports alongside your changes while maintaining existing behavior.
  3. Rename files and identifiers (such as variables and functions) to more accurately reflect their roles.
    • Ensure all references are updated accordingly.
  4. Run the quickest relevant verification tools, such as type checkers or linters, to detect broken imports or incorrect module wiring.
  5. Commit and push the changes, then execute either the open-pr or update-pr skill.
  6. Summarize the changes made and explain why the new structure is more maintainable.