5,012,758 AI resources indexedWorking toward the world’s largest AI resource index.

Code Analyzer

Analyzes code quality, detects code smells, suggests refactoring, and calculates complexity metrics. Use before testing or deployment.

Installable skillApache-2.0By David-Li0406Updated Oct 31, 2026
INTENDED FOROpenClawInstall in a listed agent.

instructions.md

---
name: code-analyzer-f63c5130fc3c
description: Analyzes code quality, detects code smells, suggests refactoring, and calculates complexity metrics. Use before testing or deployment.
---

# Code Analyzer

## Role
코드 품질 분석 및 리팩토링 제안 전문가

## Goal
- 코드 품질 메트릭 측정
- 잠재적 버그 탐지
- 리팩토링 기회 식별

## Responsibilities

### 1. Complexity Analysis
```bash
# Python
radon cc src/ -a -nb  # Cyclomatic Complexity
radon mi src/         # Maintainability Index

# JavaScript
npx eslint src/ --format json
npx complexity-report src/
```

### 2. Code Smell Detection
- 중복 코드 탐지
- 긴 함수/클래스 식별
- 과도한 매개변수
- 깊은 중첩 구조

```python
# 중복 코드 탐지
pylint src/ --disable=all --enable=duplicate-code

# 사용하지 않는 import 제거
autoflake --check --remove-all-unused-imports -r src/
```

### 3. Static Analysis
```bash
# Python
mypy src/              # Type checking
bandit src/ -r         # Security issues
pylint src/            # Code quality

# JavaScript/TypeScript
npm run lint
npm run type-check
```

### 4. Refactoring Suggestions

**Before:**
```python
def process_user_data(email, password, name, age, address, phone):
    # 매개변수가 너무 많음
    pass
```

**After:**
```python
from dataclasses import dataclass

@dataclass
class UserData:
    email: str
    password: str
    name: str
    age: int
    address: str
    phone: str

def process_user_data(user_data: UserData):
    # 구조화된 데이터 사용
    pass
```

## Metrics

### Cyclomatic Complexity
- 1-5: 단순 (Good)
- 6-10: 보통
- 11-20: 복잡 (Refactor)
- 21+: 매우 복잡 (Must Refactor)

### Maintainability Index
- 85-100: 높음 (Good)
- 65-84: 보통
- 0-64: 낮음 (Refactor)

## Input Requirements
- 소스 코드 경로

## Output
- `.agent/artifacts/code-analysis-report.md`
- 리팩토링 제안 목록
- 메트릭 대시보드

## Constraints
- 토큰: 20-40K
- 전체 코드베이스 스캔
- 우선순위 매기기

## Best Practices
- 자동화된 도구 활용
- 정량적 메트릭 제공
- 구체적인 개선안 제시
- 단계별 리팩토링 계획

Platform guidance

Imported from the listed AgentSkill.sh category. Complete supplied package files and notices are retained. Required external tools and credentials are not installed. No bundled code was executed during import. Individual agent task behavior has not been tested.