Borrowing it
Nothing to install: this file belongs to zhangloveyan/backend-skill. 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/zhangloveyan/backend-skill/main/.claude/skills/proj-refactor/SKILL.mdgit clone --depth 1 https://github.com/zhangloveyan/backend-skillWrote 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/zhangloveyan/backend-skill/proj-refactor)<a href="https://agentmods.dev/skills/zhangloveyan/backend-skill/proj-refactor"><img src="https://agentmods.dev/badge/skills/zhangloveyan/backend-skill/proj-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/zhangloveyan/backend-skill/proj-refactor"><img src="https://agentmods.dev/badge/skills/zhangloveyan/backend-skill/proj-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.00031 | $0.01217 |
| Opus 5.5 | $0.00012 | $0.00487 |
| Sonnet 5.5 | $0.00006 | $0.00243 |
| Haiku 4.5 | $0.00003 | $0.00122 |
Grade A, and why
proj-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 2mo 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.
How it starts
The opening of the file, as written. The whole thing — 211 lines — stays where its author put it; the contents beside it link to each section on GitHub.
代码重构
适用场景
- 代码质量改善
- 消除代码坏味道
- 优化代码结构
- 提高可维护性
重构流程
Step 0: 校验任务文档 → Step 1: 识别问题 → Step 2: 确定范围 → Step 3: 编写测试 → Step 4: 小步重构 → Step 5: 验证
Step 0: 校验任务文档
- 确认全流程任务文档存在
- 若缺失,先创建任务文档骨架并补齐流程状态与上下文快照
- 在上下文快照记录“重构中”与一句话范围说明
重构原则
- 小步前进 - 每次只做一个小改动
- 保持功能 - 重构不改变外部行为
- 测试保障 - 有测试覆盖再重构
- 及时提交 - 每个小步骤后提交
同步任务文档:
- 产物清单记录相关测试/报告路径(如有)
- 更新下一步指令为“验证/继续开发”
常见代码坏味道
1. 过长方法
问题: 方法超过 50 行
重构方法: 提取方法
// ✗ 重构前
public void processOrder(Order order) {
// 50+ 行代码...
}
// ✓ 重构后
public void processOrder(Order order) {
validateOrder(order);
calculatePrice(order);
saveOrder(order);
sendNotification(order);
}
2. 过大类
问题: 类超过 500 行,职责过多
重构方法: 提取类
// ✗ 重构前
public class UserService {
// 用户管理 + 订单管理 + 支付管理...
}
// ✓ 重构后
public class UserService { /* 用户管理 */ }
public class OrderService { /* 订单管理 */ }
public class PaymentService { /* 支付管理 */ }
3. 重复代码
问题: 相同代码出现多处
重构方法: 提取公共方法
// ✗ 重构前
public void methodA() {
// 重复代码块
}
public void methodB() {
// 重复代码块
}
// ✓ 重构后
private void commonMethod() {
// 公共代码块
}
public void methodA() {
commonMethod();
}
public void methodB() {
commonMethod();
}
4. 过长参数列表
问题: 方法参数超过 4 个
重构方法: 引入参数对象
// ✗ 重构前
public void createUser(String name, String phone, String email,
String address, Integer age, Integer status) {}
// ✓ 重构后
public void createUser(UserCreateRequest request) {}
5. 魔法值
问题: 硬编码的数字或字符串
重构方法: 提取常量或枚举
// ✗ 重构前
if (status == 1) { }
if (type.equals("VIP")) { }
// ✓ 重构后
if (status == StatusEnum.ENABLE.getCode()) { }
if (type.equals(UserType.VIP)) { }
6. 过深嵌套
问题: if/for 嵌套超过 3 层
重构方法: 提前返回、提取方法
// ✗ 重构前
public void process(User user) {
if (user != null) {
if (user.isEnabled()) {
if (user.hasPermission()) {
// 业务逻辑
}
}
}
}
// ✓ 重构后
public void process(User user) {
if (user == null) return;
if (!user.isEnabled()) return;
if (!user.hasPermission()) return;
// 业务逻辑
}
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.
- 2mo ago First seen · 211 lines · 31 tokens per session scan A 49bdf700ce94
proj-refactor is a skill published in the GitHub repository zhangloveyan/backend-skill (103 stars, last pushed 23d ago), licensed MIT. It adds 31 tokens to every session and 1,217 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.
proj-refactor compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| proj-refactorzhangloveyan/backend-skill | Skill | 103 | 23d ago | MIT | A | 31 | Claude Code |
| systematic-debuggingopen-metadata/OpenMetadata | Skill | 16k | yesterday | Apache-2.0 | A | 37 | Claude Code |
| log-error-digestzebbern/claude-code-guide | Skill | 4.7k | 3d ago | MIT | A | 71 | Claude Code, Codex |
| cwv-optimizeradobe/skills | Skill | 319 | yesterday | Apache-2.0 | A | 112 | Claude Code |
| ci-fixersipyourdrink-ltd/bernstein | Skill | 1.2k | yesterday | Apache-2.0 | A | 15 | Claude Code, Codex |
| incident-response-incident-responsermyndharis/antigravity-skills | Skill | 1.9k | 23d ago | MIT | A | 36 | Claude Code |
| triaging-web-analytics-supportPostHog/posthog | Skill | 41k | yesterday | none | A | 151 | Claude Code, Codex |