Borrowing it
Nothing to install: this file belongs to sumulige/sumulige-claude. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/sumulige/sumulige-claude/main/.claude/commands/refactor.mdgit clone --depth 1 https://github.com/sumulige/sumulige-claudeWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/commands/sumulige/sumulige-claude/refactor)<a href="https://agentmods.dev/commands/sumulige/sumulige-claude/refactor"><img src="https://agentmods.dev/badge/commands/sumulige/sumulige-claude/refactor/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/commands/sumulige/sumulige-claude/refactor"><img src="https://agentmods.dev/badge/commands/sumulige/sumulige-claude/refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00006 | $0.00568 |
| Opus 5.5 | $0.00002 | $0.00227 |
| Sonnet 5.5 | $0.00001 | $0.00114 |
| Haiku 4.5 | $0.00001 | $0.00057 |
Grade A, and why
refactor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
What it actually says
/refactor
安全的代码重构和清理。
使用方式
/refactor # 分析并建议清理(默认)
/refactor --dead # 查找死代码
/refactor --deps # 查找未使用依赖
/refactor --duplicate # 查找重复代码
/refactor --execute # 执行清理(需确认)
关联 Skill
此命令加载 quality-guard skill(清理模式)。
工作流程
Step 1: 运行分析工具
# 未使用的文件、导出、依赖
npx knip
# 未使用的 npm 依赖
npx depcheck
# 未使用的 TypeScript 导出
npx ts-prune
# 未使用的 eslint-disable
npx eslint . --report-unused-disable-directives
Step 2: 风险分类
| 风险 | 类型 | 处理 |
|---|---|---|
| 🟢 SAFE | 未使用导出、测试文件 | 可直接删除 |
| 🟡 CAREFUL | 动态导入可能使用 | 需验证 |
| 🔴 RISKY | 公共 API、配置文件 | 谨慎处理 |
Step 3: 生成报告
# Refactor Report
## Dead Code
| File | Type | Risk | Reason |
|------|------|------|--------|
## Unused Dependencies
| Package | Size | Last Used |
|---------|------|-----------|
## Duplicate Code
| Location 1 | Location 2 | Lines |
|------------|------------|-------|
## Recommended Actions
1. [ ] Remove unused-package (SAFE)
2. [ ] Delete src/old.ts (SAFE)
3. [ ] Review src/utils.ts (CAREFUL)
## Impact
- Files to delete: X
- Dependencies to remove: Y
- Lines of code: -Z
Step 4: 执行清理(--execute)
⚠️ 执行前:
1. 创建备份分支
2. 确保测试通过
3. 逐个删除,每删一个运行测试
4. 记录到 DELETION_LOG.md
安全检查清单
删除前:
- grep 所有引用
- 检查动态导入
- 查看 git 历史
- 运行所有测试
删除后:
- 构建成功
- 测试通过
- 提交变更
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago First seen · 103 lines · 6 tokens per session scan A ce1aef1eaad4
refactor is a command published in the GitHub repository sumulige/sumulige-claude (1 stars, last pushed 8mo ago), licensed MIT. It adds 6 tokens to every session and 568 once invoked, about $0.0000 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other commands, from other repositories
doctor
Run read-only health checks on the Kobiton automate plugin (CLI, credentials, profile, vUSB client).
lint
Command "lint" from ApexIQ/skillsmith, covering command: /lint, goal, resources and execution plan.
debug
Command "debug" from ApexIQ/skillsmith, covering command: /debug, goal, resources and execution plan.
debug-issue
Command "debug-issue" from ApexIQ/skillsmith, covering command: /debug-issue, goal, resources and execution plan.
service-check
Request each agent to run a self-diagnostic to validate their runtime setup.
validate
Run SDLC compliance check against the current project. Validates build system, code quality, testing, CI/CD, security, documentation, VCS, and release configurations.