jpskill.com
🛠️ 開発・MCP コミュニティ

refactor-legacy-code

Modernize and improve legacy codebases while maintaining functionality. Use when you need to refactor old code, reduce technical debt, modernize deprecated patterns, or improve code maintainability without breaking existing behavior.

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o refactor-legacy-code.zip https://jpskill.com/download/21510.zip && unzip -o refactor-legacy-code.zip && rm refactor-legacy-code.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/21510.zip -OutFile "$d\refactor-legacy-code.zip"; Expand-Archive "$d\refactor-legacy-code.zip" -DestinationPath $d -Force; ri "$d\refactor-legacy-code.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して refactor-legacy-code.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → refactor-legacy-code フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
9
📖 Claude が読む原文 SKILL.md(中身を展開)

この本文は AI(Claude)が読むための原文(英語または中国語)です。日本語訳は順次追加中。

Refactor Legacy Code

Table of Contents

Overview

This skill helps you systematically refactor legacy code to improve maintainability, readability, and performance while preserving existing functionality. It follows industry best practices for safe refactoring with comprehensive testing.

When to Use

  • Modernizing outdated code patterns or deprecated APIs
  • Reducing technical debt in existing codebases
  • Improving code readability and maintainability
  • Extracting reusable components from monolithic code
  • Upgrading to newer language features or frameworks
  • Preparing code for new feature development

Quick Start

First, analyze the legacy code to understand:

# Review the codebase structure
tree -L 3 -I 'node_modules|dist|build'

# Check for outdated dependencies
npm outdated  # or pip list --outdated, composer outdated, etc.

# Identify code complexity hotspots
# Use tools like:
# - SonarQube for code smells
# - eslint for JavaScript
# - pylint for Python
# - RuboCop for Ruby

Reference Guides

Detailed implementations in the references/ directory:

Guide Contents
Code Assessment Code Assessment
Establish Safety Net Establish Safety Net
Incremental Refactoring Incremental Refactoring
Modernize Patterns Modernize Patterns
Reduce Dependencies Reduce Dependencies, Documentation
Complete Refactoring Example Complete Refactoring Example
Benefits Achieved Benefits Achieved

Best Practices

✅ DO

  • Refactor incrementally: Small, testable changes
  • Run tests frequently: After each refactoring step
  • Commit often: Create logical, atomic commits
  • Keep existing tests passing: Don't break functionality
  • Use IDE refactoring tools: Safer than manual edits
  • Review code coverage: Ensure tests cover refactored code
  • Document decisions: Why, not just what
  • Seek peer review: Fresh eyes catch issues

❌ DON'T

  • Mix refactoring with new features: Separate concerns
  • Refactor without tests: Recipe for breaking changes
  • Change behavior: Refactoring should preserve functionality
  • Refactor large chunks: Increases risk and review difficulty
  • Ignore code smells: Address them systematically
  • Skip documentation: Future maintainers need context

同梱ファイル

※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。