portfolio-artifact
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese<objective>
Automatically extract Go-To-Market Engineer portfolio metrics from development sessions. Captures lines shipped, files changed, bugs fixed, tests added, PRs merged, time saved, and cost per feature. Generates executive summaries and weekly digests.
</objective>
<quick_start>
Capture today's metrics:
bash
undefined<目标>
自动从开发会话中提取Go-To-Market Engineer(GTME)的项目组合指标,包括交付代码行数、修改文件数、修复的Bug、新增测试用例、合并的PR、节省时间以及功能成本。支持生成执行摘要和每周摘要。
</目标>
<快速开始>
捕获今日指标:
bash
undefinedQuick session stats
Quick session stats
echo "Commits: $(git log --since='today 00:00' --oneline | wc -l | tr -d ' ')"
echo "Files changed: $(git diff --stat $(git log --since='today 00:00' --format='%H' | tail -1)..HEAD 2>/dev/null | tail -1)"
**Generate weekly report:**
```bash
cat ~/.claude/portfolio/daily-metrics.jsonl | jq -s 'map(select(.date >= "'$(date -v-7d +%Y-%m-%d)'"))'</quick_start>
<success_criteria>
- Daily metrics captured automatically via End Day protocol (commits, features, fixes, cost)
- Derived metrics calculated: cost-per-feature, cost-per-bug-fix, lines-per-dollar
- Weekly digest generated with project breakdown and day-by-day trends
- Executive summary ready for stakeholder review with week-over-week comparisons
- Metrics stored persistently at </success_criteria>
~/.claude/portfolio/daily-metrics.jsonl
echo "Commits: $(git log --since='today 00:00' --oneline | wc -l | tr -d ' ')"
echo "Files changed: $(git diff --stat $(git log --since='today 00:00' --format='%H' | tail -1)..HEAD 2>/dev/null | tail -1)"
**生成周报:**
```bash
cat ~/.claude/portfolio/daily-metrics.jsonl | jq -s 'map(select(.date >= "'$(date -v-7d +%Y-%m-%d)'"))'</快速开始>
<成功标准>
- 通过End Day协议自动捕获每日指标(提交记录、功能、修复、成本)
- 计算衍生指标:功能成本、Bug修复成本、每美元代码行数
- 生成包含项目细分和每日趋势的每周摘要
- 生成可供利益相关者审阅的执行摘要,包含周环比对比
- 指标持久化存储于</成功标准>
~/.claude/portfolio/daily-metrics.jsonl
<触发词>
- "capture metrics"、"portfolio report"、"what did I ship"
- "weekly summary"、"executive summary"、"sprint report"
- "show impact"、"productivity metrics" </触发词>
Metrics Captured
采集的指标
Per Session (End Day auto-capture)
每次会话(End Day自动捕获)
| Metric | Source | How |
|---|---|---|
| Commits | | Count |
| Files changed | | Count from diff |
| Lines added/removed | | Parse +/- |
| Tests added | | Count test files |
| PRs created | | GitHub CLI |
| Bugs fixed | Commits matching | Conventional commits |
| Features shipped | Commits matching | Conventional commits |
| Cost | | Daily spend |
| 指标 | 来源 | 统计方式 |
|---|---|---|
| 提交记录 | | 计数 |
| 修改文件数 | | 从diff中统计 |
| 新增/删除代码行数 | | 解析+/-数值 |
| 新增测试用例 | | 统计测试文件数 |
| 创建的PR | | GitHub CLI |
| 修复的Bug | 匹配 | 规范提交格式 |
| 交付的功能 | 匹配 | 规范提交格式 |
| 成本 | | 每日支出 |
Derived Metrics
衍生指标
| Metric | Formula | Why It Matters |
|---|---|---|
| Cost per feature | Total cost / feat: commits | Efficiency |
| Cost per bug fix | Total cost / fix: commits | ROI on debugging |
| Lines per dollar | Lines shipped / total cost | Productivity |
| Test coverage delta | Tests added / files changed | Quality signal |
| 指标 | 计算公式 | 重要性 |
|---|---|---|
| 功能成本 | 总成本 / feat:提交数 | 效率衡量 |
| Bug修复成本 | 总成本 / fix:提交数 | 调试投入回报率 |
| 每美元代码行数 | 交付代码行数 / 总成本 | 生产力衡量 |
| 测试覆盖率变化 | 新增测试数 / 修改文件数 | 质量信号 |
Collection
采集方式
Automatic (End Day Protocol)
自动采集(End Day协议)
The workflow-orchestrator End Day protocol calls this automatically:
bash
#!/bin/bash工作流编排器的End Day协议会自动调用以下脚本:
bash
#!/bin/bashAuto-capture at end of day
Auto-capture at end of day
DATE=$(date +%Y-%m-%d)
COMMITS=$(git log --since="today 00:00" --oneline 2>/dev/null | wc -l | tr -d ' ')
FEATS=$(git log --since="today 00:00" --oneline --grep="^feat" 2>/dev/null | wc -l | tr -d ' ')
FIXES=$(git log --since="today 00:00" --oneline --grep="^fix" 2>/dev/null | wc -l | tr -d ' ')
COST=$(cat ~/.claude/daily-cost.json 2>/dev/null | jq '.spent // 0')
mkdir -p ~/.claude/portfolio
echo "{"date":"$DATE","commits":$COMMITS,"features":$FEATS,"fixes":$FIXES,"cost":$COST}" >> ~/.claude/portfolio/daily-metrics.jsonl
undefinedDATE=$(date +%Y-%m-%d)
COMMITS=$(git log --since="today 00:00" --oneline 2>/dev/null | wc -l | tr -d ' ')
FEATS=$(git log --since="today 00:00" --oneline --grep="^feat" 2>/dev/null | wc -l | tr -d ' ')
FIXES=$(git log --since="today 00:00" --oneline --grep="^fix" 2>/dev/null | wc -l | tr -d ' ')
COST=$(cat ~/.claude/daily-cost.json 2>/dev/null | jq '.spent // 0')
mkdir -p ~/.claude/portfolio
echo "{"date":"$DATE","commits":$COMMITS,"features":$FEATS,"fixes":$FIXES,"cost":$COST}" >> ~/.claude/portfolio/daily-metrics.jsonl
undefinedManual (On-Demand)
手动采集(按需触发)
bash
undefinedbash
undefinedFull session capture with git stats
Full session capture with git stats
STAT=$(git diff --stat $(git log --since="today 00:00" --format="%H" | tail -1)..HEAD 2>/dev/null | tail -1)
ADDED=$(echo "$STAT" | grep -oE '[0-9]+ insertion' | grep -oE '[0-9]+' || echo 0)
REMOVED=$(echo "$STAT" | grep -oE '[0-9]+ deletion' | grep -oE '[0-9]+' || echo 0)
echo "Today: +$ADDED/-$REMOVED lines, $COMMITS commits ($FEATS features, $FIXES fixes)"
---STAT=$(git diff --stat $(git log --since="today 00:00" --format="%H" | tail -1)..HEAD 2>/dev/null | tail -1)
ADDED=$(echo "$STAT" | grep -oE '[0-9]+ insertion' | grep -oE '[0-9]+' || echo 0)
REMOVED=$(echo "$STAT" | grep -oE '[0-9]+ deletion' | grep -oE '[0-9]+' || echo 0)
echo "Today: +$ADDED/-$REMOVED lines, $COMMITS commits ($FEATS features, $FIXES fixes)"
---Report Templates
报告模板
Executive Summary (C-Suite)
执行摘要(面向高管)
markdown
undefinedmarkdown
undefinedEngineering Impact — Week of [DATE]
工程影响力 — [日期]周
Headline: Shipped [N] features, fixed [N] bugs across [N] projects
| Metric | This Week | Last Week | Trend |
|---|---|---|---|
| Features shipped | 5 | 3 | ↑ 67% |
| Bugs fixed | 8 | 12 | ↓ 33% |
| Lines shipped | 1,247 | 890 | ↑ 40% |
| Cost | $12.40 | $15.20 | ↓ 18% |
| Cost/feature | $2.48 | $5.07 | ↓ 51% |
Key Deliverables:
Cost Optimization: Shifted [N] tasks to Haiku, saving $[X] (Y% reduction)
undefined核心要点: 在[N]个项目中交付了[N]个功能,修复了[N]个Bug
| 指标 | 本周 | 上周 | 趋势 |
|---|---|---|---|
| 交付功能数 | 5 | 3 | ↑ 67% |
| 修复Bug数 | 8 | 12 | ↓ 33% |
| 交付代码行数 | 1,247 | 890 | ↑ 40% |
| 成本 | $12.40 | $15.20 | ↓ 18% |
| 功能成本 | $2.48 | $5.07 | ↓ 51% |
关键交付成果:
- [功能1]:[影响力]
- [功能2]:[影响力]
成本优化: 将[N]项任务转移至Haiku,节省$[X](降幅Y%)
undefinedWeekly Digest
每周摘要
markdown
undefinedmarkdown
undefinedWeekly Digest — [DATE RANGE]
每周摘要 — [日期范围]
By Project
按项目划分
| Project | Commits | Features | Fixes | Cost |
|---|---|---|---|---|
| skills-library | 12 | 5 | 2 | $3.40 |
| netzero-bot | 8 | 2 | 4 | $5.20 |
| 项目 | 提交记录 | 功能 | Bug修复 | 成本 |
|---|---|---|---|---|
| skills-library | 12 | 5 | 2 | $3.40 |
| netzero-bot | 8 | 2 | 4 | $5.20 |
By Day
按日期划分
| Day | Commits | Lines | Cost |
|---|---|---|---|
| Mon | 5 | +234/-45 | $1.80 |
| Tue | 8 | +567/-123 | $2.40 |
| ... | ... | ... | ... |
| 日期 | 提交记录 | 代码行数 | 成本 |
|---|---|---|---|
| 周一 | 5 | +234/-45 | $1.80 |
| 周二 | 8 | +567/-123 | $2.40 |
| ... | ... | ... | ... |
Insights
洞察
- Most productive day: Tuesday (567 lines)
- Most expensive feature: [feature] ($X)
- Cheapest bug fix: [fix] ($0.12, Haiku)
undefined- 最高效日期:周二(567行代码)
- 成本最高的功能:[功能]($X)
- 成本最低的Bug修复:[修复]($0.12,通过Haiku完成)
undefinedSprint Report
冲刺报告
markdown
undefinedmarkdown
undefinedSprint Report — [SPRINT NAME]
冲刺报告 — [冲刺名称]
Duration: [START] → [END]
Total Cost: $[X]
周期: [开始日期] → [结束日期]
总成本: $[X]
Deliverables
交付成果
- Feature A (shipped, $X)
- Feature B (shipped, $X)
- Bug fix C (shipped, $X)
- 功能A(已交付,$X)
- 功能B(已交付,$X)
- Bug修复C(已交付,$X)
Velocity
速度
- Story points completed: [N]
- Cost per story point: $[X]
- Average cycle time: [N] hours
---- 完成的故事点数:[N]
- 每故事点成本:$[X]
- 平均周期时间:[N]小时
---Storage
存储结构
~/.claude/portfolio/
├── daily-metrics.jsonl # One JSON line per day
├── weekly-YYYY-WW.md # Auto-generated weekly digest
└── monthly-YYYY-MM.md # Auto-generated monthly summary~/.claude/portfolio/
├── daily-metrics.jsonl # 每行对应一天的JSON数据
├── weekly-YYYY-WW.md # 自动生成的每周摘要
└── monthly-YYYY-MM.md # 自动生成的月度总结Integration
集成对接
| System | Integration |
|---|---|
| workflow-orchestrator | End Day auto-captures daily metrics |
| cost-metering | Provides cost data for cost-per-feature |
| git-workflow | Conventional commits enable feat/fix counting |
| agent-teams | Tracks multi-agent session costs |
Deep dive: See ,
reference/metrics-guide.mdreference/report-templates.md| 系统 | 集成方式 |
|---|---|
| workflow-orchestrator | End Day自动捕获每日指标 |
| cost-metering | 提供成本数据用于计算功能成本 |
| git-workflow | 规范提交格式支持feat/fix计数 |
| agent-teams | 跟踪多Agent会话成本 |
深度参考: 详见、
reference/metrics-guide.mdreference/report-templates.md