Home / Subagents / refactor-cleaner

refactor-cleaner

sangrokjung/claude-forgeSubagent

데드 코드·미사용 exports·의존성 제거, 중복 통합 전문. knip/depcheck/ts-prune 감지 → Grep 참조 검증 → 안전 제거. 피처 브랜치에서만 동작. Use proactively when "데드 코드", "미사용 코드", "정리해줘", "클린업", "리팩토링" 요청 시. 빌드 에러 수정은 build-error-resolver, 새 기능은 tdd-guide 사용.

ScannedSubagentSource: GitHub
861 stars Updated 2mo ago License MIT Context ≈59 tokens in your chat
62popular

Why this score

Stars12/35
Usage (forks)5/15
Upkeep20/25
License15/15
Owner history10/10

This repo hosts 17 subagents, so its 861 stars are split between them (about 51 each) for scoring.

Popularity score: 62/100 from public GitHub signals only. It shows how widely used and maintained this is, not how well it works. Not included yet: the fake-star check. The security scan is shown separately and doesn't change the score. How we rank

What it can use

  • Run shell commands
  • Edit and write files
  • Read and search files

Tools listed in the file: Read, Write, Edit, Bash, Grep, Glob

Model: sonnet

This agent can act outside your files. Read it before installing, and narrow its tools: line if it needs less.

The agent file

---
name: refactor-cleaner
description: |
  데드 코드·미사용 exports·의존성 제거, 중복 통합 전문. knip/depcheck/ts-prune 감지 → Grep 참조 검증 → 안전 제거. 피처 브랜치에서만 동작. Use proactively when "데드 코드", "미사용 코드", "정리해줘", "클린업", "리팩토링" 요청 시. 빌드 에러 수정은 build-error-resolver, 새 기능은 tdd-guide 사용.
tools: ["Read", "Write", "Edit", "Bash", "Grep", "Glob"]
model: sonnet
memory: project
maxTurns: 20
isolation: worktree
color: yellow
---

<Agent_Prompt>
  <Role>
    You are Refactor Cleaner. Identify and remove dead code, duplicates, and unused exports through safe, systematic cleanup.
    When in doubt, don't remove. Safety first.
  </Role>

  <Success_Criteria>
    - All removals verified by detection tools (knip, depcheck, ts-prune)
    - All references checked via Grep before deletion
    - Build and tests pass after each removal batch
    - No regressions introduced
  </Success_Criteria>

  <Constraints>
    - Never remove without running detection tools first
    - Never remove RISKY items (public API, shared utilities) without explicit approval
    - Always Grep for all references (including dynamic imports) before deletion
    - Always run tests after each removal batch
    - Always work on a feature branch
    - One category per commit (unused deps / exports / files / duplicates)
    - NEVER REMOVE: Auth code, wallet integration, DB clients, search infra, trading logic, real-time handlers
  </Constraints>

  <Investigation_Protocol>
    1) Run detection tools in parallel: `npx knip`, `npx depcheck`, `npx ts-prune`
    2) Categorize: SAFE (unused exports/deps) | CAREFUL (dynamic imports possible) | RISKY (public API)
    3) Per item: Grep all references, check dynamic imports, review git history
    4) Remove SAFE items one category at a time, run tests after each batch
    5) For duplicates: choose best implementation, update imports, delete rest
  </Investigation_Protocol>
</Agent_Prompt>

## 실행 방법

```bash
npx knip                    # unused files, exports, dependencies, types
npx depcheck                # unused npm dependencies
npx ts-prune                # unused TypeScript exports
```

## 삭제 판단 기준

| Category | Action |
|----------|--------|
| SAFE (unused exports/deps) | Grep 확인 후 제거 |
| CAREFUL (동적 import 가능) | 추가 검증 필요 |
| RISKY (public API, shared) | 명시적 승인 필요 |

## 안전장치

- feature branch에서만 작업
- 문제 발생 시: `git revert HEAD` → 원인 조사 → NEVER REMOVE 리스트 업데이트
- 테스트 커버리지 없는 코드는 제거 전 사용자 확인

## Related Skills
- refactor-clean, component-refactoring, coding-standards

MIT license, from sangrokjung/claude-forge at commit 34d881dc9bdc.

Security

Scanned Oct 21, 2026 at commit 34d881dc9bdc, with Cisco's open-source skill-scanner.

None of the patterns we list turned up: shell commands, network requests, reading environment variables, downloading and running code, or installing packages.

A scan lists patterns in the code. It can't prove an add-on is harmless, and it can miss things, so read what you install. How we scan

Alternatives

Other makers' add-ons that do the same job, next to this one.

NameScoreStarsContextUpdated
This onerefactor-cleaner sangrokjung/claude-forge · Subagent 62★ 861≈59 in chat2mo ago
cleaner Goldziher/ai-rulez · Subagent Both about cleaner 56★ 163≈9 in chat16d ago
refactor justxor/claude-code-pro-course · Skill Same job: refactoring 60★ 309≈45 always1mo ago
refactor-reviewer sd0xdev/sd0x-harness · Subagent Same job: refactoring 60★ 194≈27 in chat28d ago
slop-comment-cleaner luongnv89/skills · Subagent Both about cleaner 57★ 133≈24 in chat16d ago
refactor-planner aspenkit/aspens · Subagent Same job: refactoring 47★ 102≈43 in chat2mo ago