用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/cxcscmu/SkillLearnBench --skill run2-data-aggregation命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Handles reading, populating, and saving .docx files using the python-docx library. Use this skill for any tasks involving template filling or modifying Word documents.
Perform various data analysis on SEC 13-F and obtain some insights of fund activities such as number of holdings, AUM, and change of holdings between two quarters.
This skill includes search capability in 13F, such as fuzzy search a fund information using possibly inaccurate name, or fuzzy search a stock cusip info using its name.
基于 SOC 职业分类
正在显示 SKILL.md
| name | run2_data-aggregation |
| description | Aggregate and validate GitHub API data for metrics calculation with comprehensive error handling. |
Convert raw GitHub API responses into meaningful metrics with proper validation and error handling.
# Always check for None values from API
if pr.get("merged_at") is None:
# PR not merged
pass
from datetime import datetime
def parse_github_timestamp(iso_string):
"""Convert GitHub's ISO 8601 timestamps safely."""
if not iso_string:
return None
return datetime.fromisoformat(iso_string.replace("Z", "+00:00"))
def calculate_time_to_merge(created_at, merged_at):
"""Calculate days from creation to merge."""
if not merged_at:
return None
created = parse_github_timestamp(created_at)
merged = parse_github_timestamp(merged_at)
if not created or not merged:
return None
return (merged - created).total_seconds() / 86400
# Average calculation with validation
merge_times = [t for t in times if t is not None and t >= 0]
avg_days = sum(merge_times) / len(merge_times) if merge_times else 0
avg_days = round(avg_days, 1) # Round to 1 decimal place
# For PRs
merged_count = sum(1 for pr in prs if pr.get("merged_at") is not None)
closed_count = sum(1 for pr in prs if pr.get("state") == "closed")
open_count = sum(1 for pr in prs if pr.get("state") == "open")
def has_label_substring(item, substring):
"""Check if any label contains substring (case-insensitive)."""
labels = item.get("labels", [])
if not labels:
return False
return any(substring.lower() in label.get("name", "").lower() for label in labels)
# Count bug reports
bug_issues = [i for i in issues if has_label_substring(i, "bug")]
from collections import Counter
def get_top_contributor(items):
"""Find person with most contributions."""
authors = []
for item in items:
user = item.get("user")
if user and user.get("login"):
authors.append(user["login"])
if not authors:
return None
return Counter(authors).most_common(1)[0][0]
def validate_data(prs, issues):
"""Validate data integrity."""
errors = []
if not isinstance(prs, list):
errors.append("PRs must be a list")
if not isinstance(issues, list):
errors.append("Issues must be a list")
# Spot check a few items
for pr in prs[:5]:
if "created_at" not in pr:
errors.append("Missing created_at in PR")
break
return errors
Return clean dictionaries with all required fields present:
{
"pr": {
"total": int,
"merged": int,
"closed": int,
"avg_merge_days": float,
"top_contributor": str or None
},
"issue": {
"total": int,
"bug": int,
"resolved_bugs": int
}
}