import-refactor

Update all import statements, module references, string paths, and config references after moving or renaming files and modules. Handles Python, TypeScript, and JavaScript imports. Use when moving files, renaming modules, restructuring directories, or consolidating code.

⭐13stars🔀2forks📁View on GitHub🕐Updated Dec 31, 2025⬇️2downloads

When & Why to Use This Skill

The Import-Refactor skill is a powerful developer utility designed to automate the tedious process of updating import statements, module references, and string paths during code refactoring. By supporting Python, TypeScript, and JavaScript, it ensures project integrity when moving files or restructuring directories, systematically mapping old paths to new ones and verifying that all dependencies remain intact to prevent broken builds.

Use Cases

  • Project Restructuring: Automatically update all relative and absolute imports when moving source files into new directory structures, such as migrating legacy code into a modern /src or /utils folder architecture.
  • Module Renaming: Systematically rename modules and update every corresponding reference across the codebase, configuration files, and documentation to maintain consistency and functional integrity.
  • Codebase Consolidation: Efficiently manage the merging of multiple small modules into a single package by updating all internal and external import paths in a single, systematic batch operation.
  • Configuration & Documentation Maintenance: Identify and update hardcoded string paths and configuration references that point to moved assets, ensuring that both the runtime environment and developer documentation stay synchronized with the file system.
nameimport-refactor
descriptionUpdate all import statements, module references, string paths, and config references after moving or renaming files and modules. Handles Python, TypeScript, and JavaScript imports. Use when moving files, renaming modules, restructuring directories, or consolidating code.

Import and Reference Updater

This guide is for updating all module references after moving or renaming files, including import statements, string paths, and configuration references.

Core workflow:

  1. Map old paths → new paths
  2. Find ALL references (imports, strings, configs, docs)
  3. Update systematically by type
  4. Verify paths exist and imports resolve
  5. Report changes made

Reference types updated:

  • Import statements (Python/TS/JS)
  • String-based paths
  • Configuration files
  • Documentation examples

Quick example

Moving utilities to /utils:
1. Find old utility imports
2. Update to /utils imports
3. Update string references
4. Update docs
→ Report: 23 files, 45 imports updated

Best practices:

  • Verify paths exist before updating
  • Preserve import style (absolute vs relative)
  • Process in batches for large refactorings
  • Test after major changes