refactoring-typescript

Community

Separate business logic from I/O in TypeScript.

Authorlekman
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This guide provides a structured approach to separating business logic from system interactions in TypeScript, enabling cleaner architecture and easier testing.

Core Features & Use Cases

  • Identify system boundaries between business logic and external calls (I/O, HTTP, shell, DB) in TypeScript.
  • Define a conventional interface contract (e.g., I{Name}) and the corresponding domain interface file.
  • Implement a thin wrapper (domain.system.ts) that delegates to external dependencies.
  • Create a mock implementation for testing under tests/mocks/.
  • Refactor business logic to depend on the interface via dependency injection.
  • Improve test coverage by exercising the interface-based design and mocks.
  • Configure tooling to exclude the system wrapper from test coverage.

Quick Start

Identify a mixed area of business logic and system interactions, create an interface, implement a thin system wrapper, and refactor the code to depend on the interface.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: refactoring-typescript
Download link: https://github.com/lekman/cdn/archive/main.zip#refactoring-typescript

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.