Skip to content
find-refactoring logo

リファクタリング候補検出コマンド

find-refactoring

コードベースからリファクタリング候補を検出し、優先度付きでGitHub Issueを作成します

SKILL.md

Full skill instructions

リファクタリング候補検出コマンド

コードベースを分析し、リファクタリングが必要な箇所を検出してGitHub Issueを作成します。


入力

$ARGUMENTS(対象パス、オプション)

例:

  • /​find-refactoring src/ - src配下を分析
  • /​find-refactoring --dry-run - Issue作成せずレポートのみ
  • /​find-refactoring src/ --min-priority=high - 高優先度のみ

前提条件

詳細: refactoring-detection skill を参照

ツール必須/任意フォールバック
ast-grep (sg)必須エラー終了
jscpd任意重複検出スキップ

全体フロー

Phase名称内容
0入力解析対象パス・オプション解析
0.3言語検出プロジェクト言語の自動判定
0.5ツール確認必須ツールの存在確認
0.7既存Issue確認重複Issue防止チェック
1静的分析コード品質ルール違反の検出
2パターン分析コードスメル・重複の検出
3優先度判定優先度付与、粒度チェック
3.5ユーザー確認approval-gate skill
4Issue作成GitHub Issue作成(--dry-run時スキップ)

Phase規約: workflow-phase-convention skill を参照


サーキットブレーカー

条件アクション
必須ツール不在エラー終了、インストール手順を表示
検出件数0件「問題なし」を報告して終了
検出件数30件超上位15件のみ表示、--min-priority=highを提案
Issue作成失敗失敗分をレポート、成功分は継続

Phase 0.3-0.7: 事前準備

言語検出

LANG=$(detect_language)  # typescript / rust / go / python

ツール確認

check_required_tools || exit 1
check_optional_tools

既存Issue確認

EXISTING_ISSUES=$(get_existing_refactoring_issues)

実装詳細: refactoring-detection skill を参照


Phase 1-2: 検出実行

検出ルール

カテゴリルール優先度
サイズ500行超過ファイルHigh
サイズ80行超過関数High
サイズ6引数超過関数Medium
型安全any型使用High
型安全``ts-ignore skill使用Critical
エラー処理空catchブロックHigh
品質console.log残存Medium
品質重複コード(10行以上)Medium

言語別追加ルール

言語ルール優先度
Rusttodo!/unimplemented!残存High
Rustunwrap()多用(5箇所超/ファイル)Medium

検出パターン詳細: refactoring-detection skill を参照


Phase 3: 優先度・粒度判定

優先度基準

優先度対応期限目安
Critical即時
High1週間
Medium2週間
Low余裕時

Issue粒度チェック

実装タスクは200行以下を対象

推定作業行数アクション
200行以下単一Issueとして作成
200行超「要分割」注記、/​decompose-issueリンク付与

工数算出ロジック: refactoring-detection skill を参照


Phase 3.5: ユーザー確認

共通仕様: approval-gate skill を参照

## 検出されたリファクタリング候補

### サマリー
| 優先度 | 件数 |
|--------|------|
| Critical | {n} |
| High | {n} |
| Medium | {n} |

### 詳細(上位15件)

| # | ファイル | 問題 | 優先度 | 推定工数 | 備考 |
|---|---------|------|--------|---------|------|
| 1 | `src/​foo.ts` | 723行(超過) | High | 1h | |
| 2 | `src/​bar.ts` | any型 5箇所 | High | 25m | |
| 3 | `src/​big.ts` | 1200行 | High | 3h | **要分割** |

### スキップ(既存Issue)
- `src/​old.ts`: #45

---
**選択肢**:

1. 全件 → 全件Issue作成
2. High以上 → High以上のみ作成
3. 選択 → 指定番号のみ(例: `3 1,2,5`)
4. 終了 → 作成せず終了

> 番号を選択してください(1-4):

Phase 4: Issue作成

ラベル事前作成

ensure_labels() {
    for label in refactoring automated priority/​{critical,high,medium,low}; do
        gh label create "$label" --force 2>/​dev/​null || true
    done
}

Issueテンプレート

gh issue create \
  --title "refactor: ${TITLE}" \
  --body "## 概要
${PROBLEM}

## 対象
- **ファイル**: \`${FILE_PATH}\`

## 推奨アクション
${ACTION}

## 推定工数
${EFFORT}
${DECOMPOSE_NOTE}

---
*\`/​find-refactoring\` により自動生成*" \
  --label "refactoring,automated,priority/​${PRIORITY}"

出力形式

成功時

## リファクタリングIssue作成完了

| Issue | タイトル | 優先度 | 推定工数 |
|-------|---------|--------|---------|
| #101 | refactor: src/​foo.ts 分割 | High | 1h |
| #102 | refactor: src/​bar.ts any除去 | High | 25m |

### スキップ(既存Issue)
- `src/​old.ts` → #45

### 次のステップ
1. 実装: `task #101 #102`
2. 大きなIssue分割: `/​decompose-issue 103`

dry-run時

## リファクタリング候補レポート(dry-run)

| # | ファイル | 問題 | 優先度 | 推定工数 |
|---|---------|------|--------|---------|
| 1 | `src/​foo.ts` | 723行超過 | High | 1h |

### Issue作成コマンド
\`/​find-refactoring src/ --min-priority=high\`

完了条件

  • 必須ツール(ast-grep)が利用可能
  • 対象パスの分析が完了
  • 既存Issueとの重複チェック済み
  • 検出結果がユーザーに提示済み
  • 承認されたIssueが作成済み(dry-run以外)
  • 200行超Issueに分割推奨が注記済み

関連スキル

スキル用途
refactoring-detection skill検出パターン・工数算出
code-quality-rules skill品質ルール定義
issue-size-estimation skillIssue粒度判定
approval-gate skillユーザー承認ゲート

変更履歴

バージョン変更内容
v1.2検出ロジックをrefactoring-detectionスキルに分離
v1.1言語検出、ツール確認、既存Issue重複チェック、粒度チェック追加
v1.0初版作成

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View