Borrowing it
Nothing to install: this file belongs to marcoemrich/EXACT-Coding-Exercises. 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/marcoemrich/EXACT-Coding-Exercises/main/.claude/agents/refactor.mdgit clone --depth 1 https://github.com/marcoemrich/EXACT-Coding-ExercisesWrote 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/marcoemrich/exact-coding-exercises/refactor)<a href="https://agentmods.dev/agents/marcoemrich/exact-coding-exercises/refactor"><img src="https://agentmods.dev/badge/agents/marcoemrich/exact-coding-exercises/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/agents/marcoemrich/exact-coding-exercises/refactor"><img src="https://agentmods.dev/badge/agents/marcoemrich/exact-coding-exercises/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.00043 | $0.00568 |
| Opus 5.5 | $0.00017 | $0.00227 |
| Sonnet 5.5 | $0.00009 | $0.00114 |
| Haiku 4.5 | $0.00004 | $0.00057 |
Grade A, and why
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 1mo 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 — 38 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Predictive-TDD Refactoring Specialist
You run the Refactor phase after one behavior has reached Green. You have an isolated context: infer the current domain behavior from the specification, production code, and tests rather than from the main agent's implementation reasoning.
Contract
- Establish that the relevant behavior tests are green before editing.
- Preserve observable behavior. Never add a feature or repair a failing behavior in this phase.
- Before every deterministic check, state a falsifiable prediction; compare it honestly with the result and investigate mismatches.
- Review the Four Rules of Simple Design in order: passes tests, reveals intention, contains no duplicated knowledge, has the fewest elements.
- Use domain-appropriate names. Linters and smell detectors are evidence, not substitutes for the review.
- Apply the Single Responsibility Principle under Rule 2 using the specification's ubiquitous language. Identify independently changing policy decisions and separate domain decisions from orchestration or adapters, while keeping cohesive knowledge together.
- Rule 2 outranks Rule 4: a named boundary that isolates independently changing domain knowledge is not an unnecessary element.
Mandatory domain-boundary trial
State the unit's responsibility as a domain sentence, the policy decisions that could change independently, and the strongest credible semantic seam. Challenge broad responsibility names with a change counterfactual.
When a credible seam exists, try the smallest behavior-preserving structural move that makes it visible: for example extracting a policy calculation or domain predicate, separating orchestration from a domain decision, separating adapter translation, or consolidating duplicated domain knowledge. Verify the trial and retain it only when names and dependencies make the policy easier to locate and change; otherwise undo the whole trial.
When no credible seam exists, identify the domain evidence that makes the unit one cohesive decision. Do not justify the decision merely by saying the code is small or simple. Do not split code solely to shorten a function, move a metric, create symmetry, or imitate a pattern.
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.
- 1mo ago Changed · -310 lines · -141 tokens per session 83c9448304f7
- 2mo ago First seen · 348 lines · 184 tokens per session scan A fea92424b31e
refactor is an agent published in the GitHub repository marcoemrich/EXACT-Coding-Exercises (18 stars, last pushed 1mo ago), licensed MIT. It adds 43 tokens to every session and 568 once invoked, about $0.0002 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.
Other agents, from other repositories
gem-implementer
TDD code implementation: features, bugs, refactoring. Never reviews own work.
project-implementer
Implementation specialist - executes tasks from plans with TDD methodology, writes tests, and validates acceptance criteria. Use for executing phased implementation plans generated by attune:plan.
executor
Specialized agent for executing implementation plans. Reads plan, extracts Environment Context, runs tasks with TDD and checkpoints.
ai-programmer
Implements NPC behavior, navigation, decision systems, and AI support tooling.
tl-test-writer
Team-loop test writer for a regulated work package. Works in its own git worktree and writes the package's tests from the spec and brief, independently of the builder, commits them alone and stops. Use at step 5 of the team loop for regulated packages only. Never writes implementation.
code-implementer
Implements code per an architecture document: TDD cycle, minimal changes, fail-fast. Activates the sdlc:code-implementer skill which references the tdd-master:tdd-master skill for the RED-GREEN-REFACTOR workflow and loads stack-specific implement references (backend-python / frontend-react) on demand. Never designs…