본문으로 건너뛰기
cccskills
무료GitHub에 공개

typescript-import-audit

Audit TypeScript projects for type-only imports, duplicate imports, missing base class inheritance, and incomplete public exports through index.ts files. Apply targeted fixes in a defined order and check compilation with tsc --noEmit.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

원문원문 설명 보기

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.

설치 방법 보기

이럴 때 유용합니다

  • Separate type-only imports from runtime imports
  • Consolidate duplicate imports from the same module
  • Check classes for missing base class inheritance
  • Review index.ts files for missing public exports

포함된 파일(2)

  • SKILL.md6.1 KB
  • .skill_id37 B

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

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:

#IssueFix
1Value imports used only as type annotationsSplit with import type
2Duplicate imports from the same moduleConsolidate into one import statement
3Classes missing expected base class extensionAdd extends BaseClass
4Missing re-exports in barrel (index.ts) filesAdd 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 import statements 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

  1. Identify all names in the import that are type-only.
  2. Remove them from the value import (delete the value import entirely if all names are type-only).
  3. 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

  1. Fix duplicate imports first (consolidation may surface type-only candidates).
  2. Fix value vs. type imports (split imports).
  3. Fix missing base class extensions.
  4. Fix barrel re-exports last (they depend on the other files being correct).

Verification checklist

After edits, confirm:

  • No two import statements reference the same module path (same kind).
  • All names used only as types are in import type { ... } statements.
  • Every class that should extend a base class does so.
  • Every public export in every source file appears in the barrel index.ts.
  • The project compiles without errors (tsc --noEmit).

Quick Reference: Import Patterns

// Value import
import { foo, bar } from './module';

// Type-only import
import type { Foo, Bar } from './module';

// Mixed (value + type from same module — two lines)
import { foo } from './module';
import type { Foo } from './module';

// Re-export value
export { foo } from './module';

// Re-export type
export type { Foo } from './module';

// Re-export everything
export * from './module';
export type * from './module';  // TypeScript 5.0+

Notes

  • Always prefer explicit named exports over export * in barrel files for better tree-shaking and discoverability.
  • If the project uses verbatimModuleSyntax or isolatedModules in tsconfig.json, import type is required for type-only imports — the compiler will error otherwise.
  • Run tsc --noEmit after each fix category to catch regressions early.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Prepare audio stems, the separate parts of a track, for mixing by matching their durations with silence, loops, or crossfades. Verify each generated and processed file before moving to the next production step.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Match audio parts with different durations
  • Extend drums and melodic parts using suitable methods
  • Check audio specifications before mixing
HKUDS/OpenSpace7.8천2026년 8월 13일 업데이트

Produce audio in separate stems, meaning individual instrument tracks, and verify each output as you go. Align track lengths with silence, loops, or crossfades, then apply effects, mix a master, and package the files.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Align instrument tracks to a reference audio file
  • Choose how to extend tracks that are too short
  • Verify audio properties after generation and effects
HKUDS/OpenSpace7.8천2026년 8월 13일 업데이트

Build serverless endpoints that relay external API requests for a dashboard while keeping API keys on the server. Includes Vercel examples for input checks, caching, cross-origin access, and consistent JSON responses.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Connect a dashboard to external APIs without exposing API keys
  • Create endpoints for stock quotes and news
  • Standardize API responses and error handling
HKUDS/OpenSpace7.8천2026년 8월 13일 업데이트

Produce a master track and separate audio parts through a structured Python workflow. Apply filters and reverb, export WAV files with consistent settings, package them in a ZIP archive, and check that the deliverables meet the requested specifications.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Export a master track with separate audio parts
  • Apply filters and reverb to audio
  • Check duration and format across deliverables
HKUDS/OpenSpace7.8천2026년 8월 13일 업데이트

Keep document creation moving when web searches and page retrieval repeatedly fail. The skill preserves the original task, uses the model’s existing knowledge, and clearly identifies information that could not be checked against external sources.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Continue drafting after repeated web retrieval failures
  • Preserve task requirements during network errors
  • Mark information that could not be externally verified
HKUDS/OpenSpace7.8천2026년 8월 13일 업데이트

When Python execution repeatedly fails in execute_code_sandbox, use a file-based alternative: save the script, run it through the shell, and capture results or errors. The guidance covers paths, imports, timeouts, structured output, and optional cleanup.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Retry Python work through the shell after repeated sandbox failures
  • Run longer tasks with an adjusted timeout
  • Execute Python work that needs multiple files or system utilities
HKUDS/OpenSpace7.8천2026년 8월 13일 업데이트

HKUDS의 스킬 모두 보기

이 스킬의 문제 신고