autonomous-code-review
FreeNo executable scriptsNot checkedRun comprehensive code quality checks, tests, and fixes autonomously
by majiayu000★ 31 GitHub starsAbout this skill
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:
- Run tests first - Understand current state
- Identify issues - Audit for bad practices
- Fix systematically - Apply fixes one at a time
- Verify each fix - Run tests after each change
- 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}
Install autonomous-code-review in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
BashReadGrepEditBundled files
FAQ
What does the autonomous-code-review skill do?
Run comprehensive code quality checks, tests, and fixes autonomously
How do I install the autonomous-code-review skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the autonomous-code-review skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
by Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
by Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
by Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
by Anthropic