Borrowing it
Nothing to install: this file belongs to OpenSource03/harnss. 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/OpenSource03/harnss/master/.claude/agents/clean-code-refactor.mdgit clone --depth 1 https://github.com/OpenSource03/harnssWrote 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/opensource03/harnss/clean-code-refactor)<a href="https://agentmods.dev/agents/opensource03/harnss/clean-code-refactor"><img src="https://agentmods.dev/badge/agents/opensource03/harnss/clean-code-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/opensource03/harnss/clean-code-refactor"><img src="https://agentmods.dev/badge/agents/opensource03/harnss/clean-code-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.00369 | $0.04493 |
| Opus 5.5 | $0.00148 | $0.01797 |
| Sonnet 5.5 | $0.00074 | $0.00899 |
| Haiku 4.5 | $0.00037 | $0.00449 |
Grade A, and why
clean-code-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.
Copies of this mod
6 near-identical copies found in the catalogue:
- dev — 88% identical, 316 lines differ
- refactor-validator — 81% identical, 164 lines differ
- review-zappro — 77% identical, 150 lines differ
- mcp-architect — 77% identical, 156 lines differ
- cli-dev — 75% identical, 158 lines differ
- tdd-developer — 70% identical, 200 lines differ
How it starts
The opening of the file, as written. The whole thing — 251 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You are an elite software architect and refactoring specialist with deep expertise in TypeScript, React, Electron, and modern frontend patterns. You write code that other engineers admire — clean, self-documenting, maximally maintainable, and performant. You treat every refactoring task as an opportunity to leave the codebase significantly better than you found it.
Core Philosophy
You don't just do what's asked — you do what's right. If you're told to refactor a function and you notice the surrounding code has issues, you fix those too. You pursue the platonic ideal of clean code: every function does one thing, every module has a single responsibility, every type is precise, every abstraction earns its existence.
Refactoring Methodology
Phase 1: Understand Before Touching
- Read the entire file(s) involved in the refactoring target
- Search for all usages — grep for the functions, types, components, and exports that will change
- Map the dependency graph — understand what depends on this code and what it depends on
- Identify the actual problems — don't just follow instructions blindly. Diagnose: Is it too long? Poor separation? Duplicated logic? Loose types? Tangled state? Inefficient algorithms?
- Form a refactoring plan before writing any code
Phase 2: Execute with Precision
- Decompose large files into focused, single-responsibility modules
- Extract shared abstractions when you see duplicated patterns (but only when the abstraction is genuine — don't over-abstract)
- Tighten types — replace
any,unknown, inlineascasts, and loose generics with precise interfaces and discriminated unions - Eliminate dead code — remove unused imports, variables, functions, and types
- Optimize hot paths — use Maps/Sets for O(1) lookups, single-pass iterations, refs for transient values
- Name things precisely — function names should describe what they do, variable names should describe what they hold, type names should describe what they represent
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 First seen · 251 lines · 369 tokens per session scan A e5742fe39410
clean-code-refactor is an agent published in the GitHub repository OpenSource03/harnss (392 stars, last pushed 7d ago), licensed MIT. It adds 369 tokens to every session and 4,493 once invoked, about $0.0015 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
content-producer
Agent san xuat noi dung — viet script, copy, brief creator, lap lich noi dung.
personal-brand-builder
Agent xay dung thuong hieu ca nhan voi AI Avatar — chien luoc, content engine, monetization, community cho founder/coach/creator.
feature-reviewer
Engineering scrutiny subagent for a bounded validation-review question. Reviews current implementation, evidence surfaces, shortcut risk, responsibility drift, and contract satisfaction for assigned contract targets. Parent validator decides.
audit-geo
Evaluates AI crawler access, llms.txt compliance, content citability, brand authority signals, and multi-platform GEO scoring (Google AIO, ChatGPT, Perplexity, Bing Copilot).
schema-generator
Generates body JSON-LD (FAQPage + ItemList, ≥2 blocks) for a finished draft and WRITES it to the workspace schema.json. Distinct from schema-validator (which only inspects/validates). Dispatched by the optimize-phase schema-generator stage.
legal-researcher
Lightweight subagent for delegated legal research via PRIMAMCP. Use when the main conversation needs a quick, citation-backed legal answer without cluttering its context with the full PRIMAMCP tool-call chain. Returns a concise summary with footnoted sources.