oop-to-fp-refactor
CommunityRefactor OOP TS to FP with pure, modular code.
Authorlinzb93
Version1.0.0
Installs0
System Documentation
What problem does it solve?
将面向对象编程 (OOP) 代码(类、继承、工厂模式)重构为函数式编程 (FP) 风格(纯函数、接口)。当需要重构旧的 OOP 代码或用户要求“函数式重构xx命令”时调用。
Core Features & Use Cases
- 识别并定位 OOP 代码中的类、继承和工厂模式,映射到等效的 FP 结构(函数、接口、模块导出)。
- 在不改变核心行为的前提下,移除类、构造函数并将公共方法转换为导出的常量函数,私有方法转为文件作用域函数。
- 提供系统化的迁移策略,支持将状态从实例成员转换为纯参数传递,并更新依赖注入模式以使用单例工具。
- Use Case: 将含有大量实例化和多态行为的 CLI 子命令重写为纯函数风格,提升可测试性与组合性。
Quick Start
Follow the refactor guide to convert a sample OOP CLI command into a pure function module, ensuring exported API matches the original usage and updating imports accordingly.
Dependency Matrix
Required Modules
None requiredComponents
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: oop-to-fp-refactor Download link: https://github.com/linzb93/cli-tools/archive/main.zip#oop-to-fp-refactor Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.