typescript-import-audit
O que ela faz
Esta skill descreve uma revisão em quatro etapas do código TypeScript para encontrar imports bagunçados, imports duplicados, classes sem classe-pai e exports faltando. É para desenvolvedores que organizam um projeto TypeScript.
Quando usar
- ✓Quando você quer limpar os imports de um projeto TypeScript.
- ✓Quando uma classe deveria estender uma classe base, mas não estende.
- ✓Quando um arquivo barrel está sem exports de que outros arquivos precisam.
Link da skill
https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/typescript-import-audit/SKILL.mdCopie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.
Como usar
O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.
Mensagem pronta para colar
Para Claude Code, Codex ou Cursor: rode na pasta do projeto e a skill fica instalada.
Baixe o SKILL.md e coloque na pasta de skills do seu agente.
Exemplo do que pedir para a IA
“Pode verificar meus imports de TypeScript e corrigir os duplicados ou os exports que estão faltando?”
5 skills novas por semana. 1 minuto de leitura.
Como funciona
O agente lê os arquivos relevantes, procura quatro tipos de problema e aplica uma correção pequena e direcionada para cada um.
Conteúdo técnico (SKILL.md original)
Texto original do autor, em inglês, direto do 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
Perguntas frequentes
O que é um arquivo barrel?
É um arquivo de índice que reúne exports de vários arquivos, para que possam ser importados de um só lugar.
O que significa um import só de tipo?
É um import usado apenas para rótulos de tipo, que pode ser marcado para não ser carregado em tempo de execução.
A auditoria altera os arquivos automaticamente?
A skill lê os arquivos primeiro e depois aplica as correções, para que você possa revisar o que mudou.
Detalhes
Descrição original do autor
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
Popularidade
- Estrelas no GitHub
- 7,8 mil
- Posição no ranking
- #13085
- Licença
- MIT
- Atualizada em
- 01/11/2026
Comentários
- …
Mais skills deste repositório
agentpilot
7,8 milAjuda seu agente a melhorar um projeto passo a passo, preparando uma tarefa e executando o ciclo do AgentPilot, que propõe, testa e pontua mudanças.
openspace
7,8 milAjuda seu agente a configurar o OpenSpace, uma ferramenta que armazena e busca skills de agentes, e a conectá-la ao seu app de IA pelo MCP.
rsi-arena
7,8 milAjuda seu agente a configurar e rodar testes padrão de benchmark de IA, como AIME e Terminal-Bench, para comparar diferentes métodos de melhoria.
experiment-guide
7,8 milAjuda seu agente a planejar pequenos experimentos, ler seus resultados e registrar descobertas enquanto investiga como melhorar um programa.
Skills parecidas
diffs
394 milPermite que seu agente gere um diff real e compartilhável das edições, como link de visualização ou arquivo de imagem, em vez de um resumo escrito à mão.
coding-agent
394 milAjuda seu agente a passar um trabalho grande de programação para o Codex, Claude Code ou OpenCode em segundo plano e acompanhar o andamento.
gh-issues
394 milAjuda seu agente a encontrar issues do GitHub, escolher quais resolver e abrir pull requests com correções, acompanhando os comentários de revisão.