- Home
- Skills
- Shunsukehayashi
- Miyabi
- Refactor Helper
refactor-helper_skill
- TypeScript
14
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill shunsukehayashi/miyabi --skill refactor-helper- SKILL.md3.7 KB
Overview
This skill refactor-helper automates and guides safe, systematic code refactoring for TypeScript projects. It focuses on improving code quality, performance, and maintainability while preserving behavior. Use it to modernize legacy code, break up large functions, and apply common refactoring patterns reliably.
How this skill works
refactor-helper inspects code for common smells (long functions, duplicate logic, complex conditionals, god classes, dead code) and proposes small, focused changes such as extract-function, replace-conditionals-with-polymorphism, and simplifications. It enforces a workflow: identify smells, add or verify tests, perform incremental refactors, and run verification steps (tests, lint, typechecks). It also suggests tooling commands and concrete code examples tailored to TypeScript.
When to use it
- Modernizing legacy TypeScript code to newer syntax or patterns
- Breaking up large functions or classes to improve readability
- Removing dead code and unused dependencies safely
- Consolidating duplicated logic or simplifying complex conditionals
- Preparing code for performance or maintainability improvements
Best practices
- Make one small refactor per commit to keep changes reviewable
- Ensure tests exist and pass before starting any refactor
- Run tests, lint, and type checks after each incremental change
- Preserve external behavior — refactor structure, not logic
- Use automated tools (ts-prune, depcheck) to find dead code and unused deps
Example use cases
- Extracting validation and calculation helpers from a long order-processing function
- Replacing switch-based pricing logic with strategy classes to enable extension
- Simplifying nested user checks using optional chaining and array includes
- Removing unused exports and dependencies discovered by automated scans
- Adding focused unit tests before refactoring a critical module
FAQ
No — the goal is to keep behavior unchanged. Always add or run tests to verify behavior remains identical.
Which tools does this recommend for TypeScript?
Use npm test for unit tests, npm run lint and npm run typecheck for verification, and tools like ts-prune and depcheck to detect dead code and unused deps.