一键导入
skill-refactor
技能自动化重构器 - 自动提取代码到code.md、拆分过长内容、优化技能结构。**自动触发**:每次修改.Codex/skills目录下的SKILL.md或code.md后检测并提示用户确认。手动触发:当用户提到"重构技能"、"拆分技能"、"技能代码分离"、"优化技能结构"时使用此skill。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
技能自动化重构器 - 自动提取代码到code.md、拆分过长内容、优化技能结构。**自动触发**:每次修改.Codex/skills目录下的SKILL.md或code.md后检测并提示用户确认。手动触发:当用户提到"重构技能"、"拆分技能"、"技能代码分离"、"优化技能结构"时使用此skill。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
822电子技术基础考研学习入口。用于湖南大学822专业课的新学、题型训练、错题回收、章节复盘、模电/数电进度推进。默认围绕“章节输入 -> 题型SOP -> 错题归因 -> 进度更新”的考研闭环执行。
822电子技术基础知识结构与章节复盘模块。用于模电/数电章节定位、前置知识判断、高频题型映射、学习顺序建议、章节卡片和进度骨架生成。
This skill handles note generation and updates for 考研数学 (Chinese graduate entrance math exam) preparation. Use it when users want to generate exam-oriented study notes from existing materials, update notes based on feedback, or create structured learning content with LaTeX formatting.
This skill handles note generation and updates for 考研数学 (Chinese graduate entrance math exam) preparation. Use it when users want to generate exam-oriented study notes from existing materials, update notes based on feedback, or create structured learning content with LaTeX formatting.
审计并优化 LLM 提示缓存命中率、输入 token、延迟与调用成本。用于用户要求“优化缓存命中”“降低 token 成本”“审计 LLM 调用”“提示词缓存优化”“优化 AI 调用费用”,或需要为任意 agent profile 与应用代码建立可观测性和固定回归样本时。
Create or retrofit reusable named workflow state machines for multi-step agent projects. Use when a project needs recoverable workflow state files, multiple workflow definitions, phase gates, restart-safe agent workflows, explicit skipped/blocked states, workflow routing rules, or reusable workflow templates across repositories.
| name | skill-refactor |
| description | 技能自动化重构器 - 自动提取代码到code.md、拆分过长内容、优化技能结构。**自动触发**:每次修改.Codex/skills目录下的SKILL.md或code.md后检测并提示用户确认。手动触发:当用户提到"重构技能"、"拆分技能"、"技能代码分离"、"优化技能结构"时使用此skill。 |
📁 详细代码实现见 code.md
本技能用于自动化维护和优化其他技能的文件结构:
当检测到以下情况时,提示用户确认后执行:
.Codex/skills/**/SKILL.md 后检测到:
.Codex/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