Claude Code Plugins

Community-maintained marketplace

Feedback

振る舞いを変えずにコード構造を改善する際に使用。

Install Skill

1Download skill
2Enable skills in Claude

Open claude.ai/settings/capabilities and find the "Skills" section

3Upload to Claude

Click "Upload skill" and select the downloaded ZIP file

Note: Please verify skill by going through its instructions before using it.

SKILL.md

name refactoring
description 振る舞いを変えずにコード構造を改善する際に使用。

Refactoring

🚨 鉄則

テストがある状態で始める。振る舞いは変えない。

⚠️ 進め方

1. テストが通ることを確認
2. 小さな変更
3. テスト実行
4. 繰り返し

コードスメル

長いメソッド → 抽出

// ❌
function processOrder() { /* 100行 */ }

// ✅
function processOrder() {
  validate();
  calculate();
  save();
}

条件分岐 → ポリモーフィズム

// ❌
if (type === 'a') { ... } else if (type === 'b') { ... }

// ✅
interface Handler { handle(): void }
class HandlerA implements Handler {}
class HandlerB implements Handler {}

マジックナンバー → 定数

// ❌
if (speed > 9.8)

// ✅
const GRAVITY = 9.8;
if (speed > GRAVITY)

🛑 しない場合

  • デッドライン直前
  • テストがない
  • 動作を理解していない