← スキル一覧に戻る

refactor-large-file
by Row0902
⭐ 0🍴 0📅 2026年1月21日
SKILL.md
name: Refactor Large File description: Strategy for splitting files >300 lines into cohesive sub-modules.
✂️ Refactoring Skill: Splitting Large Files
Context
Files exceeding 300 lines violate SRP and become hard to maintain. This skill systematically breaks them down.
Steps
-
Analyze Responsibilities:
- Identify distinct clusters of logic (e.g.,
UI ComponentsvsEvent HandlersvsHelper Functions). - Use
view_file_outlineto visualize class/function groups.
- Identify distinct clusters of logic (e.g.,
-
Create Package Structure:
- If
module.pyis the target:mkdir module_pkg mv module.py module_pkg/__init__.py - Or prefer creating specific files:
helpers.py,constants.py,types.py.
- If
-
Move & Isolate:
- Move code chunks to new files.
- CRITICAL: Ensure imports in new files are correct.
- CRITICAL: Re-export moved classes in
__init__.pyto maintain backward compatibility if needed, OR update all consumers (preferred).
-
Verify:
- Run
uv run pytestimmediately. - Check for circular imports (common risk).
- Run
Example Command Sequence
# 1. Create sub-modules
New-Item -Path "src/core/complex_module/types.py" -Force
New-Item -Path "src/core/complex_module/logic.py" -Force
# 2. Update __init__.py to export public API
echo "from .types import *" > src/core/complex_module/__init__.py
echo "from .logic import *" >> src/core/complex_module/__init__.py
スコア
総合スコア
35/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
○言語
プログラミング言語が設定されている
0/5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です