harnss: Agent for Claude Code

.claude/agents/clean-code-refactor.md

clean-code-refactor is an agent for Claude Code from OpenSource03/harnss. It costs 369 tokens per session (4,493 once invoked), scanned A, original, MIT.

A code-refactoring agent for TypeScript, React, Electron, and other frontend code. It reorganizes existing code into clearer, more maintainable parts.

In plain words
What is it for?
Refactoring modules, splitting large files, removing duplication, improving type safety, and reviewing performance or overall code quality.
Why use it?
It helps when code has become difficult to understand, contains repeated logic, uses imprecise types, or performs poorly. It examines how files and dependencies fit together before suggesting changes.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter; mentions CLAUDE.md.

This is OpenSource03/harnss's own configuration. It tells Claude Code how to work on harnss itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything harnss configures →

Not installable: its command points at a path on the author’s own machine, so it runs nowhere else. The line is /Users/dejanzegarac/Projects/Harnss/.claude/agent-memory/clean-code-refactor/.

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/OpenSource03/harnss/master/.claude/agents/clean-code-refactor.md
Clone the repo
git clone --depth 1 https://github.com/OpenSource03/harnss

Made for: Claude Code.

Wrote 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.

agentmods badge for clean-code-refactor

README.md
[![agentmods](https://agentmods.dev/badge/agents/opensource03/harnss/clean-code-refactor/github.svg)](https://agentmods.dev/agents/opensource03/harnss/clean-code-refactor)
Your own site
<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.

agentmods 80×15 button for clean-code-refactor

Your own site · 80×15
<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>
Per session 369 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 4,493 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce 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

Measured 1mo ago against content hash e5742fe39410, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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.

Origin

Copies of this mod

6 near-identical copies found in the catalogue:

.claude/agents/clean-code-refactor.md · 251 lines

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

  1. Read the entire file(s) involved in the refactoring target
  2. Search for all usages — grep for the functions, types, components, and exports that will change
  3. Map the dependency graph — understand what depends on this code and what it depends on
  4. 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?
  5. Form a refactoring plan before writing any code

Phase 2: Execute with Precision

  1. Decompose large files into focused, single-responsibility modules
  2. Extract shared abstractions when you see duplicated patterns (but only when the abstraction is genuine — don't over-abstract)
  3. Tighten types — replace any, unknown, inline as casts, and loose generics with precise interfaces and discriminated unions
  4. Eliminate dead code — remove unused imports, variables, functions, and types
  5. Optimize hot paths — use Maps/Sets for O(1) lookups, single-pass iterations, refs for transient values
  6. Name things precisely — function names should describe what they do, variable names should describe what they hold, type names should describe what they represent

Read the full file on GitHub · 251 lines

Changes

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.

  1. 1mo ago First seen · 251 lines · 369 tokens per session scan A e5742fe39410

Subscribe to this mod's changes

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.

Related

Other agents, from other repositories