| name | safe-refactor |
| description | Code-generation skill. Use only when refactoring existing repo code, moving files, or improving architecture without changing user-visible behavior. |
| metadata | {"family":"code","owner":"engineering","last_reviewed":"2026-04-30T00:00:00.000Z","version":"1.0.0"} |
Safe Refactor
This is a code-generation skill. Use it only for implementation cleanup, not content research.
Use When
- moving code between folders
- shrinking large route files
- aligning old code to the current architecture
- cleaning up imports or ownership boundaries
Main Rule
Preserve behavior first. Improve structure second.
Required Approach
- identify the current behavior and public route impact
- keep route/API/SEO behavior unchanged
- move composition into the correct feature layer
- reuse existing shells/helpers instead of inventing replacements
- stop when the task goal is met
Architecture Targets
- thin
src/app
- feature-owned logic in
src/features
- no new feature data in
src/lib
- no new feature UI in retired locations
Do Not Refactor Opportunistically
Do not do these during an unrelated task:
- broad folder normalization
- mass renames across untouched domains
- replacing active shared abstractions just because they are imperfect
Current Reality To Respect
These are still active:
src/features/career-hub/shared/*
src/components/common/*
Do not treat them as dead code by default.
Success Criteria
- behavior preserved
- route files thinner if that was part of the task
- file placement improved
- no architecture regression introduced