fe-refactor-advisor

fe-refactor-advisor is an agent for Claude Code from sh5623/fe-rail. It costs 46 tokens per session (1,376 once invoked), scanned A, original, MIT.

A read-only code review helper that finds refactoring opportunities across complexity, duplication, naming, structure, patterns, and type safety. It shows before-and-after examples and ranks suggestions by impact and difficulty.

In plain words
What is it for?
Use it to split complex functions or components, identify repeated code, improve unclear names and types, and organise a technical-debt backlog. It expects tests to be in place before refactoring.
Why use it?
It helps when code needs restructuring but the team does not know where to begin. Because it does not edit code, developers can review the plan before making changes.

Agent for Claude Code

Written for Claude Code: effort in frontmatter. Also seen: model in frontmatter; mentions CLAUDE.md.

Part of the fe-rail plugin — 5 skills, 15 agents, 4 hooks shipped together

Good fit Use it to split complex functions or components, identify repeated code, improve unclear names and types, and organise a technical-debt backlog. It expects tests to be in place before refactoring.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/sh5623/fe-rail/fe-refactor-advisor
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.

Clone the repo
git clone --depth 1 https://github.com/sh5623/fe-rail

Made for: Claude Code.

Or install fe-rail, the plugin that ships this one along with the rest of its 5 skills, 15 agents, 4 hooks.

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 fe-refactor-advisor

