# 找出值得共享的代码 (deslop-shared-libs)

> 在近期改动中找出值得抽成共享库的重复代码，推荐净删除代码最多的三项。

- 分类: [重构](https://www.myskills.tools/zh/categories/refactoring/)
- 来源: 社区 · Garry Tan
- 代码仓库: https://github.com/garrytan/gstack/tree/main/deslop-shared-libs (commit 6237994 · v1.0.0)
- SKILL.md: https://github.com/garrytan/gstack/blob/main/deslop-shared-libs/SKILL.md
- 安装命令: `npx skills add garrytan/gstack --skill deslop-shared-libs`
- 许可证: MIT
- 兼容工具: Claude Code, Codex, Cursor, Copilot
- 权限: read-repo ✓, write-files ✗, shell ✓, network ✓
- 状态: 扫描通过
- 规则扫描无法覆盖所有风险，安装前请阅读此技能的 SKILL.md，确认权限后再使用。
- ⚠ 需要安装 gstack。

## 核心规则

至少要有两个经核实的调用方才建议抽取；结果可以为零，绝不编造调用方。

## 执行阶段

1. **确定审查来源** — 默认审查最近 14 天（UTC）的改动，记录默认分支最新提交和当前分支状态。
2. **从近期工作入手** — 聚焦活跃改动区域，并检查是否已有进行中的相关工作。
3. **评估候选** — 先复用现有库和辅助函数，保持新抽取的函数小而明确，计算整体净删减。
4. **输出推荐** — 列出最多五个新想法，排出最多三条建议并链接已核实的调用方。

## 权限说明（据 SKILL.md 整理）

| 能力 | 是否需要 | 说明 |
|---|---|---|
| 文件写入 | 不需要 | 只做审查：不改文件、不保存报告或临时文件、不开 issue 或 PR。 |
| 命令执行 | 部分需要 | Git 命令只通过 gstack-safe-git 运行，不执行被审项目的任何代码、测试或 hook。 |
| 网络外发 | 部分需要 | 仅用代码托管平台的 GET API 读取远程元数据和源码，不使用 Git 传输协议。 |

## SKILL.md 头部信息（YAML）

```yaml
---
name: deslop-shared-libs
version: 1.0.0
description: Find worthwhile shared-code extractions in recent work. (gstack)
allowed-tools:
  - Bash
  - Read
  - Glob
  - Grep
triggers:
  - find code worth sharing
  - shared-code extraction opportunities
---
```

首页: https://www.myskills.tools/zh/ · URL: https://www.myskills.tools/zh/skills/deslop-shared-libs/
