Guides TypeScript refactoring operations including moving files, moving symbols between files, and renaming symbols across the codebase. Use when user wants to reorganize code structure.
This skill guides the use of the refactor-ts CLI tool for common TypeScript code reorganization tasks.
refactor-ts move-file)Moves a TypeScript file to a new location and updates all import references.
npx refactor-ts move-file <source> <destination>
Example:
npx refactor-ts move-file src/game/Player.ts src/game/entities/Player.ts
refactor-ts move-symbol)Moves a symbol from one file to another, updating imports and copying dependencies.
npx refactor-ts move-symbol <file> <symbol> <destination>
Supported symbols: classes, functions, variables, interfaces, enums, type aliases
Example:
npx refactor-ts move-symbol src/game/Player.ts PlayerState src/game/state/PlayerState.ts
refactor-ts move-symbol)Renames a symbol and updates all references across the codebase. This uses the same move-symbol command - when the destination is a name rather than a file path, it performs a rename.
npx refactor-ts move-symbol <file> <oldName> <newName>
Supported symbols: classes, functions, variables, interfaces, enums, type aliases
Example:
npx refactor-ts move-symbol src/game/Player.ts Player GamePlayer
move-symbol to move the class, which will create the destination file if neededmove-file to relocate files while keeping imports validmove-symbol with a new name (not a file path) to rename throughout the codebase