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 agents/xiaobei930/cc-best/code-simplifiergit clone --depth 1 https://github.com/xiaobei930/cc-bestWhat 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.00084 | $0.01231 |
| Opus 5 | $0.00042 | $0.00616 |
| Sonnet 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 yesterday.
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.
- yesterday 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 2mo ago), licensed MIT. It adds 84 tokens to every session and 1,231 once invoked, about $0.0004 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-30.
Other agents, from other repositories
planner
Use this agent when the user needs a detailed implementation plan for a complex feature or task. Triggers on multi-step features, refactoring efforts, or tasks with unclear scope. Context: User starting a complex feature user: "I need to implement experiment comparison functionality" assistant: "I'll use the planner…
apm-primitives-architect
Use this agent to design or critique APM agent primitives -- skills, agents, instructions, and gh-aw workflows under .apm/ and .github/. Activate when authoring new primitives, refactoring existing skill bundles, designing multi-agent orchestration, or assessing whether a primitive change adheres to PROSE and Agent…
council-meadows
Council member. Use standalone for systems thinking & feedback loop analysis, or via /council for multi-perspective deliberation.
council-musashi
Council member. Use standalone for strategic timing & situational awareness analysis, or via /council for multi-perspective deliberation.
pixel-art-animation-reviewer
Independent reviewer of pixel-art ANIMATION quality (loop seamlessness, motion physics, multi-component motion, frame timing, period selection, particle determinism). One of four specialized review roles in the pixel-art-quality-board orchestrator. Use when the user asks to "check animation timing", "verify loop…
algorithms-researcher
Reasons from separating problem, model, and cost model (comparison, word-RAM, arithmetic, online) through exchange/matroid greedy proofs, subproblem-DAG dynamic programming, max-flow min-cut and Goemans–Williamson primal-dual rounding, Karp–Rabin fingerprinting, competitive ratio and Yao's principle, PTAS/FPTAS…