← スキル一覧に戻る

code-metrics
by uukuguy
A production-ready multi-agent orchestration framework built on Claude Agent SDK. Design, compose, and deploy complex AI workflows with pre-built architecture patterns.
⭐ 0🍴 0📅 2025年12月27日
SKILL.md
name: code-metrics description: Code metrics calculation methodology for static analysis
Code Metrics Calculation
Objective
Calculate comprehensive code metrics for quality assessment.
Metrics Definitions
Complexity Metrics
-
Cyclomatic Complexity
- Count: decisions + 1
- Decisions: if, else, for, while, case, catch, &&, ||, ?:
- Thresholds: 1-10 (good), 11-20 (moderate), 21+ (high risk)
-
Cognitive Complexity
- Base: control flow structures
- Nesting penalty: +1 per nesting level
- Thresholds: 1-15 (good), 16-30 (moderate), 31+ (refactor)
-
Nesting Depth
- Maximum depth of nested structures
- Thresholds: 1-3 (good), 4-5 (moderate), 6+ (refactor)
Size Metrics
-
Lines of Code (LOC)
- Physical lines (including blanks)
- Logical lines (statements)
- Comment lines
-
Function Length
- Lines per function/method
- Thresholds: 1-30 (good), 31-50 (moderate), 51+ (long)
-
File Length
- Total lines per file
- Thresholds: 1-300 (good), 301-500 (moderate), 501+ (large)
Coupling Metrics
-
Afferent Coupling (Ca)
- Number of modules depending on this module
- High Ca = widely used, risky to change
-
Efferent Coupling (Ce)
- Number of modules this module depends on
- High Ce = high dependency, harder to maintain
-
Instability (I)
- Formula: Ce / (Ca + Ce)
- Range: 0 (stable) to 1 (unstable)
Duplication Metrics
-
Duplicate Lines
- Exact match blocks > 6 lines
- Percentage of codebase
-
Similar Blocks
- Token-based similarity > 85%
- Parameterized duplicates
Calculation Process
- Parse source files into AST
- Visit all nodes and calculate metrics
- Aggregate at function, class, file, module levels
- Compare against thresholds
- Generate scores (0-100)
Scoring Formula
Quality Score = 100 - (
complexity_penalty * 0.3 +
size_penalty * 0.2 +
coupling_penalty * 0.2 +
duplication_penalty * 0.3
)
Where penalties are percentage of violations.
スコア
総合スコア
60/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
✓説明文
100文字以上の説明がある
+10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です