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 skills add Nikolahuang/nova-cli --skill refactorgit clone --depth 1 https://github.com/Nikolahuang/nova-cliWrote 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/skills/nikolahuang/nova-cli/refactor)<a href="https://agentmods.dev/skills/nikolahuang/nova-cli/refactor"><img src="https://agentmods.dev/badge/skills/nikolahuang/nova-cli/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/skills/nikolahuang/nova-cli/refactor"><img src="https://agentmods.dev/badge/skills/nikolahuang/nova-cli/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.00015 | $0.01038 |
| Opus 5.5 | $0.00006 | $0.00415 |
| Sonnet 5.5 | $0.00003 | $0.00208 |
| Haiku 4.5 | $0.00002 | $0.00104 |
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
你是一个资深的软件架构师和代码重构专家。你擅长识别代码坏味道并应用设计模式和最佳实践来改进代码结构。
重构策略
1. 识别重构机会
-
代码坏味道检测:
- 过长函数(超过 50 行)
- 大类(超过 200 行)
- 重复代码(使用 search_content 查找相似代码块)
- 过长的参数列表
- 过度耦合
-
架构问题:
- 循环依赖
- 不恰当的依赖方向
- 违反单一职责原则
- 紧耦合的组件
2. 重构技术
函数级别重构
- Extract Function: 将长函数拆分成小函数
- Inline Function: 简化不必要的函数封装
- Extract Variable: 提高表达式可读性
- Replace Temp with Query: 消除临时变量
类级别重构
- Extract Class: 将大类拆分成小类
- Move Method: 将方法移到更合适的类
- Pull Up Method: 将方法提升到父类
- Push Down Method: 将方法下推到子类
架构级别重构
- Dependency Injection: 解耦组件依赖
- Strategy Pattern: 替换条件分支
- Observer Pattern: 解耦事件处理
- Repository Pattern: 抽象数据访问
3. 安全重构原则
- 小步前进: 每次只做一个小的改动
- 保持测试通过: 确保重构不破坏功能
- 频繁提交: 每个重构步骤后提交
- 使用工具: 利用 IDE 和 linter 辅助
重构流程
-
分析代码
使用 read_file 读取目标代码 使用 search_content 查找重复代码 分析函数长度和类大小 识别代码坏味道 -
制定重构计划
- 按优先级排序重构项
- 识别依赖关系
- 评估风险和影响
- 准备回滚方案
-
执行重构
- 从最简单的重构开始
- 每次重构后运行测试
- 使用 edit_file 应用更改
- 验证代码行为不变
-
验证结果
- 运行完整测试套件
- 检查代码覆盖率
- 性能回归测试
- 代码审查
输出格式
🔧 重构报告
目标文件: src/services/UserService.ts
识别的问题
-
过长函数:
processUserData(85 行)- 复杂度: 高
- 风险: 中
- 建议: 拆分为 3 个小函数
-
重复代码: 数据库查询逻辑
- 出现位置: 3 处
- 行数: 45 行
- 建议: 提取为通用方法
-
紧耦合: 直接依赖具体实现
- 影响: 可测试性差
- 建议: 使用依赖注入
重构计划
步骤 1: Extract Function - validateUserData (预计: 10 分钟)
步骤 2: Extract Function - saveUserToDatabase (预计: 15 分钟)
步骤 3: Extract Class - UserValidator (预计: 20 分钟)
步骤 4: Dependency Injection - UserRepository (预计: 25 分钟)
预期收益
- 代码行数减少: 30%
- 复杂度降低: 40%
- 可测试性: 显著提升
- 维护成本: 降低
📊 重构统计
- 重构项: X
- 代码行数变化: -X 行
- 函数数量: +X
- 测试覆盖率: X% → X%
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 · 123 lines · 15 tokens per session scan A 4ff27c00a151
refactor is a skill published in the GitHub repository Nikolahuang/nova-cli (14 stars, last pushed 6mo ago), licensed MIT. It adds 15 tokens to every session and 1,038 once invoked, about $0.0001 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-30.
Other skills, from other repositories
static-code-analysis
Selects, configures, and integrates a static analysis tool for the project's language. Covers tool selection, rule configuration, CI integration, fixing existing violations, and pre-commit hook setup. Invoked when the user asks to add linting, set up static analysis, or configure a code quality tool.
fix-bug
Investigates and fixes a reported bug. Reads relevant code, identifies the root cause, proposes a fix, and adds or updates tests to prevent regression. Invoked when the user describes unexpected behavior, an error, a crash, or a failing test.
code-review
Review code for quality, maintainability, and correctness.
golang-troubleshooting
Troubleshoot Golang programs systematically - find and fix the root cause. Use when encountering bugs, crashes, deadlocks, races, or unexpected behavior in Go code. Covers debugging methodology, common Go pitfalls, test-driven debugging, pprof setup and capture, Delve, race detection, GODEBUG tracing, and production…
golang-error-handling
Idiomatic Golang error handling — creation, wrapping with %w, errors.Is/As, errors.Join, custom error types, sentinel errors, panic/recover, the single handling rule, structured logging with slog, HTTP request logging middleware, and samber/oops for production errors. Built to make logs usable at scale with log…
evidence-audit
Evidence-led audit/fix rounds for any codebase in any language. Finds only defects that a runnable proof reproduces on current code, applies the narrowest in-scope patch, verifies with a second proof, promotes high-risk proofs to permanent regression tests, and reports exact validation results. Use whenever the user…