All skills
Skillintermediate
/organize - Organize Imports
Sort, group, and clean up import statements across the project.
Claude Code Knowledge Pack7/10/2026
Overview
/organize - Organize Imports
Sort, group, and clean up import statements across the project.
Steps
- Detect the project language and import style (ES modules, CommonJS, Python, Go, etc.)
- Read the project's linting configuration for import ordering rules
- Scan target files for all import statements
- Remove duplicate imports that import the same module
- Remove unused imports that are not referenced in the file body
- Group imports into standard categories: built-in, external, internal, relative, type-only
- Sort imports alphabetically within each group
- Add blank lines between import groups for visual separation
- Convert wildcard imports to named imports where only specific exports are used
- Merge multiple imports from the same module into a single import statement
- Apply consistent quote style (single or double) matching project conventions
- Run the linter to verify the organized imports pass all rules
Rules
- Follow the project's existing import ordering convention if one exists
- Standard grouping order: built-in, external packages, internal aliases, relative paths
- Type-only imports should be grouped separately (TypeScript)
- Do not reorder imports if the order has side effects (CSS imports, polyfills)
- Keep namespace imports when they are used extensively (more than 5 references)
- Use path aliases from tsconfig.json or webpack config when available
- Process one file at a time to allow incremental review