RE

refactoring

Perform safe structural refactoring with step-by-step validation and dependency audits.

Install

mkdir -p .claude/skills/refactoring-tettuan && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/16477" && unzip -o skill.zip -d .claude/skills/refactoring-tettuan && rm skill.zip

Installs to .claude/skills/refactoring-tettuan

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Use when refactoring code, reorganizing modules, renaming types, deleting old paths, or migrating architecture. MUST read before any structural code change. Prevents incomplete refactoring that silently breaks downstream consumers.
231 chars✓ has a “when” trigger
Advanced

Key capabilities

  • Audit existing code for deletion targets and consumers
  • Trace entry, filter, runner, and handler paths for gateways
  • Design verification methods for new paths
  • Execute refactoring in atomic commits
  • Verify the absence of old paths and documentation references

How it works

This skill guides a multi-phase refactoring process, starting with auditing deletion targets and consumers, designing verification, executing changes in atomic commits, and finally verifying the complete removal of old paths and documentation references.

Inputs & outputs

You give it
Codebase with structural changes planned for refactoring, module reorganization, or migration
You get back
Audited list of deletion targets, verification design, executed refactoring in atomic commits, and confirmation of old path removal

When to use refactoring

  • Rename modules safely
  • Migrate legacy paths
  • Remove dead code after migration

About this skill

新パスが旧パスの全契約を継承したことを証明してから削除する。証明できなければ削除しない。

過去の事故

事故原因
ハンドラがthrowスタブ化旧パス削除時に新パス未実装
キャッシュが古いバージョンを返す--reload 未実行
importエラーアダプタ未作成でV1 export削除
設定互換性喪失移行猶予なくレガシーエイリアス削除

Phase 1: 棚卸し

  1. 削除対象の一覧 — 何を削除するか、誰が消費しているか、どのパラメータを受けるかを列挙する
  2. ゲートウェイ監査 — エントリ→フィルタ→ランナー→ハンドラの経路を追跡し、新パスが全パラメータを通すことを確認する
  3. 消費者監査grep で全import/呼び出し箇所を特定し、移行先を決める。移行先のない消費者がいれば削除不可

Phase 2: 契約と検証設計

  1. Before/After表 — 旧パスの各動作に対し、新パスでの実現方法を記述する。After列が空なら未完了
  2. 検証設計 — パス特性に応じ、直線→コードレビュー / 分岐・フィルタ→自動テスト / 外部依存→E2Eで証明する

Phase 3: 実行

1コミット=1関心事(新パス追加→消費者移行→旧パス削除→docs更新)。各コミットでCI通過必須。デッドコードは同一PRで削除する。

Phase 4: 検証

deno cache --reload <entry-point>                          # キャッシュクリア
grep -r "OldName" --include='*.ts' | grep -v test          # 消費者の残存確認(空であること)
grep -r "OldName" --include='*.md'                         # docs内の参照確認(空であること)

アンチパターン

BadGood
旧パス削除→新パスは後で新パス完成→旧パス削除
「誰も使ってない」と推測grepで消費者を証拠確認
リファクタと機能追加を同一PRbisect可能に分離

関連: /fix-checklist(根本原因分析)、/docs-consistency(Phase 4のdocs更新)

When not to use it

  • Refactoring and feature addition in the same pull request
  • Deleting old paths before new paths are fully implemented
  • Assuming no one is using a piece of code without verification

Limitations

  • MUST read before any structural code change.
  • Prevents incomplete refactoring that silently breaks downstream consumers.
  • Each commit must pass CI.

How it compares

This skill enforces a structured, auditable, and verifiable refactoring workflow, preventing incomplete changes and silent breakage, unlike ad-hoc code modifications.

Compared to similar skills

refactoring side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
refactoring (this skill)06moReviewAdvanced
effective-go32310moNo flagsBeginner
solid-principles579moNo flagsIntermediate
typescript-review392moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

effective-go

openshift

Apply Go best practices, idioms, and conventions from golang.org/doc/effective_go. Use when writing, reviewing, or refactoring Go code to ensure idiomatic, clean, and efficient implementations.

323536

solid-principles

SmidigStorm

Enforce SOLID principles (Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion) in object-oriented design. Use when writing or reviewing classes and modules.

57236

typescript-review

metabase

Review TypeScript and JavaScript code changes for compliance with Metabase coding standards, style violations, and code quality issues. Use when reviewing pull requests or diffs containing TypeScript/JavaScript code.

39178

ast-grep

ast-grep

Guide for writing ast-grep rules to perform structural code search and analysis. Use when users need to search codebases using Abstract Syntax Tree (AST) patterns, find specific code structures, or perform complex code queries that go beyond simple text search. This skill should be used when users ask to search for code patterns, find specific language constructs, or locate code with particular structural characteristics.

17135

serena

massgen

This skill provides symbol-level code understanding and navigation using Language Server Protocol (LSP). Enables IDE-like capabilities for finding symbols, tracking references, and making precise code edits at the symbol level.

1597

typescript

lobehub

TypeScript code style and optimization guidelines. Use when writing TypeScript code (.ts, .tsx, .mts files), reviewing code quality, or implementing type-safe patterns. Triggers on TypeScript development, type safety questions, or code style discussions.

2877

Search skills

Search the agent skills registry