Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

code-refactoring-advisor

БесплатноЗапускает вложенные скриптыНе проверен

Enterprise code refactoring advisor that detects code smells, anti-patterns, and complexity issues with specific refactoring recommendations, test generation…

jiayaoqijiaот jiayaoqijia★ 81 звезда на GitHub

Об этом скилле

capabilities:

  • python code smell detection (god functions, long parameters, deep nesting, etc.)
  • solidity smart contract anti-patterns (reentrancy, unchecked arithmetic, etc.)
  • cyclomatic complexity calculation per function
  • maintainability index scoring (0-100)
  • specific refactoring recommendations with code examples
  • automatic unit test generation
  • security pattern detection
  • test strategy planning
  • code quality metrics and reporting

security_considerations:

  • Read-only code analysis (no code execution)
  • No external file access
  • Pattern-based detection only
  • Safe AST parsing with error handling
  • No sensitive data exposure
  • No code modification without user confirmation
  • Sandbox analysis environment

Overview

The Code Refactoring Advisor is an enterprise-grade code quality tool that analyzes Python and Solidity code to detect smells, anti-patterns, and complexity issues with actionable refactoring recommendations. It combines pattern detection, complexity metrics, and test generation to improve code quality systematically.

Key capabilities:

  • Code Smell Detection: 12+ patterns (god functions, long parameters, deep nesting, etc.)
  • Complexity Analysis: Cyclomatic complexity and maintainability index calculation
  • Refactoring Recommendations: Specific solutions with code examples and effort estimates
  • Test Generation: Automatic unit and integration test case generation
  • Security Patterns: Solidity vulnerability detection (reentrancy, arithmetic, etc.)

Module Details

Module 1: Pattern Detector (92% Confidence)

Detects code smells and anti-patterns in Python and Solidity:

  • Python: God functions, long parameter lists, deep nesting, bare excepts, global variables, magic numbers
  • Solidity: Reentrancy vulnerabilities, unbounded loops, unchecked arithmetic, unclear visibility
  • Outputs: Severity levels (CRITICAL/HIGH/MEDIUM/LOW), confidence scores, line numbers

Module 2: Refactoring Suggester (88% Confidence)

Generates specific refactoring solutions:

  • Pattern-based recommendations (extract method, parameter object, strategy pattern, etc.)
  • Effort estimates (TRIVIAL to LARGE)
  • Benefits per refactoring (testability, maintainability, security, etc.)
  • Code examples showing before/after

Module 3: Complexity Analyzer (90% Confidence)

Calculates code metrics:

  • Cyclomatic complexity per function
  • Maintainability Index (0-100)
  • Code statistics (lines, comments, ratio)
  • Health scoring and improvement recommendations

Module 4: Test Generator (85% Confidence)

Creates test cases for refactored code:

  • Unit tests (extracted methods, parameters, guards)
  • Integration tests (combined functionality)
  • Security tests (reentrancy, edge cases)
  • Test templates and strategies

Usage Examples

Detect Code Smells

from scripts.pattern_detector import PatternDetector

detector = PatternDetector()
result = detector.analyze_code(source_code, language="python")
print(f"Smells found: {result['smells_detected']}")
print(f"Code quality: {result['code_quality']}%")

Get Refactoring Recommendations

from scripts.refactoring_suggester import RefactoringSuggester

suggester = RefactoringSuggester()
suggestions = suggester.suggest_refactoring(smell_data)
for suggestion in suggestions['suggestions']:
    print(f"{suggestion['smell_type']}: {suggestion['solutions']}")

Analyze Complexity

from scripts.complexity_analyzer import ComplexityAnalyzer

analyzer = ComplexityAnalyzer()
metrics = analyzer.analyze_module(source_code)
print(f"Maintainability: {metrics['maintainability_index']['rating']}")

Generate Tests

from scripts.test_generator import TestGenerator

generator = TestGenerator()
tests = generator.generate_tests(refactoring_suggestions)
for test in tests['test_cases']:
    print(f"Test: {test['name']}")

Output Format

All modules return structured JSON:

{
  "analysis_type": "string",
  "smells_detected": number,
  "code_quality_score": 0-100,
  "severity_breakdown": { "CRITICAL": n, "HIGH": n, ... },
  "refactoring_opportunities": number,
  "estimated_effort": "string",
  "estimated_quality_improvement": number,
  "test_cases_generated": number,
  "recommendations": ["array of actionable items"],
  "metrics": { "complexity": number, "maintainability": number, ... }
}

Severity Levels

Level Meaning Impact Action
CRITICAL Major security/correctness issue High risk Fix immediately
HIGH Significant code quality issue Moderate risk Fix in this sprint
MEDIUM Maintainability concern Low-moderate risk Plan refactoring
LOW Minor improvement opportunity Low risk Consider for future

Version & Support

  • Version: 1.0.0
  • Released: February 8, 2026
  • Status: Production Ready
  • Confidence: 90%

Future Enhancements (v1.1.0)

  • TypeScript a
Полный SKILL.md на GitHub

Установить code-refactoring-advisor в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

README.mdSOURCE.mdTRUST.auto.yamlrequirements.txtscripts/complexity_analyzer.pyscripts/pattern_detector.pyscripts/refactoring_suggester.pyscripts/test_generator.py

FAQ

Что делает скилл code-refactoring-advisor?

Enterprise code refactoring advisor that detects code smells, anti-patterns, and complexity issues with specific refactoring recommendations, test generation, and maintainability metrics

Как установить скилл code-refactoring-advisor?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл code-refactoring-advisor запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить code-refactoring-advisor с