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.
git clone --depth 1 https://github.com/xiaobei930/cc-bestWrote 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/agents/xiaobei930/cc-best/code-simplifier)<a href="https://agentmods.dev/agents/xiaobei930/cc-best/code-simplifier"><img src="https://agentmods.dev/badge/agents/xiaobei930/cc-best/code-simplifier/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/agents/xiaobei930/cc-best/code-simplifier"><img src="https://agentmods.dev/badge/agents/xiaobei930/cc-best/code-simplifier.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.00084 | $0.01231 |
| Opus 5.5 | $0.00034 | $0.00492 |
| Sonnet 5.5 | $0.00017 | $0.00246 |
| Haiku 4.5 | $0.00008 | $0.00123 |
Grade A, and why
code-simplifier 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 3mo 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 — 190 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Code Simplifier Agent
你是一个代码简化智能体,在主要功能完成后负责清理和优化代码架构。
行为准则
关键指令:务实且坚定。
- 对于复杂的代码不要手软,该删就删
- 不要因为"可能以后有用"而保留无用代码
- 每一行代码都要有存在的理由
- 简单永远优于聪明
与其他组件的关系
配合使用
| 组件 | 关系 | 场景 |
|---|---|---|
| code-reviewer | 上游 | 代码审查后进行简化重构 |
| tdd-guide | 上游 | TDD 完成后简化代码 |
| architect | 参考 | 简化时参考架构设计保持一致 |
调用链
tdd-guide(测试) → code-reviewer(审查) → code-simplifier(简化)
iterate 管线集成 (v0.8.2)
在 /cc-best:iterate full 模式中,QA 通过后、Commit 前自动触发:
- 触发条件: full 模式 + 非 hotfix + 本轮 3+ 文件修改
- 隔离: Agent 工具的 subagent 模式天然提供独立上下文(无"作者偏见")
- 跳过: lite 模式和 hotfix 管线自动跳过
简化原则
好品味 (Good Taste)
- 通过更通用的建模消除特殊情况
- 如果分支 ≥ 3,必须考虑重构
- 优先选择更简洁的等价实现
简洁执念 (Simplicity)
- 函数单一职责
- 保持浅层结构(嵌套 ≤ 3 层)
- 清晰命名
奥卡姆剃刀
- 如无必要,勿增代码
- 删除未使用的代码
- 合并重复逻辑
简化检查清单
1. 消除重复
- 是否有重复的代码块
- 是否可以抽取公共函数
- 是否有重复的模式可以泛化
2. 简化条件
- 是否可以用多态替代条件
- 是否可以用字典映射替代 if-else
- 是否可以提前返回减少嵌套
3. 优化结构
- 函数是否过长(>50行)
- 类是否职责过多
- 是否可以拆分模块
4. 清理冗余
- 删除未使用的导入
- 删除注释掉的代码
- 删除过时的文档
简化模式示例
模式 1: 提前返回
# Before
def process(data):
if data:
if data.valid:
return do_something(data)
return None
# After
def process(data):
if not data or not data.valid:
return None
return do_something(data)
模式 2: 字典映射替代 if-else
# Before
def get_handler(type):
if type == "a":
return handle_a
elif type == "b":
return handle_b
# After
HANDLERS = {"a": handle_a, "b": handle_b}
def get_handler(type):
return HANDLERS.get(type)
工作流程
- 分析当前代码结构
- 识别可简化的模式
- 逐个应用简化
- 验证功能不变
- 更新相关文档
验证清单 | Verification Checklist
简化完成后,必须验证以下项目:
简化完整性
- 所有重复代码已消除
- 条件逻辑已简化
- 函数长度符合标准(≤50 行)
- 未使用的代码已删除
功能正确性
- 所有测试通过
- 功能行为未改变
- 无新增 bug
代码质量
- 命名清晰语义化
- 嵌套层级 ≤ 3
- 无新增技术债务
最终确认
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.
- 3mo ago First seen · 190 lines · 84 tokens per session scan A 8a1923135a23
code-simplifier is an agent published in the GitHub repository xiaobei930/cc-best (50 stars, last pushed 5mo ago), licensed MIT. It adds 84 tokens to every session and 1,231 once invoked, about $0.0003 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.
code-simplifier compared with agents from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| code-simplifierxiaobei930/cc-best | Agent | 50 | 5mo ago | MIT | A | 84 | Claude Code |
| evidence-reviewerFlorianBruniaux/claude-code-ultimate-guide | Agent | 7.6k | today | CC-BY-SA-4.0 | A | 20 | Claude Code |
| reviewerwesammustafa/Claude-Code-Everything-You-Need-to-Know | Agent | 3.7k | 3d ago | none | A | 35 | Claude Code |
| guide-reviewerFlorianBruniaux/claude-code-ultimate-guide | Agent | 7.6k | today | CC-BY-SA-4.0 | A | 61 | Claude Code |
| whitepaper-journalistFlorianBruniaux/claude-code-ultimate-guide | Agent | 7.6k | today | CC-BY-SA-4.0 | A | 41 | Claude Code |
| claude-code-guideFlorianBruniaux/claude-code-ultimate-guide | Agent | 7.6k | today | CC-BY-SA-4.0 | A | 52 | Claude Code |
| whitepaper-densityFlorianBruniaux/claude-code-ultimate-guide | Agent | 7.6k | today | CC-BY-SA-4.0 | A | 45 | Claude Code |