diff --git a/retro/SKILL.md b/retro/SKILL.md index f1e92c20..e7eba621 100644 --- a/retro/SKILL.md +++ b/retro/SKILL.md @@ -24,6 +24,16 @@ _UPD=$(~/.claude/skills/gstack/bin/gstack-update-check 2>/dev/null || .claude/sk If output shows `UPGRADE_AVAILABLE `: read `~/.claude/skills/gstack/gstack-upgrade/SKILL.md` and follow the "Inline upgrade flow" (auto-upgrade if configured, otherwise AskUserQuestion with 4 options, write snooze state if declined). If `JUST_UPGRADED `: tell user "Running gstack v{to} (just updated!)" and continue. +## Detect default branch + +Before gathering data, detect the repo's default branch name: +`gh repo view --json defaultBranchRef -q .defaultBranchRef.name` + +If this fails, fall back to `main`. Use the detected name wherever the instructions +say `origin/` below. + +--- + # /retro — Weekly Engineering Retrospective Generates a comprehensive engineering retrospective analyzing commit history, work patterns, and code quality metrics. Team-aware: identifies the user running the command, then analyzes every contributor with per-person praise and growth opportunities. Designed for a senior IC/CTO-level builder using Claude Code as a force multiplier. @@ -58,7 +68,7 @@ Usage: /retro [window] First, fetch origin and identify the current user: ```bash -git fetch origin main --quiet +git fetch origin --quiet # Identify who is running the retro git config user.name git config user.email @@ -70,28 +80,28 @@ Run ALL of these git commands in parallel (they are independent): ```bash # 1. All commits in window with timestamps, subject, hash, AUTHOR, files changed, insertions, deletions -git log origin/main --since="" --format="%H|%aN|%ae|%ai|%s" --shortstat +git log origin/ --since="" --format="%H|%aN|%ae|%ai|%s" --shortstat # 2. Per-commit test vs total LOC breakdown with author # Each commit block starts with COMMIT:|, followed by numstat lines. # Separate test files (matching test/|spec/|__tests__/) from production files. -git log origin/main --since="" --format="COMMIT:%H|%aN" --numstat +git log origin/ --since="" --format="COMMIT:%H|%aN" --numstat # 3. Commit timestamps for session detection and hourly distribution (with author) # Use TZ=America/Los_Angeles for Pacific time conversion -TZ=America/Los_Angeles git log origin/main --since="" --format="%at|%aN|%ai|%s" | sort -n +TZ=America/Los_Angeles git log origin/ --since="" --format="%at|%aN|%ai|%s" | sort -n # 4. Files most frequently changed (hotspot analysis) -git log origin/main --since="" --format="" --name-only | grep -v '^$' | sort | uniq -c | sort -rn +git log origin/ --since="" --format="" --name-only | grep -v '^$' | sort | uniq -c | sort -rn # 5. PR numbers from commit messages (extract #NNN patterns) -git log origin/main --since="" --format="%s" | grep -oE '#[0-9]+' | sed 's/^#//' | sort -n | uniq | sed 's/^/#/' +git log origin/ --since="" --format="%s" | grep -oE '#[0-9]+' | sed 's/^#//' | sort -n | uniq | sed 's/^/#/' # 6. Per-author file hotspots (who touches what) -git log origin/main --since="" --format="AUTHOR:%aN" --name-only +git log origin/ --since="" --format="AUTHOR:%aN" --name-only # 7. Per-author commit counts (quick summary) -git shortlog origin/main --since="" -sn --no-merges +git shortlog origin/ --since="" -sn --no-merges # 8. Greptile triage history (if available) cat ~/.gstack/greptile-history.md 2>/dev/null || true @@ -250,14 +260,14 @@ If the time window is 14 days or more, split into weekly buckets and show trends ### Step 11: Streak Tracking -Count consecutive days with at least 1 commit to origin/main, going back from today. Track both team streak and personal streak: +Count consecutive days with at least 1 commit to origin/, going back from today. Track both team streak and personal streak: ```bash # Team streak: all unique commit dates (Pacific time) — no hard cutoff -TZ=America/Los_Angeles git log origin/main --format="%ad" --date=format:"%Y-%m-%d" | sort -u +TZ=America/Los_Angeles git log origin/ --format="%ad" --date=format:"%Y-%m-%d" | sort -u # Personal streak: only the current user's commits -TZ=America/Los_Angeles git log origin/main --author="" --format="%ad" --date=format:"%Y-%m-%d" | sort -u +TZ=America/Los_Angeles git log origin/ --author="" --format="%ad" --date=format:"%Y-%m-%d" | sort -u ``` Count backward from today — how many consecutive days have at least one commit? This queries the full history so streaks of any length are reported accurately. Display both: @@ -475,7 +485,7 @@ When the user runs `/retro compare` (or `/retro compare 14d`): ## Important Rules - ALL narrative output goes directly to the user in the conversation. The ONLY file written is the `.context/retros/` JSON snapshot. -- Use `origin/main` for all git queries (not local main which may be stale) +- Use `origin/` for all git queries (not local main which may be stale) - Convert all timestamps to Pacific time for display (use `TZ=America/Los_Angeles`) - If the window has zero commits, say so and suggest a different window - Round LOC/hour to nearest 50 diff --git a/retro/SKILL.md.tmpl b/retro/SKILL.md.tmpl index 2de8d5c6..b2637660 100644 --- a/retro/SKILL.md.tmpl +++ b/retro/SKILL.md.tmpl @@ -15,6 +15,16 @@ allowed-tools: {{UPDATE_CHECK}} +## Detect default branch + +Before gathering data, detect the repo's default branch name: +`gh repo view --json defaultBranchRef -q .defaultBranchRef.name` + +If this fails, fall back to `main`. Use the detected name wherever the instructions +say `origin/` below. + +--- + # /retro — Weekly Engineering Retrospective Generates a comprehensive engineering retrospective analyzing commit history, work patterns, and code quality metrics. Team-aware: identifies the user running the command, then analyzes every contributor with per-person praise and growth opportunities. Designed for a senior IC/CTO-level builder using Claude Code as a force multiplier. @@ -49,7 +59,7 @@ Usage: /retro [window] First, fetch origin and identify the current user: ```bash -git fetch origin main --quiet +git fetch origin --quiet # Identify who is running the retro git config user.name git config user.email @@ -61,28 +71,28 @@ Run ALL of these git commands in parallel (they are independent): ```bash # 1. All commits in window with timestamps, subject, hash, AUTHOR, files changed, insertions, deletions -git log origin/main --since="" --format="%H|%aN|%ae|%ai|%s" --shortstat +git log origin/ --since="" --format="%H|%aN|%ae|%ai|%s" --shortstat # 2. Per-commit test vs total LOC breakdown with author # Each commit block starts with COMMIT:|, followed by numstat lines. # Separate test files (matching test/|spec/|__tests__/) from production files. -git log origin/main --since="" --format="COMMIT:%H|%aN" --numstat +git log origin/ --since="" --format="COMMIT:%H|%aN" --numstat # 3. Commit timestamps for session detection and hourly distribution (with author) # Use TZ=America/Los_Angeles for Pacific time conversion -TZ=America/Los_Angeles git log origin/main --since="" --format="%at|%aN|%ai|%s" | sort -n +TZ=America/Los_Angeles git log origin/ --since="" --format="%at|%aN|%ai|%s" | sort -n # 4. Files most frequently changed (hotspot analysis) -git log origin/main --since="" --format="" --name-only | grep -v '^$' | sort | uniq -c | sort -rn +git log origin/ --since="" --format="" --name-only | grep -v '^$' | sort | uniq -c | sort -rn # 5. PR numbers from commit messages (extract #NNN patterns) -git log origin/main --since="" --format="%s" | grep -oE '#[0-9]+' | sed 's/^#//' | sort -n | uniq | sed 's/^/#/' +git log origin/ --since="" --format="%s" | grep -oE '#[0-9]+' | sed 's/^#//' | sort -n | uniq | sed 's/^/#/' # 6. Per-author file hotspots (who touches what) -git log origin/main --since="" --format="AUTHOR:%aN" --name-only +git log origin/ --since="" --format="AUTHOR:%aN" --name-only # 7. Per-author commit counts (quick summary) -git shortlog origin/main --since="" -sn --no-merges +git shortlog origin/ --since="" -sn --no-merges # 8. Greptile triage history (if available) cat ~/.gstack/greptile-history.md 2>/dev/null || true @@ -241,14 +251,14 @@ If the time window is 14 days or more, split into weekly buckets and show trends ### Step 11: Streak Tracking -Count consecutive days with at least 1 commit to origin/main, going back from today. Track both team streak and personal streak: +Count consecutive days with at least 1 commit to origin/, going back from today. Track both team streak and personal streak: ```bash # Team streak: all unique commit dates (Pacific time) — no hard cutoff -TZ=America/Los_Angeles git log origin/main --format="%ad" --date=format:"%Y-%m-%d" | sort -u +TZ=America/Los_Angeles git log origin/ --format="%ad" --date=format:"%Y-%m-%d" | sort -u # Personal streak: only the current user's commits -TZ=America/Los_Angeles git log origin/main --author="" --format="%ad" --date=format:"%Y-%m-%d" | sort -u +TZ=America/Los_Angeles git log origin/ --author="" --format="%ad" --date=format:"%Y-%m-%d" | sort -u ``` Count backward from today — how many consecutive days have at least one commit? This queries the full history so streaks of any length are reported accurately. Display both: @@ -466,7 +476,7 @@ When the user runs `/retro compare` (or `/retro compare 14d`): ## Important Rules - ALL narrative output goes directly to the user in the conversation. The ONLY file written is the `.context/retros/` JSON snapshot. -- Use `origin/main` for all git queries (not local main which may be stale) +- Use `origin/` for all git queries (not local main which may be stale) - Convert all timestamps to Pacific time for display (use `TZ=America/Los_Angeles`) - If the window has zero commits, say so and suggest a different window - Round LOC/hour to nearest 50