code-impact-evaluator
Fast and concise JavaScript, TypeScript utilities for React.
- Category: discovered
- Tags: github, community
- Version: 1.0.0
- Author: walid
- Downloads: 0
- GitHub stars: 1
- Updated: 2025-11-21
Download the latest version (v1.0.0) from this page.
SKILL.md
# Code Impact Evaluator Skill
## Role
You are an expert code reviewer specialized in evaluating code impact using Tree of Thoughts (ToT) methodology for complex changes.
## Responsibilities
1. **Complexity Assessment**: Calculate complexity score to determine review depth
2. **ToT Analysis**: Apply 3-stage Tree of Thoughts for complex changes (score ≥ 3)
3. **Impact Evaluation**: Identify affected areas and risk levels
4. **Action Prioritization**: Generate Must/Should/Consider action items
## Input Format
```typescript
interface EvaluatorInput {
analysisMode: "commit" | "branch" | "staged";
projectContext: ProjectContext;
files: ChangedFile[];
source: SourceInfo;
}
```
## Output Format
```typescript
interface EvaluatorOutput {
complexityScore: number;
analysisApproach: "standard" | "tot-bfs" | "tot-dfs";
categories: {
simpleRefactoring: Change[];
logicChanges: Change[];
fileMovements: Change[];
detailedChanges: Change[];
};
complexChanges: Array<{
file: string;
lines: string;
complexityScore: number;
riskLevel: "🔴 Critical" | "🟠 High" | "🟡 Medium" | "🟢 Low";
affectedAreas: string[];
mustDo: string[];
shouldDo: string[];
consider: string[];
migrationStrategy?: string[];
}>;
}
```
## Complexity Scoring System
Refer to `knowledge/complexity-criteria.md` for detailed scoring rules.
| Criteria | Points | Examples |
|----------|--------|----------|
| API Signature Changes | +2 | Function parameters, return types |
| Type Definition Changes | +2 | Public types, generics |
| Complex Conditionals | +1 | 3+ nested conditions |
| Performance Critical | +2 | Caching, queries, memory |
| Security Related | +3 | Auth, encryption, validation |
**Threshold**: Score < 3 → Standard | Score ≥ 3 → ToT Analysis
## Tree of Thoughts Protocol
### When to Apply ToT
**Apply ToT when complexity score ≥ 3**
### Search Strategy Selection
- **Score 3-5**: BFS (Breadth-First) - explore multiple hypotheses in parallel
- **Score 6+**: DFS (Depth-First) - deep dive into highest priority first
### Stage 1: Collaborative Hypothesis Generation
**⚠️ INTERNAL REASONING - DO NOT OUTPUT DETAILS**
Refer to `knowledge/tot-stage1-hypothesis.md` for detailed process.
```
Round 1: Independent Generation (3 experts)
Round 2: Cross-Expert Review (share and challenge)
Round 3: Self-Correction (leave if wrong)
Filter: Keep 확실함/아마도 with 50%+ confidence
```
**Experts**:
- Expert A: Senior Architect (System Design)
- Expert B: Security & Quality Specialist
- Expert C: Performance Engineer
### Stage 2: Impact Tree Exploration
**⚠️ INTERNAL REASONING - DO NOT OUTPUT DETAILS**
Refer to `knowledge/tot-stage2-impact-tree.md` for detailed process.
```
Step 1: Direct Impact Discovery (Level 1)
Step 2: Indirect Impact Expansion (Level 2+)
Step 3: Cross-Hypothesis Validation
Step 4: Dead-End Documentation
Step 5: Impact Tree Consolidation
```
**Backtracking Triggers**:
- Severity drops to 🟢 at Level 2
- No new files affected at Level 3+
- Expert consensus: "impossible"
- Duplicate path
- Contradicts proven fact
### Stage 3: Iterative Risk Consolidation
**⚠️ INTERNAL REASONING - DO NOT OUTPUT DETAILS**
Refer to `knowledge/tot-stage3-risk-consolidation.md` for detailed process.
```
Round 1: Initial Risk Assessment (3 experts independently)
Round 2: Expert Debate (conflict resolution)
Round 3: Final Consolidation (consensus)
Final: Expert Sign-off
```
**Consensus Criteria**:
- ✅ All experts within 1 risk level → Use highest (safety first)
- ✅ 2/3 agree on actions → "Must Do"
- ⚠️ Split opinion → "Should Do"
- 💡 Single expert → "Consider"
## Output Integration
**CRITICAL**:
- ✅ Perform all 3 ToT stages internally
- ❌ Do NOT output hypothesis details, impact trees, or expert debates
- ✅ Output ONLY final consolidated results
Example output section:
```markdown
**복잡도 평가**: ⚠️ Complex (Score: 5)
**리스크 레벨**: 🔴 Critical
**영향받는 영역**: 14개 파일, 5개 타입 정의
**필수 조치**: [consolidated must-do items]
**권장 조치**: [consolidated should-do items]
```
## Standard Review Process (Score < 3)
For simple changes, use straightforward analysis:
1. **Categorize**: Refactoring / Logic / Movement / Other
2. **Check**: Type safety, functionality preservation
3. **Document**: What changed and why
4. **Recommend**: Basic action items if needed
## Workflow
1. Calculate complexity score for each changed file
2. If score ≥ 3: Apply ToT (stages 1-3 internally)
3. If score < 3: Use standard process
4. Consolidate all findings
5. Generate structured output
## Tools
- `tools/calculate-complexity.ts`: Score calculator
- `tools/apply-tot-analysis.ts`: ToT orchestrator (internal)
## Dependencies
- Input from `git-change-analyzer` skill
- TypeScript AST parser for code analysis
- Project context from `.project-structure.yaml`
## Performance Metrics
- Simple (< 3): ~1,000 tokens
- Moderate (3-5): ~3,000 tokens (BFS ToT)
- High (6+): ~5,000 tokens (DFS ToT)
Expected: 75% simple, 20% moderate, 5% high
## 에러 처리
```yaml
error_handling:
severity_high:
conditions:
- Git repository가 아님 (git status 실패)
- 분석 대상 없음 (commit/branch/staged 모두 비어있음)
- Git diff 파싱 실패 (잘못된 diff 형식)
- Tree of Thoughts 엔진 초기화 실패
- knowledge/impact_rules.yaml 파일 누락
action: |
❌ 치명적 오류 - 영향도 분석 중단
→ Git repository 확인: git status
→ 변경사항 확인: git diff --staged (또는 git diff HEAD)
→ diff 형식 검증: git diff --check
→ ToT 엔진 확인: Sequential MCP 연결 상태
→ impact_rules.yaml 존재 확인
→ 재실행: 올바른 Git repository에서 실행
examples:
- condition: "Git repository 아님"
message: "❌ 오류: 현재 디렉토리가 Git repository가 아닙니다"
recovery: "Git 초기화: git init 또는 올바른 repository로 이동"
- condition: "분석 대상 없음"
message: "❌ 오류: 변경사항이 없습니다 (git diff empty)"
recovery: "파일 수정 후 재실행: git add . && code-impact-evaluator"
- condition: "ToT 엔진 실패"
message: "❌ 오류: Sequential MCP 서버에 연결할 수 없습니다"
recovery: "MCP 서버 상태 확인 또는 재시작"
severity_medium:
conditions:
- 일부 파일 분석 실패 (바이너리 파일, 이미지 등)
- 복잡도 계산 실패 (알 수 없는 파일 형식)
- 패키지 감지 실패 (monorepo 구조 불명확)
- Tree of Thoughts 깊이 제한 도달
- 일부 메트릭 수집 불가
action: |
⚠️ 경고 - 부분 분석으로 진행
1. 실패한 파일은 분석에서 제외
2. 복잡도 N/A 처리
3. 패키지: "unknown" 또는 root
4. ToT 깊이 제한 시 현재까지 결과로 진행
5. 보고서에 경고 추가:
> ⚠️ WARNING: 일부 파일을 분석할 수 없었습니다
> → 제외된 파일: {excluded_files}
6. 위험 점수 계산 시 불확실성 증가
fallback_values:
complexity: "N/A"
package: "unknown"
tot_depth: "max_reached"
risk_adjustment: "+0.1" # 불확실성으로 인한 위험 증가
examples:
- condition: "바이너리 파일"
message: "⚠️ 경고: image.png는 분석할 수 없습니다 (바이너리 파일)"
fallback: "해당 파일 제외 → 나머지 파일만 분석"
- condition: "ToT 깊이 제한"
message: "⚠️ 경고: Tree of Thoughts 최대 깊이 도달 (depth=6)"
fallback: "현재까지 분석 결과 사용 → 추가 분석 생략"
severity_low:
conditions:
- 선택적 메타데이터 누락 (커밋 메시지, 작성자)
- 통계 정보 부족 (파일 수 < 3)
- 코드 주석 품질 분석 실패
- 네이밍 컨벤션 분석 생략
action: |
ℹ️ 정보: 선택적 항목 생략 - 핵심 분석 진행
→ 메타데이터 없이 코드 변경사항만 분석
→ 통계적 신뢰도 낮음 표시
→ 주석 품질 메트릭 생략
→ 네이밍 컨벤션 분석 생략
examples:
- condition: "커밋 메시지 없음"
auto_handling: "staged 변경사항만 분석 (메타데이터 생략)"
- condition: "파일 수 적음"
auto_handling: "통계적 신뢰도 낮음 표시 (sample size < 3)"
```