一键导入
skill-refactor
技能自动化重构器 - 自动提取代码到code.md、拆分过长内容、优化技能结构。**自动触发**:每次修改.claude/skills目录下的SKILL.md或code.md后检测并提示用户确认。手动触发:当用户提到"重构技能"、"拆分技能"、"技能代码分离"、"优化技能结构"时使用此skill。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
技能自动化重构器 - 自动提取代码到code.md、拆分过长内容、优化技能结构。**自动触发**:每次修改.claude/skills目录下的SKILL.md或code.md后检测并提示用户确认。手动触发:当用户提到"重构技能"、"拆分技能"、"技能代码分离"、"优化技能结构"时使用此skill。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when writing an OpenCLI adapter for a new site or adding a new command to an existing site. Guides end-to-end from first recon through field decoding, adapter coding, and verify. Replaces opencli-oneshot / opencli-explorer. For ad-hoc browser driving (no adapter), see opencli-browser instead; for a top-level orientation to opencli, see opencli-usage.
Automatically fix broken OpenCLI adapters when commands fail. Load this skill when an opencli command fails — it guides you through diagnosing the failure via OPENCLI_DIAGNOSTIC, patching the adapter, retrying, and filing an upstream GitHub issue after a verified fix. Works with any AI agent.
Use when an agent needs to drive a real Chrome window via opencli — inspect a page, fill forms, click through logged-in flows, or extract data ad-hoc. Covers the selector-first target contract, compound form fields, stale-ref handling, network capture, and the agent-native envelopes the CLI returns. Not for writing adapters — see opencli-adapter-author for that.
Use at the start of any OpenCLI session — this is the top-level map of what `opencli` can do, how to discover adapters, what flags and output formats are universal, and which specialized skill to load next. Point here when an agent asks "what can opencli do?" or "how do I find the right command?".
This skill should be used when the user asks to sync study progress with MemOS, especially `/sync 拉取` to read the latest cross-device context or `/sync 上传` to save today's learning state from local notes.
整理考研数学/专业课章节笔记,生成结构化总结文件。**触发词**:"章节总结"、"整理章节"、"汇总这一章"、"章节笔记"、"数学���记总结"、"整理数学笔记"、"做一个总结"、"总结一下这一章"、"帮我总结"、"写个XX的章节总结"。功能包括:提取重要定义定理公式、保留个人理解、按章节结构组织、生成📝章节总结.md文件。**支持科目**:考研数学、数字电子技术、模拟电子技术等。
| name | skill-refactor |
| description | 技能自动化重构器 - 自动提取代码到code.md、拆分过长内容、优化技能结构。**自动触发**:每次修改.claude/skills目录下的SKILL.md或code.md后检测并提示用户确认。手动触发:当用户提到"重构技能"、"拆分技能"、"技能代码分离"、"优化技能结构"时使用此skill。 |
📁 详细代码实现见 code.md
本技能用于自动化维护和优化其他技能的文件结构:
当检测到以下情况时,提示用户确认后执行:
.claude/skills/**/SKILL.md 后检测到:
.claude/skills/**/code.md 后检测到:
| 文件类型 | 行数阈值 | 触发操作 |
|---|---|---|
| SKILL.md | > 300行 | 内容拆分 |
| code.md | > 400行 | 模块化拆分 |
检测到需要重构时,显示预览并询问用户:
🔍 检测到 {skill_name} 需要重构:
- 包含 X 个代码块可提取
- 文件长度 Y 行(超过阈值)
是否执行重构?
[✅ 立即执行] [⏭️ 跳过] [📋 查看详情]
SKILL.md (包含代码块)
↓ 分析
识别 ```python``` 等代码块
↓ 提取
创建/更新 code.md
↓ 引用
在 SKILL.md 添加 > 📁 详见 [code.md](code.md)
SKILL.md (> 300行)
↓ 分析章节结构
按 ## 标题分组
↓ 拆分
├── SKILL.md (主文档,< 150行)
├── modules/overview.md (模块概览)
├── modules/module1.md (模块1详细)
└── modules/module2.md (模块2详细)
code.md (> 400行)
↓ 分析代码结构
按功能模块分组
↓ 拆分
├── code.md (主入口)
├── scripts/core.py (核心函数)
├── scripts/utils.py (工具函数)
└── scripts/constants.py (常量定义)
## 标题为边界# 🔧 技能重构报告
## 📊 变更统计
| 项目 | 原始 | 重构后 |
|------|------|--------|
| SKILL.md 行数 | 404 | 198 |
| code.md 行数 | 0 | 285 |
| 新增模块文件 | 0 | 2 |
## ✅ 执行操作
1. 提取 5 个代码块到 code.md
2. 拆分 "详细SOP模板" 章节到 modules/sop_details.md
3. 拆分 "符号体系" 章节到 modules/symbols.md
4. 更新 SKILL.md 模块引用表
## 📁 文件变更
- 修改: SKILL.md (-206行)
- 新增: code.md (+285行)
- 新增: modules/sop_details.md (+156行)
- 新增: modules/symbols.md (+89行)
用户修改了 kaoyan-electronics-sop/SKILL.md
AI 检测后提示:
🔍 检测到 kaoyan-electronics-sop/SKILL.md 需要重构:
- 包含 8 个代码块可提取
- 文件长度 404 行(超过 300 行阈值)
用户确认:[✅ 立即执行]
AI 执行重构并生成报告...
用户:帮我重构 kaoyan-electronics-core 技能
AI 执行:
1. 分析 kaoyan-electronics-core 目录
2. 检测 SKILL.md 和 code.md
3. 执行必要的拆分操作
4. 生成变更报告
| 技能 | 协作场景 |
|---|---|
| skill-creator | 创建新技能后自动优化结构 |
| simplify | 重构后简化代码 |
| fix-table-pipe | 确保表格格式正确 |
| 模块 | 文件 | 内容 |
|---|---|---|
| 代码实现 | code.md | 分析器、提取器、拆分器、报告生成器 |
| 检测逻辑 | scripts/detector.py | 代码块检测、行数统计 |
| 重构逻辑 | scripts/refactor.py | 代码提取、内容拆分 |
| 拆分逻辑 | scripts/splitter.py | 章节拆分、模块生成 |
创建日期: 2026-03-27 版本: 1.0.0