Guidelines
akash-network/node
Behavioral guidelines to reduce common LLM coding mistakes. An agent skill from akash-network/node.
大规模重构的结构化流程:影响分析→安全网搭建→分步重构→回归验证. An agent skill from 312362115/claude.
$ npx skills add 312362115/claude --skill refactoring -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install 312362115/claude refactoring --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/312362115/claude.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/refactoring .claude/skills/refactoring && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "refactoring" agent skill from https://github.com/312362115/claude/tree/main/skills/refactoring into .claude/skills/refactoring/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "refactoring", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/312362115/claude/tree/main/skills/refactoringType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add 312362115/claude --skill refactoring -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install 312362115/claude refactoring --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/312362115/claude.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/refactoring .agents/skills/refactoring && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "refactoring" agent skill from https://github.com/312362115/claude/tree/main/skills/refactoring into .agents/skills/refactoring/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "refactoring", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add 312362115/claude --skill refactoring -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install 312362115/claude refactoring --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/312362115/claude.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/refactoring .cursor/skills/refactoring && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "refactoring" agent skill from https://github.com/312362115/claude/tree/main/skills/refactoring into .cursor/skills/refactoring/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "refactoring", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/312362115/claude.git --path skills/refactoring--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add 312362115/claude --skill refactoring -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install 312362115/claude refactoring --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/312362115/claude.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/refactoring .gemini/skills/refactoring && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "refactoring" agent skill from https://github.com/312362115/claude/tree/main/skills/refactoring into .gemini/skills/refactoring/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "refactoring", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install 312362115/claude refactoringInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add 312362115/claude --skill refactoring -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/312362115/claude.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/refactoring .github/skills/refactoring && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "refactoring" agent skill from https://github.com/312362115/claude/tree/main/skills/refactoring into .github/skills/refactoring/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "refactoring", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add 312362115/claude --skill refactoring -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install 312362115/claude refactoring --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/312362115/claude.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/refactoring .opencode/skills/refactoring && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "refactoring" agent skill from https://github.com/312362115/claude/tree/main/skills/refactoring into .opencode/skills/refactoring/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "refactoring", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
refactoring大规模重构的结构化流程:影响分析→安全网搭建→分步重构→回归验证. An agent skill from 312362115/claude.
Refactoring is an agent skill from 312362115/claude. 大规模重构的结构化流程:影响分析→安全网搭建→分步重构→回归验证。 适用于涉及多文件、架构调整、模块解耦、接口重新设计等非平凡重构。 本 skill 是流程 skill(调度型),复用 task-execute 管理进度、task-finish 做收尾、 dependency-map 做影响分析、writing 写方案。 触发词:重构、解耦、架构调整、模块拆分、接口重新设计、refactor。 触发场景:用户明确说要重构、task-start 判定为重构类任务、代码审查后决定重构。 小范围重命名或局部调整不需要本 skill,直接动手即可。
Its SKILL.md is about 1.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Development, covering Refactoring. The licence is MIT.
3 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit 2d4fa49. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
gitnpmFrom the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md. Its commands use git and npm, which can reach the network depending on how they are called.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Refactoring loads about 1.2k tokens when it runs. Until then it costs about 71 tokens; SKILL.md has 232 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from 312362115/claude at commit 2d4fa49, republished under its MIT licence (© 312362115). 232 words, ~1,161 tokens.
.claude/skills/refactoring/SKILL.md (or your agent's skills folder).重构最大的风险不是改错,而是改了不知道影响了什么。 本 skill 的核心:先建安全网,再动刀子,每一步都有回退点。
收到重构请求
│
├─ 改动 ≤2 个文件,不涉及公共接口?
│ └─ 直接动手,不需要本 skill
│
├─ 改动 3-5 个文件,局部重构?
│ └─ 走简化流程:第二步(快速版)→ 第四步 → 第五步
│
└─ 涉及公共接口 / 跨模块 / 架构调整 / 数据结构变更?
└─ 走完整流程:第二步 → 第三步 → 第四步 → 第五步 → 第六步判断信号:
| 信号 | 走完整流程 |
|---|---|
| 改公共函数/类的签名 | 是 |
| 拆分或合并模块 | 是 |
| 改数据模型/数据库 schema | 是 |
| 改目录结构 | 是 |
| 改导入路径被多处引用 | 是 |
| 纯内部实现优化,接口不变 | 否,简化流程 |
动手之前,先搞清楚"改这里会动到哪里"。
AskUserQuestion 和用户对齐)对要重构的模块,梳理上下游依赖:
被谁调用(上游)→ [重构目标] → 调用了谁(下游)具体操作:
import/require 关系,画出依赖图列出影响清单:
## 影响分析
### 直接影响(必须改)
- `src/services/auth.ts` — 调用了要重构的函数
- `src/api/user.ts` — 引用了要修改的类型
### 间接影响(需要验证)
- `src/pages/login.tsx` — 依赖 auth 服务,接口不变则不受影响
- `tests/auth.test.ts` — 测试用例需要同步更新
### 不受影响(确认安全)
- `src/utils/format.ts` — 无依赖关系快速版(局部重构):只做 Grep 搜索确认引用范围,不需要完整的影响清单文档。
没有安全网的重构是赌博。安全网 = 测试 + 回退能力。
检查要重构的模块是否有测试:
# 找到相关测试文件
grep -r "重构目标函数名/模块名" tests/ __tests__/ *.test.* *.spec.*| 现有测试情况 | 策略 |
|---|---|
| 有测试且覆盖核心路径 | 先跑通现有测试,确认 baseline 全绿 |
| 有测试但覆盖不足 | 补充关键路径测试后再开始重构 |
| 没有测试 | 必须先补测试,至少覆盖核心路径和边界情况 |
对于没有测试或覆盖不足的情况:
docs/tests/<模块名>-refactor.md# 在重构开始前创建一个明确的 commit 或 branch
git checkout -b refactor/<模块名>
git commit -m "chore: 重构前基线 — 测试全绿"确保随时可以 git diff refactor/<模块名> 看到所有改动,出问题能快速回退。
大象要一口一口吃。每一步都是可验证的、可回退的。
将重构拆分为独立的、可验证的小步骤,每步完成后测试应该通过:
## 重构计划
- [ ] Step 1: <描述> — 预期:测试全绿,行为不变
- [ ] Step 2: <描述> — 预期:测试全绿,行为不变
- [ ] Step 3: <描述> — 预期:测试全绿,新接口生效
- [ ] Step 4: 清理旧代码 — 预期:测试全绿,无废弃代码拆分原则:
| 场景 | 推荐策略 |
|---|---|
| 改公共接口签名 | 先新后删:新接口 → 迁移调用方 → 删旧接口 |
| 拆分大文件/大函数 | 提取 → 内联引用 → 验证 → 删旧 |
| 改目录结构 | 先移文件 → 修导入 → 验证 → 提交(单独一步,不混逻辑改动) |
| 替换依赖/框架 | 适配器模式:新旧共存 → 逐步迁移 → 移除旧依赖 |
| 改数据模型 | 双写过渡:新旧字段并存 → 迁移读写逻辑 → 清理旧字段 |
每完成一个步骤:
git commit -m "refactor(auth): step 1 — 提取 token 验证为独立函数"如果某一步测试挂了:
重构的目标是"行为不变,结构更好"。验证行为是否真的没变。
# 项目测试
npm test # 或 pytest
# 如果有 e2e 测试
npm run test:e2e测试不能覆盖一切。对于以下场景,手动验证:
# 对比重构前后的 git diff,确认改动范围符合预期
git diff refactor/<模块名>..HEAD --stat检查:
docs/tests/ 中的测试用例(重构过程中新增的测试要沉淀)重构完成后,交给 task-finish 执行深度自检:
重构完成后,当用户将需求标 done 时,由 task-manager 触发复盘。重构类任务建议做完整复盘,记录到 docs/decisions/:
task-start
│ 判定为重构任务
↓
refactoring(本 skill)
│
├─ 第二步 ← dependency-map(影响分析,如果有的话)
├─ 第二步 ← writing(写重构方案,大型重构时)
├─ 第四步 ← task-execute(跨会话进度管理)
├─ 第五步 ← perf-profiling(性能相关重构时对比前后)
│
├─ 收尾 → task-finish(CR 自检)
└─ 需求标 done → task-manager → 触发复盘| 反模式 | 后果 | 正确做法 |
|---|---|---|
| 没有安全网就开始改 | 改完不知道哪里坏了 | 先确认测试覆盖,再动手 |
| 一次改太多 | 出问题无法定位 | 小步提交,每步可验证 |
| 重构时顺手加功能 | scope 膨胀,风险叠加 | 重构和功能开发分开做 |
| 改结构的同时改逻辑 | 无法区分是结构改动还是逻辑改动引起的问题 | 一步只做一件事 |
| 注释掉旧代码不删 | 代码越来越脏 | 确认不用了就删 |
| 跳过回归测试 | 上线后才发现问题 | 每步跑测试,最后全量回归 |
| 不记录影响面 | 下次改同样的地方又不知道影响谁 | 影响分析写下来 |
© 312362115, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in skills/refactoring of 312362115/claude.
Open the folder on GitHubat commit 2d4fa49
Refactoring next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Refactoring this skill312362115/claude | 107 | — | ~1.2k | Automated safety check: Pass | MIT | |
| Guidelinesakash-network/node | 1.1k | 22 repos | ~577 | Automated safety check: Pass | MIT | |
| Component Refactoringlangflow-ai/langflow | 156k | — | ~3.5k | Automated safety check: Pass | MIT | |
| Migrate Core Code to Submodulestinyhumansai/openhuman | 42k | — | ~2.6k | Automated safety check: Pass | GPL-3.0 | |
| Systematic Code Refactoringluongnv89/claude-howto | 42k | — | ~3k | Automated safety check: Pass | MIT | |
| Codexskills-directory/skill-codex | 1.5k | 3 repos | ~1.8k | Automated safety check: Pass | MIT |
akash-network/node
Behavioral guidelines to reduce common LLM coding mistakes. An agent skill from akash-network/node.
langflow-ai/langflow
Refactor high-complexity React components in Langflow frontend.
tinyhumansai/openhuman
Plans and carries out moving non-host-specific code and its tests from the OpenHuman core into vendored tiny submodule libraries, then releases the submodule and re-pins the host.
luongnv89/claude-howto
Guides refactoring in phases based on Martin Fowler's method: research, test coverage check, planning and small tested steps, with your approval at each phase.
skills-directory/skill-codex
A skill your agent uses when the user asks to run Codex CLI (codex exec, codex resume) or references OpenAI Codex for code analysis, refactoring, or automated editing
DavidObando/gsharp
Forces the laziest solution that actually works, simplest, shortest, most minimal.
312362115/claude
专业图表生成技能:根据需求自动选择合适的图表类型,生成符合设计规范的 PNG 图表. An agent skill from 312362115/claude.
312362115/claude
深度调研技能:对任意命题进行系统性调研并输出专业研究报告. An agent skill from 312362115/claude.
312362115/claude
MD 文件浏览器预览:GitHub 风格渲染 + 左侧自动目录. An agent skill from 312362115/claude.
312362115/claude
通用写作技能:以"内容→组件→组合"的方式产出技术文档、产品文档、汇报材料. An agent skill from 312362115/claude.
312362115/claude
代码导读技能:帮助快速理解不熟悉的项目或模块,建立心智模型. An agent skill from 312362115/claude.
312362115/claude
数据库代码审查 + Migration 安全检查. An agent skill from 312362115/claude.
Categories
大规模重构的结构化流程:影响分析→安全网搭建→分步重构→回归验证. An agent skill from 312362115/claude. Refactoring is an agent skill from 312362115/claude.
Refactoring fits situations like: tasks that involve Refactoring.
Run `npx skills add 312362115/claude --skill refactoring -a claude-code`. Or copy the skill folder (skills/refactoring in 312362115/claude) into .claude/skills/refactoring in your project. Claude Code loads it when a task matches its description.
Run `npx skills add 312362115/claude --skill refactoring -a codex`. Or copy the skill folder (skills/refactoring in 312362115/claude) into .agents/skills/refactoring in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add 312362115/claude --skill refactoring -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/refactoring, .gemini/skills/refactoring, .github/skills/refactoring and .opencode/skills/refactoring in your project.
Going by SKILL.md and its folder, Refactoring needs the command-line tools its instructions call (git and npm).
SKILL.md contains no URLs. Its commands use git and npm, which can reach the network depending on how they are called. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Refactoring is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.2k tokens (SKILL.md is roughly 4.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Refactoring: Guidelines (akash-network/node, 1.1k stars), Component Refactoring (langflow-ai/langflow, 156k stars), Migrate Core Code to Submodules (tinyhumansai/openhuman, 42k stars) and Systematic Code Refactoring (luongnv89/claude-howto, 42k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
312362115 (a GitHub user) maintains it in 312362115/claude, which has 107 GitHub stars. The repository holds 20 skills in this directory. The repository was last updated on May 14, 2026.
Source: 312362115/claude on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.