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

gitnexus-refactoring

Gitnexus Refactoringは、影響範囲と依存関係を把握することで、安全なリファクタリング計画を立て、システム改修におけるリスクを最小限に抑えながら効率的な改善を進めるSkill。

📜 元の英語説明(参考)

Plan safe refactors using blast radius and dependency mapping

🇯🇵 日本人クリエイター向け解説

一言でいうと

Gitnexus Refactoringは、影響範囲と依存関係を把握することで、安全なリファクタリング計画を立て、システム改修におけるリスクを最小限に抑えながら効率的な改善を進めるSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

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

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

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

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

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して gitnexus-refactoring.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → gitnexus-refactoring フォルダができる
  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
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

GitNexus を用いたリファクタリング

どのような時に使うか

  • 「この関数を安全にリネームする」
  • 「これをモジュールに抽出する」
  • 「このサービスを分割する」
  • 「これを新しいファイルに移動する」
  • コードのリネーム、抽出、分割、再構成を伴うあらゆるタスク

ワークフロー

1. gitnexus_impact({target: "X", direction: "upstream"})  → すべての依存関係をマップする
2. gitnexus_query({query: "X"})                            → X を含む実行フローを見つける
3. gitnexus_context({name: "X"})                           → すべての入出力参照を見る
4. 更新順序を計画する: インターフェース → 実装 → 呼び出し元 → テスト

「Index is stale」と表示された場合 → ターミナルで npx gitnexus analyze を実行してください。

チェックリスト

シンボルのリネーム

- [ ] gitnexus_rename({symbol_name: "oldName", new_name: "newName", dry_run: true}) — すべての編集をプレビューする
- [ ] グラフの編集 (信頼度高) と ast_search の編集 (注意深くレビュー) を確認する
- [ ] 問題なければ: gitnexus_rename({..., dry_run: false}) — 編集を適用する
- [ ] gitnexus_detect_changes() — 予期されたファイルのみが変更されたことを確認する
- [ ] 影響を受けるプロセスのテストを実行する

モジュールの抽出

- [ ] gitnexus_context({name: target}) — すべての入出力参照を見る
- [ ] gitnexus_impact({target, direction: "upstream"}) — すべての外部呼び出し元を見つける
- [ ] 新しいモジュールのインターフェースを定義する
- [ ] コードを抽出し、インポートを更新する
- [ ] gitnexus_detect_changes() — 影響を受ける範囲を確認する
- [ ] 影響を受けるプロセスのテストを実行する

関数/サービスの分割

- [ ] gitnexus_context({name: target}) — すべての呼び出し先を理解する
- [ ] 呼び出し先を責務ごとにグループ化する
- [ ] gitnexus_impact({target, direction: "upstream"}) — 更新する呼び出し元をマップする
- [ ] 新しい関数/サービスを作成する
- [ ] 呼び出し元を更新する
- [ ] gitnexus_detect_changes() — 影響を受ける範囲を確認する
- [ ] 影響を受けるプロセスのテストを実行する

ツール

gitnexus_rename — 自動マルチファイルリネーム:

gitnexus_rename({symbol_name: "validateUser", new_name: "authenticateUser", dry_run: true})
→ 8 ファイルにわたる 12 件の編集
→ 10 件のグラフ編集 (信頼度高)、2 件の ast_search 編集 (レビュー)
→ 変更: [{file_path, edits: [{line, old_text, new_text, confidence}]}]

gitnexus_impact — 最初にすべての依存関係をマップする:

gitnexus_impact({target: "validateUser", direction: "upstream"})
→ d=1: loginHandler, apiMiddleware, testUtils
→ 影響を受けるプロセス: LoginFlow, TokenRefresh

gitnexus_detect_changes — リファクタリング後の変更を確認する:

gitnexus_detect_changes({scope: "all"})
→ 変更: 8 ファイル、12 シンボル
→ 影響を受けるプロセス: LoginFlow, TokenRefresh
→ リスク: MEDIUM

gitnexus_cypher — カスタム参照クエリ:

MATCH (caller)-[:CodeRelation {type: 'CALLS'}]->(f:Function {name: "validateUser"})
RETURN caller.name, caller.filePath ORDER BY caller.filePath

リスクルール

リスク要因 軽減策
多数の呼び出し元 (>5) 自動更新のために gitnexus_rename を使用する
領域を跨ぐ参照 スコープを確認するために、後に detect_changes を使用する
文字列/動的な参照 それらを見つけるために gitnexus_query を使用する
外部/パブリック API 適切にバージョン管理し、非推奨にする

