typescript-import-audit
What it does
This skill describes a four-step review of TypeScript code for messy imports, duplicate imports, missing class parents and missing exports. It is for developers tidying a TypeScript project.
When to use it
- βWhen you want to clean up imports in a TypeScript project.
- βWhen a class should extend a base class but does not.
- βWhen a barrel file is missing exports that other files need.
Skill link
https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/typescript-import-audit/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βCan you check my TypeScript imports and fix any duplicates or missing exports?β
5 new skills a week. 1 minute to read.
How it works
The agent reads the relevant files, looks for four kinds of problems, and applies a small, targeted fix for each one.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
TypeScript Import & Structure Audit
A step-by-step workflow for auditing TypeScript projects for common structural and import hygiene problems, then applying targeted fixes.
Overview
This skill covers four audit checks and their corresponding fixes:
| # | Issue | Fix |
|---|---|---|
| 1 | Value imports used only as type annotations | Split with import type |
| 2 | Duplicate imports from the same module | Consolidate into one import statement |
| 3 | Classes missing expected base class extension | Add extends BaseClass |
| 4 | Missing re-exports in barrel (index.ts) files |
Add the missing export lines |
Step 1 β Read All Relevant Files in Parallel
Before making any changes, read all files that need to be audited in a single parallel batch. This avoids slow sequential reads.
Read in parallel:
- src/index.ts (barrel file)
- src/**/*.ts (all source files)
- Any explicitly named files from the task spec
Look for:
- All
importstatements at the top of each file - Class declarations (
class Foo) - Export lists in barrel files
Step 2 β Audit Check 1: Value Imports Used Only as Types
Detection
For every import { A, B } from 'module' statement, check whether each
imported name is used only in type positions (: TypeName, as TypeName,
<TypeName> generics, implements TypeName). If a name never appears in a
value position (instantiation, function call, assignment), it should be a
type-only import.
// β Bad β Foo is only used as a type annotation
import { Foo, bar } from './module';
const x: Foo = bar();
// β
Good β split into value import + type import
import { bar } from './module';
import type { Foo } from './module';
Fix Pattern
- Identify all names in the import that are type-only.
- Remove them from the value import (delete the value import entirely if all names are type-only).
- Add (or merge into an existing)
import type { ... } from 'module'statement.
Step 3 β Audit Check 2: Duplicate Imports from the Same Module
Detection
Scan for two or more import statements that reference the same module path:
// β Bad β two imports from the same source
import { ComponentA } from './components';
import { ComponentB } from './components';
Fix Pattern
Merge all named imports from the same module into a single statement:
// β
Good
import { ComponentA, ComponentB } from './components';
If there is a mix of value and type imports from the same module, keep them as two separate lines (import { ... } and import type { ... }), but ensure there is at most one of each kind per module path.
Step 4 β Audit Check 3: Classes That Should Extend a Base Class
Detection
Look for class declarations that:
- Implement an interface that implies a base class, OR
- Are described in comments / documentation as extending something, OR
- Contain methods/properties that are defined on a known base class
// β Missing base class
class MyPanel implements PanelInterface {
render() { ... }
}
// β
Correct
class MyPanel extends BasePanel implements PanelInterface {
render() { ... }
}
Fix Pattern
Add extends BaseClass between the class name and any implements clause:
class ClassName extends BaseClass implements InterfaceName { ... }
Ensure the base class is imported if it is not already.
Step 5 β Audit Check 4: Missing Re-exports in Barrel Files
Detection
A barrel file (index.ts) should re-export everything that is part of the
public API. Common gaps:
- A new file was added but never added to
index.ts - A named export inside a file is not forwarded by the barrel
// src/components/MyWidget.ts
export class MyWidget { ... }
export type MyWidgetProps = { ... }
// src/components/index.ts β β missing MyWidget
export { SomeOtherThing } from './SomeOtherThing';
Fix Pattern
Add the missing re-export line:
// src/components/index.ts β β
fixed
export { SomeOtherThing } from './SomeOtherThing';
export { MyWidget } from './MyWidget';
export type { MyWidgetProps } from './MyWidget';
Use export type { ... } for type-only exports to maintain strict type/value separation.
Step 6 β Apply Fixes and Verify
Order of operations
- Fix duplicate imports first (consolidation may surface type-only candidates).
- Fix **value vs. type im
FAQ
What is a barrel file?
It is an index file that collects exports from several files so they can be imported from one place.
What does a type-only import mean?
It is an import used only for type labels, which can be marked so it is not loaded at run time.
Does the audit change files automatically?
The skill reads the files first and then applies fixes, so you can review what changed.
Details
Original description by the author
Systematic workflow for auditing TypeScript codebases for import hygiene issues (value vs. type imports, duplicates), missing base class extensions, and incomplete barrel file re-exports, with actionable fix patterns.
repo: HKUDS/AgentPilot
Popularity
- GitHub stars
- 7.8k
- Ranking position
- #13085
- License
- MIT
- Updated
- 11/1/2026
Comments
- β¦
More skills from this repository
agentpilot
7.8kHelps your agent improve a project step by step by preparing a task and running the AgentPilot loop that proposes, tests and scores changes.
openspace
7.8kHelps your agent set up OpenSpace, a tool that stores and fetches agent skills, and connect it to your AI app through MCP.
rsi-arena
7.8kHelps your agent set up and run standard AI benchmark tests, such as AIME and Terminal-Bench, to compare different improvement methods.
experiment-guide
7.8kHelps your agent plan small experiments, read their results and record findings while it investigates how to improve a program.
Similar skills
diffs
394kLets your agent produce a real, shareable diff of edits as a viewer link or image file, instead of a hand-written summary.
coding-agent
394kHelps your agent hand a larger coding job to Codex, Claude Code, or OpenCode as a background worker, then check on its progress.
gh-issues
394kHelps your agent find GitHub issues, pick the ones to work on, and open pull requests with fixes, including follow-up on review comments.