health-checklisted
Install: claude install-skill fagemx/edda
# Health Check Skill
定期健康檢查,用 5 個維度快速評估代碼庫狀態,追蹤技術債趨勢。
## 設計理念
技術債最大的問題不是「存在」,而是「太晚發現」。這個 skill 的目標是:
- **快速**:自動化部分 < 5 分鐘
- **可比較**:每次產出相同格式的 scorecard,方便追蹤趨勢
- **可行動**:產出 Top 3 最急迫的行動項目
## Usage
```
args: "" # Full 5-dimension health check
args: "quick" # Fast mode: only automated metrics, skip manual analysis
args: "compare" # Compare with last scan, show trend
args: "dim:<N>" # Run single dimension (1-5)
```
## Workflow
### Step 0: Setup
```bash
# Create output directory
SCAN_DATE=$(date +%Y%m%d)
SCAN_DIR="/tmp/health-check-${SCAN_DATE}"
mkdir -p "$SCAN_DIR"
# Check for previous scans for trend comparison
PREV_SCAN=$(ls -td /tmp/health-check-* 2>/dev/null | grep -v "$SCAN_DIR" | head -1)
```
### Step 1: Dimension 1 — 可讀性 (Readability)
自動化指標:
**1a. 函數長度分佈**
```bash
# Find functions >50 lines in Rust files
# Use grep to find fn definitions, then count lines to next fn or closing brace
# Simplified: count files with functions >50 lines
```
- 用 Grep 搜尋 `crates/` 下所有 `.rs` 檔案
- 用 `wc -l` 統計每個檔案行數
- 計算 >200 行、>500 行、>800 行的檔案數
**1b. 命名品質**
```bash
# Search for single-char variable names (excluding loop vars i,j,k and common patterns)
# Search for vague names: tmp, data, result, handle, process, info, manager
```
- Grep 搜尋 `let [a-z]\b`(排除 `let i`, `let j`, `let k`)
- Grep 搜尋 `fn (handle|process|manage|do_)\w+`
**1c. 抽象層數**
- 從 `main.rs` 追蹤到核心邏輯的跳轉次數(手動抽樣 2-3 個 command)
**評分標準:**
| 分數 | 條件 |
|------|------|
| 5 | >500行檔案 = 0, 模糊命名