ts-morph-analyze

Analyze TypeScript code to reveal public APIs and inheritance relationships.

114|24|Updated Feb 13, 2025
One-click install
npx skills add https://github.com/dafthunk-com/dafthunk --skill ts-morph-analyze
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ts-morph-analyze
Source: https://github.com/dafthunk-com/dafthunk/tree/main/.claude/skills/ts-morph-analyze
Command: npx skills add https://github.com/dafthunk-com/dafthunk --skill ts-morph-analyze

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires ts-morph, tsx, typescript, and includes scripts (resource) components.

What problem does it solve?

Analyze and summarize TypeScript code structure to reveal public APIs, exports, and inheritance relationships using ts-morph. It helps you quickly understand classes, interfaces, and type declarations without implementation details.

Core Features & Use Cases

  • Extract API signatures for classes and interfaces (summaries, with optional private/protected visibility).
  • List exports from files/directories with signatures and type information.
  • Display inheritance hierarchies and implemented interfaces to understand relationships.

Quick Start

Run the summarize-class.ts script with your tsconfig and target TS file to print a concise API signature.

Frequently Asked Questions about ts-morph-analyze

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I extract TypeScript API signatures and exports without implementation details?

To summarize TypeScript class and interface definitions, run the analysis script targeting your TS files and tsconfig.json. It uses ts-morph to parse sources and print concise API signatures, including optional private and protected visibility.

Can I display TypeScript inheritance hierarchies and implemented interfaces for a directory?

Yes, you can display inheritance hierarchies and implemented interfaces across a directory by applying the analyzer to your TypeScript sources. It processes multiple files to map out structural relationships and type information.

Does extracting TypeScript type exports require a tsconfig.json file?

Yes, extracting TypeScript type exports requires a tsconfig.json file along with target TS files and the ts-morph library. The tsconfig.json is necessary for the parser to correctly resolve paths and generate API signatures.

What is the best way to analyze TypeScript code structure for public APIs?

The best way to analyze TypeScript code structure for public APIs is using ts-morph to parse the source files. It reveals exports and inheritance relationships, showing signatures without implementations for quick comprehension.

Are there limitations when summarizing TypeScript files without the ts-morph library?

Yes, a limitation is that summarizing TypeScript files requires the ts-morph library and typescript dependencies. Without them, the analyzer cannot parse the TypeScript sources to generate the succinct API signatures.