with one click
r5-fix-import-paths
// Rewrite import paths to match the generated target project layout.
// Rewrite import paths to match the generated target project layout.
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | r5-fix-import-paths |
| description | Rewrite import paths to match the generated target project layout. |
description: Rewrite import paths to match the generated target project layout. When to use: After moving files to new directory structure, imports need updating
Purpose: Update all import statements to reflect new file locations.
Scan the file for:
import { X } from './path';const X = require('./path');import type { X } from './path';import './styles.css';For each import, determine:
A. Framework/External Library Import
'@angular/core', 'react', 'lodash'B. Relative Import (Internal)
'./user.service', '../models/user'C. Absolute Import (Internal)
'@app/services/user', 'src/models/user'Step 3a: Identify what is being imported
Step 3b: Look up new location
src/models/ or src/app/models/src/services/ or src/app/services/src/components/ or src/app/components/src/utils/ or src/app/utils/Step 3c: Calculate new relative path
From current file: output/app/services/auth.service.ts
To imported file: output/app/models/user.model.ts
Steps:
output/app/services/output/app/models/../models/user.modelFormula:
../ for each levelmodels/user.modelExamples:
./user.model../user.model../models/user.model../../shared/utils/helperStep 3d: Update import statement
Before:
import { User } from '../model/User';
After:
import { User } from '../models/user.model';
If target uses path aliases (tsconfig paths):
{
"paths": {
"@app/*": ["src/app/*"],
"@models/*": ["src/app/models/*"]
}
}
Can use:
import { User } from '@models/user.model';
Instead of:
import { User } from '../../models/user.model';
Check that:
Case A: File not yet migrated
Case B: File was merged into another
Case C: File was split into multiple
Case D: Import removed (no longer needed)
Source might not use extensions, target might require them:
'./user' → './user.js' (if required)File with all import paths correctly updated.
// File: src/services/UserService.ts
import { User } from '../models/User';
import { ApiClient } from '../api/ApiClient';
import { formatDate } from '../utils/formatters';
output/app/
services/
user.service.ts
models/
user.model.ts
core/
api-client.service.ts
shared/
utils/
formatters.ts
// File: output/app/services/user.service.ts
import { User } from '../models/user.model';
import { ApiClient } from '../core/api-client.service';
import { formatDate } from '../shared/utils/formatters';
Current: a/b/c/file1.ts
Target: a/b/d/file2.ts
Path: ../d/file2
Current: a/b/c/file1.ts
Target: a/d/file2.ts
Path: ../../d/file2
Current: a/b/c/file1.ts
Target: a/b/c/d/file2.ts
Path: ./d/file2