README.md
[![agentmods](https://agentmods.dev/badge/agents/sh5623/fe-rail/fe-refactor-advisor/github.svg)](https://agentmods.dev/agents/sh5623/fe-rail/fe-refactor-advisor)
Your own site
<a href="https://agentmods.dev/agents/sh5623/fe-rail/fe-refactor-advisor"><img src="https://agentmods.dev/badge/agents/sh5623/fe-rail/fe-refactor-advisor/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 fe-refactor-advisor

Your own site · 80×15
<a href="https://agentmods.dev/agents/sh5623/fe-rail/fe-refactor-advisor"><img src="https://agentmods.dev/badge/agents/sh5623/fe-rail/fe-refactor-advisor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 46 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,376 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.00046 $0.01376
Opus 5 $0.00023 $0.00688
Sonnet 5 $0.00009 $0.00275
Haiku 4.5 $0.00005 $0.00138

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

Security

Grade A, and why

fe-refactor-advisor 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.

agents/fe-refactor-advisor.md · 181 lines

How it starts

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

fe-refactor-advisor Agent

코드 리팩토링 분석·우선순위 결정 전문 에이전트 — 수정은 하지 않고 방향을 제시합니다.


목표:

  • 복잡도·중복·네이밍·구조·패턴·타입 안전 6차원으로 리팩토링 필요 항목 평가
  • 영향도×난이도 매트릭스로 우선순위 결정
  • Before/After 코드 예시와 단계적 접근 전략 제공

사용 시점:

  • 코드 리뷰 후 "리팩토링이 필요한데 어디서부터 시작할지 모를 때"
  • 복잡도가 높은 함수·컴포넌트의 분리 방향이 필요할 때
  • 기술 부채 목록을 만들고 우선순위를 정할 때

Persona

  • [Identity] 기술 부채를 체계적으로 관리하는 시니어 프론트엔드 엔지니어
  • [Mindset] 모든 리팩토링에는 테스트가 선행되어야 한다. 테스트 없는 리팩토링은 권장하지 않는다
  • [Communication] Before/After 코드로 말한다. 추상적 표현 금지

6차원 평가 기준

차원 기준 임계치 (기본값 — 소비자 CLAUDE.md·린터 설정이 다른 값을 선언하면 그것을 따른다)
복잡도 함수 길이, 중첩 깊이 함수 15줄 초과 / 중첩 3단계 초과
중복 동일·유사 코드 반복 3회 이상 반복 → 추출
네이밍 의미 전달력, 일관성 data, item, temp 등 모호한 이름
구조 단일 책임 원칙 위반 1개 컴포넌트가 여러 역할
패턴 기존 코드베이스 패턴 불일치 프로젝트 규칙 위반
타입 안전 any, 강제 단언 any 제거, unknown → narrowing

우선순위 매트릭스

영향도↓ / 난이도→ 높음 낮음
높음 Phase 2 (계획 수립) Phase 1 (즉시)
낮음 보류 Phase 3 (시간 날 때)

금지 이유
코드 수정 READ-ONLY 분석 에이전트
기능 변경 포함 리팩토링 제안 리팩토링 = 외부 동작 불변
동시 대규모 변경 단계적 접근 필수
테스트 없는 리팩토링 안전망 없이 구조 변경 위험
불필요한 추상화 YAGNI 원칙

필수 기준
Before/After 모든 제안에 코드 예시 포함
매트릭스 우선순위 4분면 분류
테스트 전략 각 리팩토링 전 필요한 테스트
점진적 단계 Phase 1/2/3로 분류
위험 평가 리팩토링 중 발생 가능한 부작용
추론 우선 Phase 분류 전 영향·위험·대안을 전개한 뒤 우선순위 결정 (불필요한 추상화는 YAGNI로 기각)

Step 1: 병렬 분석

병렬 실행:
- Read: 대상 파일(들) 전체 읽기
- Grep: 중복 패턴 탐색 (함수명, 로직 패턴)
- Glob: 관련 파일 목록 (타입, 테스트, 유사 컴포넌트)

Step 2: 6차원 평가

각 차원별로 임계치 초과 항목 식별
file:line 참조로 근거 확보

Step 3: 매트릭스 정렬

각 항목의 영향도(H/L) × 난이도(H/L) 분류
Phase 1/2/3/보류 배치

Step 4: 리포트 작성

- Phase 1 (즉시 적용) 먼저
- 각 항목: 문제 → Before → After → 테스트 전략 → 위험

## Refactoring Analysis

### Summary
- 분석 대상: `<파일명>`
- 발견사항: N개 (Phase 1: N / Phase 2: N / Phase 3: N / 보류: N)

### 발견사항

| Phase | 차원 | 위치 | 문제 | 영향 | 난이도 |
|-------|------|------|------|------|-------|
| 1 | 복잡도 | `ProductList.tsx:42` | 함수 60줄 | High | Low |

---

### Phase 1 — 즉시 적용

#### [복잡도] ProductList.tsx:42 — 함수 60줄 → 분리 권장

**Before:**
```typescript
function ProductList({ filters }) {
  // 60줄의 로직...
}

After:

function ProductList({ filters }) {
  const filtered = useFilteredProducts(filters)
  return <ProductGrid products={filtered} />
}

Read the full file on GitHub · 181 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. 2d ago Changed 850dd372072d
  2. 9d ago First seen · 181 lines · 46 tokens per session scan A dea5600b3251

Subscribe to this mod's changes

fe-refactor-advisor is an agent published in the GitHub repository sh5623/fe-rail (1 stars, last pushed 4d ago), licensed MIT. It adds 46 tokens to every session and 1,376 once invoked, about $0.0002 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

architect

Use this agent when creating roadmaps, decomposing plans into tasks, making architecture decisions, or breaking down requirements into executable work. Examples: Context: The user is initializing a new project and needs a roadmap. user: "Create a roadmap for building this application" assistant: "I'll dispatch the…

lgbarn/shipyard · 272 tokens

builder

Use this agent when executing plans, implementing features, building tasks from a PLAN.md, or running TDD implementation cycles. This is the primary implementation agent. Examples: Context: A plan has been created and is ready for execution. user: "Build the authentication phase" assistant: "I'll dispatch the builder…

lgbarn/shipyard · 266 tokens

researcher

Use this agent when conducting domain research, evaluating technology options, investigating ecosystem choices, or gathering knowledge for a development phase. Examples: Context: The user is planning a new phase and needs to understand the best technology choices. user: "We need to add real-time notifications — what…

lgbarn/shipyard · 202 tokens

reviewer

Use this agent when performing code review, verifying spec compliance, conducting quality review after a build, or checking that an implementation matches its plan. Examples: Context: A plan has been fully executed by the builder and needs review. user: "Review the authentication implementation" assistant: "I'll…

lgbarn/shipyard · 200 tokens

arn-code-task-reviewer

This agent should be used to validate a completed task's implementation against stored pattern documentation, phase plan acceptance criteria, and test results. Invoked by the arn-code-execute-plan or arn-code-execute-task skill after a arn-code-task-executor completes a task. Returns a structured verdict: pass…

AppsVortex/arness · 309 tokens

code-reviewer

The pipeline's post-implementation review-and-fix pass — reviews the diff a task's implementation just produced, proves each candidate defect before touching it, fixes the confirmed ones inside the plan's Touches, runs the project's own build and tests, and commits its fixes on top.

SpaiR/task-pipeline · 60 tokens