スキル一覧に戻る
resper1965

refactoring

by resper1965

0🍴 0📅 2026年1月21日
GitHubで見るManusで実行

SKILL.md


type: skill name: Refactoring description: Safe code refactoring with step-by-step approach skillSlug: refactoring phases: [E] generated: 2026-01-20 status: filled scaffoldVersion: "2.0.0"

Refactoring Skill

When to Use

Use this skill when:

  • Improving code structure without changing functionality
  • Eliminating code duplication
  • Improving readability
  • Optimizing performance through better structure

Safe Refactoring Procedures

1. Extract Functions

Before:

# Long function doing multiple things
def index_files(conn):
    # 50+ lines of logic

After:

# Extract logical components
def process_pdf_file(filepath):
    """Process single PDF file."""
    
def save_document_to_db(cursor, doc_data):
    """Save document to database."""

2. Improve Function Organization

Pattern from codebase:

  • Helper functions before main functions
  • Related functions grouped together
  • Clear separation of concerns

3. Reduce Duplication

Example: Classification logic extracted to separate function:

def classify_document(filename, filepath):
    """Centralized classification logic."""

Code Smell Detection

Common Code Smells in Project

  1. Long Functions (>50 lines)

    • Break into smaller functions
    • Example: index_files() could be split
  2. Repeated Patterns

    • Extract to functions
    • Example: Error handling patterns
  3. Magic Numbers

    • Extract to constants
    • Example: MIN_TEXT_LENGTH = 10
  4. Complex Conditionals

    • Extract to named functions
    • Example: Classification logic

Refactoring Patterns

Extract Constants

Before:

if len(text.strip()) < 10:

After:

MIN_TEXT_LENGTH = 10
if len(text.strip()) < MIN_TEXT_LENGTH:

Extract Helper Functions

Pattern:

  • Small, focused functions
  • Clear names
  • Single responsibility

Testing After Refactoring

Required:

  • Run existing tests
  • Verify functionality unchanged
  • Test edge cases
  • Validate performance

Refactoring Checklist

  • Functionality unchanged
  • Tests pass after refactoring
  • Code more readable
  • No duplication introduced
  • Performance maintained or improved
  • Documentation updated if needed

スコア

総合スコア

50/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
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です