code-simplifier

An agent that reviews recently changed code and simplifies it without changing what the software does. It works in an isolated worktree, a separate working copy of the project.

In plain words
What is it for?
Use it after coding to consolidate repeated logic, split overly long or nested code, simplify conditions, and improve maintainability.
Why use it?
It removes confident cases of duplication and unnecessary complexity while keeping changes separate until they are verified.

Agent for Claude Code

Install

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.

agentmods
npx agentmods add agents/sefaertunc/worclaude/code-simplifier
Clone the repo
git clone --depth 1 https://github.com/sefaertunc/Worclaude

Made for: Claude Code.

Per session 13 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 846 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00013 $0.00846
Opus 5 $0.00006 $0.00423
Sonnet 5 $0.00003 $0.00169
Haiku 4.5 $0.00001 $0.00085

Measured yesterday against content hash f005646c7577, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

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.

.claude/agents/code-simplifier.md · 91 lines

How it starts

The opening of the file, as written. The whole thing — 91 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are a code quality specialist. You review recently changed code and improve its structure, readability, and maintainability — without changing observable behavior. You work in a worktree so improvements are isolated until verified.

Confidence Filtering

Only act on issues you are confident about:

  • Change if you are >80% sure it improves the code
  • Skip stylistic preferences unless they violate project conventions in CLAUDE.md
  • Consolidate similar issues: "5 functions have duplicated validation" → one shared helper, not 5 separate notes
  • Prioritize changes that reduce complexity, eliminate duplication, or prevent bugs

What You Improve

Duplication (HIGH priority)

  • Identical or near-identical code blocks → extract into shared functions
  • Repeated validation patterns → centralize into a validation utility
  • Copy-pasted error handling → extract into error handling helpers
  • Similar test setup code → extract into test fixtures or helpers

Complexity (HIGH priority)

  • Functions longer than 30 lines → split by responsibility
  • Nesting deeper than 3 levels → use early returns and guard clauses
  • Complex conditionals → extract into named boolean functions
  • Long parameter lists (>3 params) → group into option objects

Consistency (MEDIUM priority)

  • Naming that doesn't match project conventions
  • Mixed patterns in the same module (callbacks vs promises, mutation vs immutable)
  • Inconsistent error handling approaches across related functions
  • File organization that doesn't match project structure patterns

Dead Code (MEDIUM priority)

  • Unused imports and variables
  • Commented-out code blocks (delete — git has history)
  • Unreachable branches after early returns
  • Functions that are defined but never called

Process

  1. Run git diff --name-only HEAD~3 to identify recently changed files
  2. Read each changed file fully — understand context before changing anything
  3. Check CLAUDE.md for project-specific conventions
  4. Make one improvement at a time, smallest meaningful change first
  5. Run the full test suite after EVERY change
  6. If tests fail, revert immediately — your change broke behavior
  7. Commit each improvement separately with refactor: prefix

Read the full file on GitHub · 91 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. yesterday First seen · 91 lines · 13 tokens per session scan A f005646c7577

Subscribe to this mod's changes

code-simplifier is an agent published in the GitHub repository sefaertunc/Worclaude (4 stars, last pushed 22d ago), licensed MIT. It adds 13 tokens to every session and 846 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.

Related

Other agents, from other repositories

context

You are the Context agent. Your job is memory and context-window management: decide what to keep, compact, or recall so the working context stays high-signal and within budget.

WrongStack/WrongStack · 0 tokens

Writing Reviewer

Reviews academic prose for clarity, argument structure, and voice consistency.

chrisblattman/claudeblattman · 15 tokens

task-plan-architect

Uses the smartest available Claude model to expand one broad GitHub issue into a bounded set of implementation-ready subtasks, choosing the preferred LLM/model for each subtask and linking the resulting task tree in comments.

MercurieVV/ScalaSemantic · 47 tokens

ia-architecture-strategist

Analyzes code for architectural compliance, design patterns, naming conventions, and structural integrity. Use when adding services or evaluating refactors that span more than two modules, or when checking codebase-wide consistency.

iliaal/whetstone · 47 tokens

platform-engineer

Platform and forge specialist — CI/CD, GitHub/GitLab PR lifecycle, merge-conflicts, worktrees, integrations (Slack/Linear/ClickUp/MCP), loops/swarm, triage, llm-cost-advisor, cli-for-agents, herdr. Use when: CI failure, PR/MR lifecycle, worktrees, MCP setup, incidents, integrations, swarm/loops, CLI ergonomics.

ulises-jeremias/agent-toolkit · 88 tokens

cursor-rescue

Proactively use when Claude Code is stuck, wants a second implementation or diagnosis pass, needs a deeper root-cause investigation, or should hand a substantial coding task to Cursor.

zebbern/agent-collab · 38 tokens