dry-refactoring

仓库创建 2013年5月29日最近提交 1 天前SkillHot 收录 5 小时前
▸ 精选理由

加速消除重复代码并提供多种重构策略供选择。

▸ 风险提示

运行 npx jscpd 会下载并执行外部包,需注意网络与执行安全。

这个 Skill 做什么

基于 jscpd 发现的克隆代码,给出抽取与重构的交互式建议。

在 jscpd 找到克隆代码后,提供交互式的重构建议(提取函数、模块、常量或基类等策略),帮你把复制粘贴变成可复用的抽象。适合想逐步消除代码重复、降低维护成本或生成重构补丁的场景。会根据克隆位置和语言特点推荐合适的重构方式,并考虑跨格式的克隆情况。

▸ 展开 SKILL.md 英文原文

Guided workflow to eliminate copy-paste duplication detected by jscpd. Refactor clones using extract function, module, constant, or base class strategies.

开发编程代码克隆重构向导jscpd通用
5.9k
Stars
252
Forks
2
仓库内 Skill
积累中
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/kucherenko/jscpd/master/skills/dry-refactoring/SKILL.md
或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/kucherenko/jscpd/master/skills/dry-refactoring/SKILL.md"
SKILL.MD 节选查看完整文件 ↗
# dry-refactoring

Guided workflow to eliminate copy-paste duplication in source code. Use after running [jscpd](../jscpd/SKILL.md) to detect clones.

## Prerequisites

First, run jscpd to identify duplications:

```bash
npx jscpd --reporters ai <path>
```

In codebases that mix related formats (e.g. JavaScript and TypeScript), add `--cross-formats` so clones spanning both are detected too:

```bash
npx jscpd --reporters ai --cross-formats "js-ts" <path>
```

See the **[jscpd](../jscpd/SKILL.md)** skill for full option reference, including cross-format group syntax.

## Workflow

1. Run jscpd with `--reporters ai` on the target path
2. Parse each clone line to identify the two duplicated loc
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有