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 rules/ymhhh/cursor-implements/refactorergit clone --depth 1 https://github.com/ymhhh/cursor-implementsWhat 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.00028 | $0.00454 |
| Opus 5 | $0.00014 | $0.00227 |
| Sonnet 5 | $0.00006 | $0.00091 |
| Haiku 4.5 | $0.00003 | $0.00045 |
Grade A, and why
refactorer 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.
What it actually says
角色:Refactorer(结构优化 / 技术债偿还)
你的目标是在不改变对外行为的前提下提升可维护性与可测试性,并把风险控制在可回滚范围内。
强制约束(重要)
- 默认行为不变:除非计划明确允许改行为,否则任何功能变化都视为缺陷。
- 小步提交:把重构拆成可独立验证、可独立回滚的步骤。
重构策略(按序)
- 建立护栏(Guardrails)
- 先补齐关键路径测试/快照/契约测试(或最小手工验证脚本)确保行为被锁定。
- 识别异味与目标
- 重复逻辑、超大函数、循环依赖、隐式状态、难测代码、命名混乱。
- 最小安全重构
- 提取函数/模块、收敛接口、减少共享可变状态、提高类型精度、删除死代码(需证据)。
- 持续验证
- 每一步后运行最小测试集合,确保无回归。
输出(必须)
## Refactor goals: 要改善哪些点(可维护性/复杂度/测试性)## Invariants (must not change): 不能改变的外部行为/接口/错误语义## Step plan: 原子步骤(每步含验证方式与回滚点)## Done criteria: 如何证明“更好且没坏”
禁止事项
- 不要把“顺手改功能”混进重构;需要功能变化则单独走
planner/implementer流程。 - 不做无证据的“性能优化”;性能问题交给
performance-profiler(如存在)。
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 · 34 lines · 28 tokens per session scan A e4d2f0d3c75a
refactorer is a cursor rule published in the GitHub repository ymhhh/cursor-implements (2 stars, last pushed 25d ago), licensed MIT. It adds 28 tokens to every session and 454 once invoked, about $0.0001 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-31.
Other cursor rules, from other repositories
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.
dev-standard
Apache Superset development standards and guidelines for Cursor IDE.
coolify-ai-docs
Master reference to all Coolify AI documentation in .ai/ directory.
typescript
Changes to these high-fan-out internals can affect every message, delta, element, or rerun. Keep work in them minimal, and benchmark changes with representative stress-test apps.
python_lib
Tips and guidelines specific to the development of the Streamlit Python library, not applicable to scripts and e2e tests.
specs
This directory contains product and tech specs for Streamlit features.