refactor-engineer

refactor-engineer is a skill for Claude Code, Codex from lfyxhappy/lfcode. It costs 52 tokens per session (325 once invoked), scanned A, original, MIT.

A code-refactoring guide for reorganising software while keeping its observable behaviour the same. Refactoring changes structure, such as moving or simplifying code, without intentionally changing what users or callers experience.

In plain words
What is it for?
Use it to extract or consolidate code, rename or move symbols, simplify architecture, and remove duplication. It keeps the change narrow and reviews the final differences for accidental behaviour changes.
Why use it?
It reduces the risk of breaking callers, public interfaces, stored data, error behaviour, or performance during cleanup. It maps references and checks the result with focused tests and other relevant checks.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to extract or consolidate code, rename or move symbols, simplify architecture, and remove duplication. It keeps the change narrow and reviews the final differences for accidental behaviour changes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/lfyxhappy/lfcode/refactor-engineer
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.

Any agent
npx skills add lfyxhappy/lfcode --skill refactor-engineer
Clone the repo
git clone --depth 1 https://github.com/lfyxhappy/lfcode

Made for: Claude Code, Codex.

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 refactor-engineer

README.md
[![agentmods](https://agentmods.dev/badge/skills/lfyxhappy/lfcode/refactor-engineer.svg)](https://agentmods.dev/skills/lfyxhappy/lfcode/refactor-engineer)
Your own site
<a href="https://agentmods.dev/skills/lfyxhappy/lfcode/refactor-engineer"><img src="https://agentmods.dev/badge/skills/lfyxhappy/lfcode/refactor-engineer.svg" alt="Measured on agentmods" height="20"></a>
Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 325 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.00052 $0.00325
Opus 5 $0.00026 $0.00162
Sonnet 5 $0.00010 $0.00065
Haiku 4.5 $0.00005 $0.00032

Measured 2d ago against content hash 9aa49da0e0fd, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

refactor-engineer 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 2d 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.

packages/lfcode/src/skill/lfcode/.bundle/refactor-engineer/SKILL.md · 28 lines

What it actually says

Refactor Engineer

Improve structure while preserving observable behavior unless a behavior change is explicitly part of the request.

Workflow

  1. Read the applicable instructions, current diffs, implementation, callers, public exports, persistence or wire formats, and nearby tests.
  2. Define the invariant to preserve and the exact files in scope. Search all references before renaming, moving, or deleting a symbol.
  3. Make one coherent, minimal refactor at a time. Reuse existing abstractions and local style; do not extract single-use helpers without a real boundary.
  4. Run focused tests after each meaningful step. Add or adjust regression coverage only when the refactor exposes a previously untested contract.
  5. Run package typecheck, lint, build, or runtime checks in proportion to the affected boundary.
  6. Review the diff for accidental API, data, error-message, ordering, or performance changes.

Boundaries

  • Do not mix unrelated formatting, dependency, product, or UI changes into a refactor.
  • Treat migrations and public contract changes as separate work unless explicitly requested, with compatibility and recovery plans.
  • Never use a passing typecheck as proof that runtime behavior is unchanged.

Completion check

Summarize the preserved invariants, moved or removed symbols, tests run, and any behavior that remains unverified.

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. 2d ago First seen · 28 lines · 52 tokens per session scan A 9aa49da0e0fd

Subscribe to this mod's changes

refactor-engineer is a skill published in the GitHub repository lfyxhappy/lfcode (2 stars, last pushed 4d ago), licensed MIT. It adds 52 tokens to every session and 325 once invoked, about $0.0003 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-09-05.