Command Palette

Search for a command to run...

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

autonomous-code-review

БесплатноБез исполняемых скриптовНе проверен

Run comprehensive code quality checks, tests, and fixes autonomously

majiayu000от majiayu000★ 31 звезда на GitHub

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

Autonomous Code Review Skill

Run comprehensive code quality checks, tests, and fixes without human intervention.

When to Use

Use this skill:

  • For autonomous code quality maintenance
  • When instructed to "review and fix code"
  • As a regular maintenance task
  • After completing a feature or fix

Philosophy: LLM-Human Collaboration

This skill enables Claude to work autonomously on code quality:

  1. Run tests first - Understand current state
  2. Identify issues - Audit for bad practices
  3. Fix systematically - Apply fixes one at a time
  4. Verify each fix - Run tests after each change
  5. Report clearly - Enable human oversight

Autonomous Workflow

Phase 1: Assess Current State

echo "=== Phase 1: Current State Assessment ==="

# 1.1 Check git status
echo "## Git Status"
git status --short

# 1.2 Run existing tests
echo "## Running Tests"
uv run pytest MouseMaster/Testing/Python/ -v --tb=short 2>&1 | tee /tmp/test_results.txt
TEST_EXIT=$?

if [ $TEST_EXIT -eq 0 ]; then
    echo "✓ All tests passing"
else
    echo "✗ Some tests failing - review before proceeding"
    grep -E "FAILED|ERROR" /tmp/test_results.txt
fi

# 1.3 Run linting
echo "## Running Linter"
uv run ruff check . 2>&1 | tee /tmp/lint_results.txt
LINT_EXIT=$?

if [ $LINT_EXIT -eq 0 ]; then
    echo "✓ No linting errors"
else
    echo "✗ Linting issues found"
fi

# 1.4 Run type checking
echo "## Running Type Checker"
uv run mypy MouseMaster/MouseMasterLib/ 2>&1 | tee /tmp/mypy_results.txt || true

Phase 2: Audit Code Quality

echo "=== Phase 2: Code Quality Audit ==="

# 2.1 Exception swallowing (CRITICAL)
echo "## Critical: Exception Swallowing"
EXCEPT_PASS=$(grep -rn "except.*:" MouseMaster/ --include="*.py" -A1 2>/dev/null | grep -c "pass$" || echo 0)
echo "Found: $EXCEPT_PASS instances of except...pass"

# 2.2 Broad exceptions (HIGH)
echo "## High: Broad Exceptions"
BROAD_EXCEPT=$(grep -rn "except Exception\b\|except:$" MouseMaster/ --include="*.py" 2>/dev/null | wc -l || echo 0)
echo "Found: $BROAD_EXCEPT broad exception handlers"

# 2.3 Missing logging in except blocks
echo "## Medium: Missing Logging"
# Complex pattern - needs manual review
grep -rn "except.*:" MouseMaster/ --include="*.py" -A3 2>/dev/null | head -50

# 2.4 Silent returns
echo "## Medium: Silent Returns"
grep -rn "return None$\|return$" MouseMaster/ --include="*.py" -B2 2>/dev/null | grep -E "(if|error|fail)" | head -20

Phase 3: Generate Issue List

Create a prioritized list of issues to fix:

#!/usr/bin/env python3
"""Generate prioritized issue list for autonomous fixing."""

import subprocess
import re
from pathlib import Path
from dataclasses import dataclass
from typing import List
from enum import Enum

class Priority(Enum):
    CRITICAL = 1
    HIGH = 2
    MEDIUM = 3
    LOW = 4

@dataclass
class Issue:
    file: Path
    line: int
    priority: Priority
    category: str
    pattern: str
    context: str

def find_except_pass(src_dir: Path) -> List[Issue]:
    """Find except:pass patterns."""
    issues = []
    for py_file in src_dir.rglob("*.py"):
        content = py_file.read_text()
        lines = content.split('\n')
        for i, line in enumerate(lines):
            if re.search(r'except.*:\s*$', line):
                # Check next non-empty line
                for j in range(i+1, min(i+3, len(lines))):
                    if lines[j].strip() == 'pass':
                        issues.append(Issue(
                            file=py_file,
                            line=i+1,
                            priority=Priority.CRITICAL,
                            category="exception_swallowing",
                            pattern="except:pass",
                            context='\n'.join(lines[max(0,i-1):min(len(lines),i+3)])
                        ))
                        break
    return issues

def find_broad_except(src_dir: Path) -> List[Issue]:
    """Find overly broad exception handlers."""
    issues = []
    for py_file in src_dir.rglob("*.py"):
        content = py_file.read_text()
        lines = content.split('\n')
        for i, line in enumerate(lines):
            if re.search(r'except\s+(Exception|BaseException)\b', line) or \
               re.search(r'except\s*:\s*$', line):
                issues.append(Issue(
                    file=py_file,
                    line=i+1,
                    priority=Priority.HIGH,
                    category="broad_exception",
                    pattern="except Exception/except:",
                    context='\n'.join(lines[max(0,i-1):min(len(lines),i+5)])
                ))
    return issues

# Run and output
if __name__ == "__main__":
    src = Path("MouseMaster")
    all_issues = find_except_pass(src) + find_broad_except(src)
    all_issues.sort(key=lambda x: x.priority.value)

    print(f"Found {len(all_issues)} issues:\n")
    for issue in all_issues:
        print(f"[{issue.priority.name}] {issue.file}:{issue.line}
Полный SKILL.md на GitHub

Установить autonomous-code-review в Claude Code и Claude Desktop

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

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

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

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

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

Bash
Read
Grep
Edit

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

metadata.json

FAQ

Что делает скилл autonomous-code-review?

Run comprehensive code quality checks, tests, and fixes autonomously

Как установить скилл autonomous-code-review?

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

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

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

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

Сравнить autonomous-code-review с