例: validateUserauthenticateUser にリネームする

1. gitnexus_rename({symbol_name: "validateUser", new_name: "authenticateUser", dry_run: true})
   → 12 件の編集: 10 件のグラフ (安全)、2 件の ast_search (レビュー)
   → ファイル: validator.ts, login.ts, middleware.ts, config.json...

2. ast_search の編集をレビューする (config.json: 動的な参照!)

3. gitnexus_rename({symbol_name: "validateUser", new_name: "authenticateUser", dry_run: false})
   → 8 ファイルにわたる 12 件の編集を適用しました

4. gitnexus_detect_changes({scope: "all"})
   → 影響: LoginFlow, TokenRefresh
   → リスク: MEDIUM — これらのフローのテストを実行する
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Refactoring with GitNexus

When to Use

  • "Rename this function safely"
  • "Extract this into a module"
  • "Split this service"
  • "Move this to a new file"
  • Any task involving renaming, extracting, splitting, or restructuring code

Workflow

1. gitnexus_impact({target: "X", direction: "upstream"})  → Map all dependents
2. gitnexus_query({query: "X"})                            → Find execution flows involving X
3. gitnexus_context({name: "X"})                           → See all incoming/outgoing refs
4. Plan update order: interfaces → implementations → callers → tests

If "Index is stale" → run npx gitnexus analyze in terminal.

Checklists

Rename Symbol

- [ ] gitnexus_rename({symbol_name: "oldName", new_name: "newName", dry_run: true}) — preview all edits
- [ ] Review graph edits (high confidence) and ast_search edits (review carefully)
- [ ] If satisfied: gitnexus_rename({..., dry_run: false}) — apply edits
- [ ] gitnexus_detect_changes() — verify only expected files changed
- [ ] Run tests for affected processes

Extract Module

- [ ] gitnexus_context({name: target}) — see all incoming/outgoing refs
- [ ] gitnexus_impact({target, direction: "upstream"}) — find all external callers
- [ ] Define new module interface
- [ ] Extract code, update imports
- [ ] gitnexus_detect_changes() — verify affected scope
- [ ] Run tests for affected processes

Split Function/Service

- [ ] gitnexus_context({name: target}) — understand all callees
- [ ] Group callees by responsibility
- [ ] gitnexus_impact({target, direction: "upstream"}) — map callers to update
- [ ] Create new functions/services
- [ ] Update callers
- [ ] gitnexus_detect_changes() — verify affected scope
- [ ] Run tests for affected processes

Tools

gitnexus_rename — automated multi-file rename:

gitnexus_rename({symbol_name: "validateUser", new_name: "authenticateUser", dry_run: true})
→ 12 edits across 8 files
→ 10 graph edits (high confidence), 2 ast_search edits (review)
→ Changes: [{file_path, edits: [{line, old_text, new_text, confidence}]}]

gitnexus_impact — map all dependents first:

gitnexus_impact({target: "validateUser", direction: "upstream"})
→ d=1: loginHandler, apiMiddleware, testUtils
→ Affected Processes: LoginFlow, TokenRefresh

gitnexus_detect_changes — verify your changes after refactoring:

gitnexus_detect_changes({scope: "all"})
→ Changed: 8 files, 12 symbols
→ Affected processes: LoginFlow, TokenRefresh
→ Risk: MEDIUM

gitnexus_cypher — custom reference queries:

MATCH (caller)-[:CodeRelation {type: 'CALLS'}]->(f:Function {name: "validateUser"})
RETURN caller.name, caller.filePath ORDER BY caller.filePath

Risk Rules

Risk Factor Mitigation
Many callers (>5) Use gitnexus_rename for automated updates
Cross-area refs Use detect_changes after to verify scope
String/dynamic refs gitnexus_query to find them
External/public API Version and deprecate properly

Example: Rename validateUser to authenticateUser

1. gitnexus_rename({symbol_name: "validateUser", new_name: "authenticateUser", dry_run: true})
   → 12 edits: 10 graph (safe), 2 ast_search (review)
   → Files: validator.ts, login.ts, middleware.ts, config.json...

2. Review ast_search edits (config.json: dynamic reference!)

3. gitnexus_rename({symbol_name: "validateUser", new_name: "authenticateUser", dry_run: false})
   → Applied 12 edits across 8 files

4. gitnexus_detect_changes({scope: "all"})
   → Affected: LoginFlow, TokenRefresh
   → Risk: MEDIUM — run tests for these flows