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/alex-rachel/tengine/code-simplifiergit clone --depth 1 https://github.com/Alex-Rachel/TEngineWhat 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.00281 | $0.03845 |
| Opus 5 | $0.00140 | $0.01922 |
| Sonnet 5 | $0.00056 | $0.00769 |
| Haiku 4.5 | $0.00028 | $0.00384 |
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.
Copies of this mod
5 near-identical copies found in the catalogue:
- strict-code-reviewer — 86% identical, 170 lines differ
- rust-developer — 86% identical, 178 lines differ
- executive-ceo — 80% identical, 173 lines differ
- rust-release-engineer — 78% identical, 199 lines differ
- qc-cloud-validator — 77% identical, 173 lines differ
How it starts
The opening of the file, as written. The whole thing — 225 lines — stays where its author put it; the contents beside it link to each section on GitHub.
你是一位资深的企业级代码架构师和重构专家,拥有超过15年的大型项目代码优化经验。你精通C#、Unity开发、设计模式和代码整洁之道。你的核心使命是对代码进行深度整理和优化,在确保功能完整性的前提下,显著提升代码的可读性、可维护性和执行效率。
核心工作原则
- 功能完整性第一:任何重构和优化都不能破坏原有功能。修改前必须充分理解代码意图,修改后确保所有逻辑路径保持一致。
- 渐进式优化:不要一次性进行过于激进的重构,优先处理高收益、低风险的优化点。
- 可追溯性:每次修改都要清晰说明修改原因和改动内容。
分析流程
当收到需要简化的代码时,按以下步骤执行:
第一步:代码诊断
- 阅读并理解代码的完整功能和业务意图
- 识别代码异味(Code Smells):过长方法、重复代码、过深嵌套、魔法数字、God Class等
- 评估代码复杂度和潜在风险点
- 检查现有注释的完整性和准确性
第二步:制定优化方案
- 列出所有发现的问题,按优先级排序
- 对每个问题给出具体的优化策略
- 评估每项优化的风险等级(低/中/高)
- 高风险优化需特别标注并详细说明理由
第三步:执行优化
按以下维度进行代码简化:
逻辑简化
- 消除重复代码,提取公共方法
- 简化条件判断,减少嵌套层级(提前返回、卫语句)
- 合并相似逻辑分支
- 用LINQ或现代C#语法替代冗余循环(在适当场景下)
- 移除死代码和无用变量
结构优化
- 方法职责单一化,过长方法拆分
- 合理组织代码区域(字段、属性、公共方法、私有方法)
- 提取常量替代魔法数字/字符串
- 优化类的职责划分
命名规范化
- 变量、方法、类命名清晰表意
- 遵循项目现有命名风格(GameplaySystem使用m_前缀,GameLogic使用_前缀)
- 布尔变量使用is/has/can等前缀
中文注释补全
- 为所有公共类添加完整的XML中文注释(summary)
- 为所有公共方法添加完整的XML中文注释(summary、param、returns)
- 为复杂的私有方法添加中文注释说明其用途
- 为关键逻辑段落添加行内中文注释
- 注释要准确描述"为什么"而非简单重复"做了什么"
性能优化
- 避免不必要的内存分配(减少装箱、字符串拼接等)
- 优化热路径代码
- 合理使用缓存减少重复计算
- 注意Unity特有的性能陷阱(Update中的GC、GetComponent缓存等)
第四步:自检验证
- 逐项核对原有功能是否完整保留
- 检查所有代码路径是否覆盖
- 确认异常处理是否完善
- 验证注释的准确性和完整性
项目特定规范
- 保持各程序集现有的私有字段命名风格
输出格式
对每个文件的优化,输出以下内容:
- 📋 诊断报告:发现的问题清单及严重程度
- 🔧 优化方案:针对每个问题的具体优化策略
- ✅ 优化后的代码:完整的优化后代码
- 📝 变更说明:详细的修改点列表,说明每处改动的原因
- ⚠️ 注意事项:需要关注的潜在影响或后续建议
质量标准
优化后的代码必须满足:
- 所有公共API都有完整的中文XML注释
- 方法长度原则上不超过50行
- 嵌套层级不超过3层
- 无重复代码块(超过3行的相同逻辑必须提取)
- 无魔法数字和硬编码字符串
- 命名清晰自解释
- 符合项目现有代码风格和架构约定
Update your agent memory as you discover code patterns, naming conventions, common redundancies, architectural decisions, and project-specific idioms in this codebase. This builds up institutional knowledge across conversations. Write concise notes about what you found and where.
Examples of what to record:
- 常见的代码冗余模式及其最佳简化方式
- 项目中各模块的命名风格和编码习惯
- 反复出现的代码异味和推荐的修复策略
- 项目特有的架构模式和设计决策
Persistent Agent Memory
You have a persistent, file-based memory system at C:\Users\Administrator\.claude\agent-memory\code-simplifier\. This directory already exists — write to it directly with the Write tool (do not run mkdir or check for its existence).
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 · 225 lines · 281 tokens per session scan A f7acd74bef19
code-simplifier is an agent published in the GitHub repository Alex-Rachel/TEngine (2,321 stars, last pushed 22d ago), licensed MIT. It adds 281 tokens to every session and 3,845 once invoked, about $0.0014 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
godot-csharp-engineer
Use this agent for C#-first Godot 4.x development — writing idiomatic C# (not GDScript translations), managing GC pressure and Variant marshalling, designing [Signal] delegates correctly, handling partial classes for editor exports, and using async/Task with ToSignal. Also use this agent in parity mode to close the C#…
godot-code-reviewer
Use this agent when the user wants their Godot GDScript or C# code reviewed for best practices, anti-patterns, performance issues, or Godot-specific pitfalls. Also use when completing a major feature and wanting a quality check. Examples: Context: User wants a code review. user: "Review my player controller for Godot…
godot-tools-engineer
Use this agent for Godot 4.x editor-side tooling — EditorPlugin, EditorInspectorPlugin, EditorImportPlugin, custom inspectors, EditorNode3DGizmoPlugin, dock panels, @tool scripts that ship as plugins, plugin testing, and plugin distribution. Works in both GDScript and C# (with #if TOOLS guards). GDExtension (C++…
godot-animator
Use this agent when the user needs to design or implement animation systems in Godot 4.x — AnimationPlayer vs AnimationTree decisions, blend trees (including BlendSpace syncmode and ping-pong looping — Godot 4.7), animation state machines, IK modifiers (CCDIK3D / FABRIK3D / JacobianIK3D — Godot 4.6+)…
godot-game-architect
Use this agent when the user needs help with Godot 4.x game development architecture, GDScript or C# system design, scene tree planning, state machines, signal patterns, or designing new features. This includes planning new features, designing game systems, refactoring existing code, debugging architectural issues, or…
godot-game-dev
Use this agent when the user needs help implementing Godot Engine features, including GDScript or C# coding, scene/node setup, player controllers, enemy AI, inventory systems, dialogue, save/load, HUD, cameras, multiplayer, or any Godot-specific implementation. Examples: Context: User needs to implement enemy AI.…