Skip to content
Back to skills

Collection

ASecurity

Analyze TypeScript code structure using ts-morph. Use for summarizing class/interface APIs, listing exports, showing inheritance hierarchies, or extracting interfaces from classes. Outputs signatures without implementation details.

  • 24 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 8, 2026
code-qualitytypescriptbashnoderefactoringgitapidocumentation

Works with

  • api

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 21 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add mattnigh/skills_collection --skill collection --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Collection?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Collection
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mattnigh-collection-1d8d9432/badge)](https://www.skillsdirectory.com/skills/mattnigh-collection-1d8d9432)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: ts-morph-analyze
description: Analyze TypeScript code structure using ts-morph. Use for summarizing class/interface APIs, listing exports, showing inheritance hierarchies, or extracting interfaces from classes. Outputs signatures without implementation details.
---

# TypeScript Code Analysis with ts-morph

Analyze TypeScript code structure to extract APIs, signatures, and relationships without implementation details.

## Installation

```bash
cd .claude/skills/ts-morph-analyze
pnpm install
```

## Available Scripts

### summarize-class.ts

Extract the API signature of a class or interface, showing only public members without implementation.

**Usage:**
```bash
npx tsx scripts/summarize-class.ts <tsconfig> <file> <name> [--private] [--jsdoc]
```

**Parameters:**
| Parameter | Required | Description |
|-----------|----------|-------------|
| `tsconfig` | Yes | Path to tsconfig.json |
| `file` | Yes | Source file containing the class/interface |
| `name` | Yes | Class or interface name |
| `--private` | No | Include private and protected members |
| `--jsdoc` | No | Include JSDoc comments |

**Example:**
```bash
npx tsx scripts/summarize-class.ts ./tsconfig.json src/nodes/types.ts ExecutableNode
```

**Output:**
```typescript
export abstract class ExecutableNode {
  readonly nodeId: string;
  constructor(nodeId: string);
  abstract execute(ctx: Context): Promise<Response>;
  protected createResponse(status: number, data: unknown): Response;
}
```

---

### list-exports.ts

List all exports from a file or directory with their types and signatures.

**Usage:**
```bash
npx tsx scripts/list-exports.ts <tsconfig> <path> [--recursive] [--types-only] [--functions-only] [--classes-only]
```

**Parameters:**
| Parameter | Required | Description |
|-----------|----------|-------------|
| `tsconfig` | Yes | Path to tsconfig.json |
| `path` | Yes | File or directory to analyze |
| `--recursive` | No | Recursively analyze directories |
| `--types-only` | No | Show only type/interface exports |
| `--functions-only` | No | Show only function exports |
| `--classes-only` | No | Show only class exports |

**Example:**
```bash
npx tsx scripts/list-exports.ts ./tsconfig.json src/utils/
```

**Output:**
```
src/utils/string.ts:
  export function formatDate(date: Date): string
  export function parseJSON<T>(input: string): Result<T>
  export type Result<T> = { success: true; value: T } | { success: false; error: string }

src/utils/validation.ts:
  export function validateEmail(email: string): boolean
  export interface ValidationResult { valid: boolean; errors: string[] }
```

---

### show-hierarchy.ts

Display the inheritance hierarchy for a class, showing parent classes and implemented interfaces.

**Usage:**
```bash
npx tsx scripts/show-hierarchy.ts <tsconfig> <file> <class-name> [--descendants] [--depth=N]
```

**Parameters:**
| Parameter | Required | Description |
|-----------|----------|-------------|
| `tsconfig` | Yes | Path to tsconfig.json |
| `file` | Yes | Source file containing the class |
| `class-name` | Yes | Name of the class to analyze |
| `--descendants` | No | Also show classes that extend this class |
| `--depth=N` | No | Limit hierarchy depth (default: unlimited) |

**Example:**
```bash
npx tsx scripts/show-hierarchy.ts ./tsconfig.json src/nodes/text-node.ts TextNode --descendants
```

**Output:**
```
TextNode
├── extends: ExecutableNode
│   └── implements: NodeInterface
└── descendants:
    ├── MarkdownNode
    └── HtmlNode
```

---

### extract-interface.ts

Generate a TypeScript interface from a class's public members.

**Usage:**
```bash
npx tsx scripts/extract-interface.ts <tsconfig> <file> <class-name> [--name=InterfaceName] [--include-protected]
```

**Parameters:**
| Parameter | Required | Description |
|-----------|----------|-------------|
| `tsconfig` | Yes | Path to tsconfig.json |
| `file` | Yes | Source file containing the class |
| `class-name` | Yes | Name of the class to extract from |
| `--name=Name` | No | Name for the generated interface (default: I{ClassName}) |
| `--include-protected` | No | Include protected members |

**Example:**
```bash
npx tsx scripts/extract-interface.ts ./tsconfig.json src/services/user.ts UserService --name=IUserService
```

**Output:**
```typescript
export interface IUserService {
  readonly id: string;
  getName(): string;
  getEmail(): Promise<string>;
  update(data: UserData): Promise<void>;
}
```

---

## Use Cases

- **API Review**: Quickly understand a class's public interface
- **Documentation**: Generate API summaries for documentation
- **Refactoring Planning**: See inheritance relationships before changes
- **Interface Extraction**: Create interfaces from existing implementations
- **Codebase Exploration**: List exports to understand module structure

## Output Formats

All scripts output TypeScript syntax by default. The output can be:
- Piped to a file: `npx tsx scripts/summarize-class.ts ... > api.d.ts`
- Used for documentation
- Compared with git diff to track API changes

Files in this skill

  • 0Chan-smc__claude-code-workflow-lab__claude__skills__frontend-dev-guidelines__SKILL.md15.1 KB
  • 17hz__nextjs-template__claude__skills__example-skill__SKILL.md316 B
  • 1ambda__dataops-platform__claude__skills__context-synthesis__SKILL.md3.5 KB
  • 1natsu172__dotfiles__claude__skills__git-analysis__SKILL.md5.4 KB
  • 1natsu172__dotfiles__claude__skills__github-pr-best-practices__SKILL.md7.7 KB
  • 23Maestro__prospect-pipeline__claude__skills__npid-fastapi-skill.md26.1 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-code-javascript__SKILL.md15.7 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-code-python__SKILL.md17.5 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-expression-syntax__SKILL.md9.4 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-mcp-tools-expert__SKILL.md12.5 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-node-configuration__SKILL.md16.6 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-workflow-patterns__SKILL.md11.2 KB
  • 3x-Projetos__claude-memory-framework__claude__skills__scientist__SKILL.md14.8 KB
  • 5MinFutures__futures-arena__claude__skills__migration-tracker__SKILL.md16.2 KB
  • 5MinFutures__futures-arena__claude__skills__planning-guidelines__SKILL.md11.8 KB
  • 92Bilal26__TaskPilotAI__claude__skills__assessment-builder__SKILL.md17.5 KB
  • 92Bilal26__TaskPilotAI__claude__skills__book-scaffolding__SKILL.md19.1 KB
  • 92Bilal26__TaskPilotAI__claude__skills__code-validation-sandbox__SKILL.md6.2 KB
  • 92Bilal26__TaskPilotAI__claude__skills__exercise-designer__SKILL.md18.1 KB
  • 92Bilal26__TaskPilotAI__claude__skills__learning-objectives__SKILL.md24.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…