用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/majiayu000/claude-skill-registry --skill repository-health-analyzer命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | repository-health-analyzer |
| version | 1.0.0 |
| category | coordination |
| description | Repository Health Analyzer |
Version: 1.0.0 Created: 2026-01-05 Category: workspace-hub Related Skills: repo-sync, compliance-check, knowledge-base-system
Analyzes health metrics across all 26+ repositories. Provides unified health scores, identifies issues, and generates actionable reports.
Total: 100 points
# Check single repository
./scripts/monitoring/check_repo_health.sh digitalmodel
# Check all repositories
./scripts/monitoring/check_all_repos.sh
# Generate health report
./scripts/monitoring/generate_health_report.sh
#!/usr/bin/env python3
# scripts/monitoring/analyze_repo_health.py
import subprocess
from pathlib import Path
import json
from datetime import datetime, timedelta
def analyze_repository(repo_path):
"""Analyze repository health."""
health = {
"repository": repo_path.name,
"timestamp": datetime.now().isoformat(),
"scores": {},
"total_score": 0,
"grade": "F",
"issues": [],
"recommendations": []
}
# Git Health (30 points)
health["scores"]["git"] = check_git_health(repo_path)
# Code Quality (25 points)
health["scores"]["quality"] = check_code_quality(repo_path)
# Compliance (25 points)
health["scores"]["compliance"] = check_compliance(repo_path)
# Activity (10 points)
health["scores"]["activity"] = check_activity(repo_path)
# Dependencies (10 points)
health["scores"]["dependencies"] = check_dependencies(repo_path)
# Calculate total
health["total_score"] = sum(health["scores"].values())
# Assign grade
health["grade"] = calculate_grade(health["total_score"])
health
():
score =
result = subprocess.run(
[, , (repo_path), , ],
capture_output=, text=
)
result.stdout.strip():
score -=
result = subprocess.run(
[, , (repo_path), ],
capture_output=, text=
)
result.stdout:
score -=
result.stdout:
score -=
(, score)
():
score =
coverage_file = repo_path /
coverage_file.exists():
score -=
:
docs_dir = repo_path /
docs_dir.exists() (docs_dir.glob()):
score -=
(, score)
():
score =
(repo_path / ).exists():
score -=
(repo_path / ).exists():
score -=
(repo_path / ).exists():
score -=
(, score)
():
result = subprocess.run(
[, , (repo_path), , , ],
capture_output=, text=
)
result.returncode == :
last_commit = datetime.fromisoformat(result.stdout.strip().split()[])
days_ago = (datetime.now() - last_commit).days
days_ago <= :
days_ago <= :
days_ago <= :
:
():
score =
(repo_path / ).exists():
(repo_path / ).exists():
:
score -=
(, score)
():
score >= :
score >= :
score >= :
score >= :
:
__name__ == :
repos_file = Path()
repos = [line.split()[] line repos_file.read_text().split()
line line.startswith()]
all_health = []
repo_name repos:
repo_path = Path(repo_name)
repo_path.exists():
health = analyze_repository(repo_path)
all_health.append(health)
()
report_path = Path()
report_path.parent.mkdir(parents=, exist_ok=)
report_path.write_text(json.dumps(all_health, indent=))
()
Repository Health Dashboard
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Overall Health: 82/100 (B)
Top Performers:
1. digitalmodel 95/100 (A) ✓
2. worldenergydata 92/100 (A) ✓
3. aceengineer-admin 89/100 (B) ✓
Needs Attention:
1. repo-alpha 65/100 (D) ⚠
2. repo-beta 58/100 (F) ✗
3. repo-gamma 61/100 (D) ⚠
Critical Issues:
- 3 repos with uncommitted changes
- 2 repos missing CLAUDE.md
- 1 repo behind remote by 15 commits
- 4 repos with test coverage < 80%
Recommendations:
1. Update CLAUDE.md in 2 repositories
2. Commit and push pending changes in 3 repositories
3. Improve test coverage in 4 repositories
4. Install git hooks in 5 repositories
def generate_html_dashboard(health_data):
"""Generate interactive HTML dashboard."""
import plotly.express as px
import plotly.graph_objects as go
from plotly.subplots import make_subplots
# Overall scores
df = pd.DataFrame(health_data)
# Score distribution
fig = make_subplots(
rows=2, cols=2,
subplot_titles=('Score Distribution', 'Health by Dimension',
'Timeline', 'Top Issues'),
specs=[[{'type': 'bar'}, {'type': 'bar'}],
[{'type': 'scatter'}, {'type': 'table'}]]
)
# Score distribution
fig.add_trace(
go.Bar(x=df['repository'], y=df['total_score'],
name='Health Score'),
row=1, col=1
)
# Health by dimension
dimensions = ['git', 'quality', 'compliance', 'activity', 'dependencies']
for dim in dimensions:
fig.add_trace(
go.Bar(x=df['repository'],
y=[s['scores'][dim] for s in health_data],
name=dim),
row=1, col=
)
fig.write_html(,
include_plotlyjs=)
def detect_issues(health_data):
"""Detect and categorize issues."""
issues = {
"critical": [],
"warning": [],
"info": []
}
for repo in health_data:
# Critical issues (score < 60)
if repo["total_score"] < 60:
issues["critical"].append({
"repo": repo["repository"],
"issue": f"Overall health score {repo['total_score']}/100",
"recommendation": "Review all health dimensions"
})
# Missing compliance
if repo["scores"]["compliance"] < 15:
issues["critical"].append({
"repo": repo["repository"],
"issue": "Missing critical compliance files",
"recommendation": "Run compliance setup script"
})
# Low test coverage
if repo["scores"]["quality"] < 15:
issues["warning"].append({
"repo": repo["repository"],
"issue": "Low test coverage",
"recommendation":
})
repo[][] == :
issues[].append({
: repo[],
: ,
:
})
issues
# .github/workflows/health-check.yml
name: Repository Health Check
on:
schedule:
- cron: '0 0 * * 0' # Weekly on Sunday
jobs:
health-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run Health Analysis
run: python scripts/monitoring/analyze_repo_health.py
- name: Generate Dashboard
run: python scripts/monitoring/generate_dashboard.py
- name: Upload Report
uses: actions/upload-artifact@v3
with:
name: health-report
path: reports/health/
def send_alerts(issues):
"""Send alerts for critical issues."""
if issues["critical"]:
# Send email/Slack notification
message = f"CRITICAL: {len(issues['critical'])} health issues detected"
for issue in issues["critical"]:
message += f"\n- {issue['repo']}: {issue['issue']}"
send_notification(message)
# Check health before major operations
./scripts/repository_sync commit all
# If health check fails
if ! ./scripts/monitoring/check_all_repos.sh; then
echo "Health check failed. Fix issues before proceeding."
exit 1
fi
Monitor health across all repositories with unified metrics! 📊