refactoring

refactoring is a skill for Claude Code, Codex from Insajin/autopus-adk. It costs 20 tokens per session (733 once invoked), scanned A, original, MIT.

A set of techniques for improving code structure while keeping its existing behavior unchanged. Refactoring means reorganizing code without intentionally changing what it does.

In plain words
What is it for?
Use it to split large functions, replace rigid conditionals, introduce interfaces, rename code across a project, and gradually modernize legacy systems.
Why use it?
It helps reduce complicated or repetitive code and makes future changes safer. Tests are used to detect accidental behavior changes.

Skill for Claude CodeCodex

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

Good fit Use it to split large functions, replace rigid conditionals, introduce interfaces, rename code across a project, and gradually modernize legacy systems.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/insajin/autopus-adk/refactoring
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 Insajin/autopus-adk --skill refactoring
Clone the repo
git clone --depth 1 https://github.com/Insajin/autopus-adk

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 refactoring

README.md
[![agentmods](https://agentmods.dev/badge/skills/insajin/autopus-adk/refactoring/github.svg)](https://agentmods.dev/skills/insajin/autopus-adk/refactoring)
Your own site
<a href="https://agentmods.dev/skills/insajin/autopus-adk/refactoring"><img src="https://agentmods.dev/badge/skills/insajin/autopus-adk/refactoring/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 refactoring

Your own site · 80×15
<a href="https://agentmods.dev/skills/insajin/autopus-adk/refactoring"><img src="https://agentmods.dev/badge/skills/insajin/autopus-adk/refactoring.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 20 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 733 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00020 $0.00733
Opus 5 $0.00010 $0.00367
Sonnet 5 $0.00004 $0.00147
Haiku 4.5 $0.00002 $0.00073

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

Security

Grade A, and why

refactoring 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 5d 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.

.omp/skills/refactoring/SKILL.md · 110 lines

What it actually says

Refactoring Skill

기존 동작을 보존하면서 코드 구조를 개선하는 스킬입니다.

핵심 원칙

  1. 테스트 먼저: 리팩토링 전 기존 동작을 테스트로 보호
  2. 작은 단계: 한 번에 하나의 변환만 적용
  3. 행동 보존: 외부 동작 변경 금지
  4. 기능 변경 분리: 리팩토링 커밋과 기능 변경 커밋 분리

안전한 리팩토링 패턴

Extract Function

// Before: 긴 함수
func processOrder(order *Order) error {
    // 검증 로직 20줄
    // 계산 로직 15줄
    // 저장 로직 10줄
}

// After: 책임 분리
func processOrder(order *Order) error {
    if err := validateOrder(order); err != nil {
        return err
    }
    total := calculateTotal(order)
    return saveOrder(order, total)
}

Extract Interface

// Before: 구체 타입에 의존
func SendEmail(client *SMTPClient, msg string) { ... }

// After: 인터페이스로 추상화
type EmailSender interface {
    Send(msg string) error
}
func SendEmail(sender EmailSender, msg string) { ... }

Replace Conditional with Polymorphism

// Before: switch/if 분기
func price(t string) int {
    switch t {
    case "basic": return 100
    case "pro":   return 200
    }
}

// After: 인터페이스 다형성
type Plan interface {
    Price() int
}

Rename (전체 프로젝트)

# 호출자 확인 후 변경
grep -r "oldName" --include="*.go"
# IDE/도구 활용 권장 (gopls rename)

레거시 현대화 전략

Strangler Fig Pattern

  1. 새 구현체를 기존 시스템 옆에 배치
  2. 트래픽을 점진적으로 새 구현체로 이전
  3. 완전 이전 후 구 구현체 제거

Branch by Abstraction

  1. 변경 대상에 인터페이스 추출
  2. 기존 구현체를 인터페이스 구현으로 래핑
  3. 새 구현체 작성
  4. 의존성 주입으로 교체

데드코드 제거

확인 절차:

# 사용되지 않는 함수 탐지
go vet ./...
# 호출자 검색
grep -r "functionName" --include="*.go" | grep -v "_test.go"

제거 원칙:

  • 호출자 0개 확인 후 제거
  • 주석 처리 대신 완전 삭제 (git 히스토리에 보존됨)
  • // removed 주석 남기지 않기

리팩토링 안전 체크리스트

  • 기존 테스트 모두 통과
  • 특성 테스트 추가 (기존 동작 보호)
  • 각 단계 후 테스트 실행
  • 리팩토링과 기능 변경 커밋 분리
  • 변경 전후 동작 동일 확인
  • fan_in >= 3 함수에 @AX:ANCHOR 태그
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. 5d ago First seen · 110 lines · 20 tokens per session scan A cf095b0a9227

Subscribe to this mod's changes

refactoring is a skill published in the GitHub repository Insajin/autopus-adk (111 stars, last pushed yesterday), licensed MIT. It adds 20 tokens to every session and 733 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-09-03.