code-migration

Identifies remaining imports and orphaned exports for JS/TS migrations.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/zcawood-mie/agentz --skill code-migration-zcawood-mie
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-migration
Source: https://github.com/zcawood-mie/agentz/tree/main/skills/code-migration
Command: npx skills add https://github.com/zcawood-mie/agentz --skill code-migration-zcawood-mie

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill helps engineers verify that code migrations and refactors are complete and safe to finalize by detecting remaining imports, unused exports, and orphaned files after moving or consolidating modules.

Core Features & Use Cases

  • Import discovery: Scans project directories to find all files that still import from a given source path, including static, dynamic, require, and re-export forms.
  • Export cross-reference: Lists exports from the source file and cross-references them against importers to identify unused or orphaned exports.
  • Use Case: When consolidating utilities into a single service or moving TypeScript modules, use this Skill to confirm all consumers were updated before deleting the original file.

Quick Start

Run the find-orphaned-imports.py script with the migrated file path to see which files still import it and whether it is safe to delete.

Frequently Asked Questions about code-migration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find remaining imports from a source file after migrating TypeScript modules?

To find remaining imports from a source file, run the import discovery script against the migrated file path. It scans project directories to locate all files still importing from the source path, including static, dynamic, require, and re-export forms.

What is the safest way to verify a code migration before deleting an old JavaScript module?

Verifying a code migration safely involves scanning for remaining imports and cross-referencing exports from the source file. This structured analysis identifies unused or orphaned exports and returns an exit code indicating whether the original file is safe to delete.

Does this code migration tool work with both JavaScript and TypeScript repositories?

Yes, this code migration tool works with both JavaScript and TypeScript repositories. It is specifically designed to apply when moving, consolidating, or refactoring modules and updating import paths across these project types.

How do I identify unused exports and orphaned files when consolidating utilities?

To identify unused exports and orphaned files when consolidating utilities, the tool cross-references the source file's exports against discovered importers. This produces a structured analysis available in JSON or text output, highlighting unused exports.

Can I get JSON output from an import scan to integrate with my refactoring pipeline?

Yes, you can get JSON output from an import scan. The tool produces structured analysis listing importing files and exports, supporting both JSON and text output formats, and returns exit codes indicating safe-to-delete status for pipeline integration.

What types of import statements are detected during a module refactoring scan?

During a module refactoring scan, the tool detects multiple types of import statements. It finds all files importing from a given source path, specifically including static, dynamic, require, and re-export forms.