business-index-splitter

Split mixed type declarations and runtime code in business module index.ts files.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/linzb93/cli-tools --skill business-index-splitter
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: business-index-splitter
Source: https://github.com/linzb93/cli-tools/tree/main/.trae/skills/business-index-splitter
Command: npx skills add https://github.com/linzb93/cli-tools --skill business-index-splitter

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill separates mixed type declarations and executable business logic that are combined in a single index.ts into distinct types and service files, reducing coupling and improving maintainability.

Core Features & Use Cases

  • Type/implementation separation: Move interfaces, type aliases, and enums into types.ts and place functions, classes, and runtime constants into service.ts.
  • API-preserving re-exports: Rewrite index.ts to only re-export types and services so callers keep the same public API.
  • Use Case: Standardize monorepo CLI business modules under packages/cli/src/business when a module currently packs both type definitions and implementations into index.ts.

Quick Start

Split packages/cli/src/business/fork/index.ts into types.ts and service.ts while preserving original export names and updating index.ts to only re-export.

Frequently Asked Questions about business-index-splitter

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

FAQPage Schema
How do I split type declarations and implementation logic in an index.ts file?▼

To split type declarations and implementation logic in an index.ts file, this Skill extracts interfaces and enums into types.ts and runtime functions into service.ts. It then rewrites index.ts to only re-export these files, preserving the original public API.

What is the best way to refactor business modules in a TypeScript monorepo CLI?▼

The best way to refactor business modules in a TypeScript monorepo CLI is to separate mixed index.ts code into distinct types.ts and service.ts files. This reduces coupling and improves maintainability while keeping original export names intact.

Can I use this to split code in packages/cli/src/business/ directories?▼

Yes, this Skill specifically targets packages/cli/src/business/<module>/ directories where a single index.ts contains both type definitions and runtime code, separating them into types.ts and service.ts files.

Does splitting mixed TypeScript code into service and types files preserve API compatibility?▼

Splitting mixed TypeScript code into service and types files preserves API compatibility by rewriting the original index.ts to only re-export the extracted modules. Callers continue importing from index.ts using the same public export names without breaking changes.

When do I need to separate types and runtime code in a TypeScript module?▼

You need to separate types and runtime code in a TypeScript module when a single index.ts packs both type definitions and implementations, creating tight coupling. Splitting them reduces coupling and improves maintainability for monorepo CLI business modules.