本文へスキップ
Skillpedia
一般的なプログラミング33k · #9141

refactor-safely

できること

このスキルは、code-review-graphツールを使い、安全にコードをリファクタリングするようAIを導きます。ほかの部分を壊さずに、名前を変えたり構造を組み直したりしたい開発者向けです。

使う場面

  • ✓コードベース全体で、関数やクラスの名前を変えたいとき。
  • ✓何からも参照されていない不要なコードを見つける必要があるとき。
  • ✓大きな関数を分割する計画で、それに依存しているコードを確認したいとき。

スキルのリンク

https://github.com/tirth8205/code-review-graph/blob/staging/skills/refactor-safely/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/tirth8205/code-review-graph/blob/staging/skills/refactor-safely/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“calculateTotalという関数を、どこでもcomputeOrderTotalに名前変更してください。ただし、まず何が変わるかを見せてください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントは、グラフに名前変更のプレビューを求め、編集の一覧を見せてから、確認を得た後にだけ変更を適用します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Refactor Safely

Plan a refactor from the dependency graph and apply renames from a preview.

Steps

  1. Call refactor_tool with mode="suggest" for refactoring candidates, or mode="dead_code" for unreferenced code.
  2. For a rename, call refactor_tool with mode="rename", old_name and new_name. Check the returned edit list before applying.
  3. Call apply_refactor_tool with the returned refactor_id to apply the rename.
  4. Before a large refactor, call get_impact_radius_tool and get_affected_flows_tool to see the dependents and critical paths involved.
  5. Call find_large_functions_tool to find functions worth splitting.
  6. After the change, call detect_changes_tool to confirm the impact matches the plan.

Token Efficiency Rules

  • Call get_minimal_context_tool(task="<your task>") before any other graph tool.
  • Pass detail_level="minimal" wherever a tool accepts it. Use "standard" only when minimal is not enough.
  • Prefer a targeted query_graph_tool call over a broad listing call.
  • Budget: about five tool calls and 800 tokens of graph output per task.
  • Read the implementation and its tests before changing code. The graph narrows scope; it does not replace the source.
よくある質問

プレビューなしで変更を適用しますか?

いいえ。名前を変える前に、返された編集の一覧を確認するよう、このスキルは説明しています。

使われていないコードを見つけられますか?

はい。デッドコードのモードが、参照されていないコードを一覧にします。

その後に何を確認しますか?

影響が計画どおりかを確かめるため、変更検出の手順を実行するよう勧めています。

詳細

作者による元の説明

Plan and execute safe refactoring using dependency analysis

repo: tirth8205/code-review-graph

人気

GitHubのスター
33k
ランキング
#9141
ライセンス
MIT
更新日
2026/10/29

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル