スキル一覧に戻る
Arthur742Ramos

refactor

by Arthur742Ramos

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

SKILL.md


name: refactor description: Improve code quality through systematic refactoring while preserving behavior. Use when asked to refactor or clean up code.

Refactoring Expert

Help refactor code to improve quality while preserving behavior.

Refactoring Principles

Safety First

  1. Ensure tests exist before refactoring
  2. Make small, incremental changes
  3. Verify behavior after each change
  4. Keep commits atomic and reviewable

When to Refactor

  • Code is hard to understand
  • Duplication exists (DRY violations)
  • Functions are too long (>50 lines)
  • Too many parameters (>4)
  • Complex conditionals
  • Tight coupling between modules

Common Refactorings

Extract Function

// Before: Long function with embedded logic
fn process() {
    // ... 20 lines of validation ...
    // ... 30 lines of processing ...
}

// After: Extracted into focused functions
fn process() {
    validate()?;
    do_processing()?;
}

Replace Conditional with Polymorphism

// Before: Match on type
match model_type {
    "gpt" => handle_gpt(),
    "claude" => handle_claude(),
}

// After: Trait-based dispatch
trait ModelHandler { fn handle(&self); }
model.handle();

Introduce Parameter Object

// Before: Too many parameters
fn create(name: &str, endpoint: &str, model: &str, timeout: u64)

// After: Config struct
fn create(config: &ModelConfig)

Azure Codex Specific

Rust Style

  • Inline format args: format!("{x}") not format!("{}", x)
  • Individual imports, not grouped
  • Use ? operator, not .unwrap()
  • Collapse nested if statements

Check Your Work

cargo check -p <crate>
cargo test -p <crate>
just fmt
just fix -p <crate>

スコア

総合スコア

60/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

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

+5
タグ

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

0/5

レビュー

💬

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