Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add commands/sumulige/sumulige-claude/refactorgit 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.svg" alt="Measured on agentmods" 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 | $0.00006 | $0.00568 |
| Opus 5 | $0.00003 | $0.00284 |
| Sonnet 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 3d 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.
- 3d ago First seen · 103 lines · 6 tokens per session scan A ce1aef1eaad4
refactor is a command published in the GitHub repository sumulige/sumulige-claude (2 stars, last pushed 6mo ago), licensed MIT. It adds 6 tokens to every session and 568 once invoked, about $0.0000 per session on Opus 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).
speckit.checklist
Generate a custom checklist for the current feature based on user requirements.
speckit.analyze
Perform a non-destructive cross-artifact consistency and quality analysis across spec.md, plan.md, and tasks.md after task generation.
speckit.plan
Execute the implementation planning workflow using the plan template to generate design artifacts.
handoff
Force a session catchup or a memory promotion outside the hook lifecycle. Default is catchup (read-only); promote is HITL gated.
gate
You are the Gate System controller. Execute quality gate reviews based on the user's request.