From rkstack
Weekly engineering retrospective. Analyzes commit history, work patterns, and code quality metrics. Supports time windows: /retro [24h|7d|14d|30d]. Tracks trends across retros. Use for team health, focus scoring, and identifying hotspots.
npx claudepluginhub mrkhachaturov/ccode-personal-plugins --plugin rkstackThis skill is limited to using the following tools:
<!-- AUTO-GENERATED from SKILL.md.tmpl — do not edit directly -->
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Guides TDD-style skill creation: pressure scenarios as tests, baseline agent failures, write docs to enforce compliance, verify with RED-GREEN-REFACTOR.
# === RKstack Preamble (retro) ===
# Read detection cache (written by session-start via rkstack detect)
if [ -f .rkstack/settings.json ]; then
cat .rkstack/settings.json
else
echo "WARNING: .rkstack/settings.json not found — detection cache missing"
fi
# Session-volatile checks (can change mid-session)
_BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
_HAS_CLAUDE_MD=$([ -f CLAUDE.md ] && echo "yes" || echo "no")
echo "BRANCH: $_BRANCH"
echo "CLAUDE_MD: $_HAS_CLAUDE_MD"
Use the detection cache and preamble output to adapt your behavior:
detection.flowType (web or default). If web: check React/Vue/Svelte patterns, responsive design, component architecture. If default: CLI tools, MCP servers, backend scripts.just commands instead of raw shell.detection.stack for what's in the project and detection.stats for scale (files, code, complexity).detection.repoMode for solo vs collaborative.detection.services for Supabase and other service integrations.ALWAYS follow this structure for every AskUserQuestion call:
_BRANCH value from preamble — NOT any branch from conversation history or gitStatus), and the current plan/task. (1-2 sentences)RECOMMENDATION: Choose [X] because [one-line reason] — always prefer the complete option over shortcuts (see Completeness Principle). Include Completeness: X/10 for each option. Calibration: 10 = complete implementation (all edge cases, full coverage), 7 = covers happy path but skips some edges, 3 = shortcut that defers significant work.A) ... B) ... C) ... — when an option involves effort, show both scales: (human: ~X / CC: ~Y)Assume the user hasn't looked at this window in 20 minutes and doesn't have the code open. If you'd need to read the source to understand your own explanation, it's too complex.
AI makes completeness near-free. Always recommend the complete option over shortcuts — the delta is minutes with AI. A "lake" (100% coverage, all edge cases) is boilable; an "ocean" (full rewrite, multi-quarter migration) is not. Boil lakes, flag oceans.
Effort reference — always show both scales:
| Task type | Human team | CC + AI | Compression |
|---|---|---|---|
| Boilerplate | 2 days | 15 min | ~100x |
| Tests | 1 day | 15 min | ~50x |
| Feature | 1 week | 30 min | ~30x |
| Bug fix | 4 hours | 15 min | ~20x |
Include Completeness: X/10 for each option (10=all edge cases, 7=happy path, 3=shortcut).
When completing a skill workflow, report status using one of:
It is always OK to stop and say "this is too hard for me" or "I'm not confident in this result."
Bad work is worse than no work. You will not be penalized for escalating.
Escalation format:
STATUS: BLOCKED | NEEDS_CONTEXT
REASON: [1-2 sentences]
ATTEMPTED: [what you tried]
RECOMMENDATION: [what the user should do next]
Parse the following: $ARGUMENTS
If no arguments provided, default to 7d (last 7 days).
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.
When the user types /retro, run this skill.
/retro — default: last 7 days/retro 24h — last 24 hours/retro 14d — last 14 days/retro 30d — last 30 days/retro compare — compare current window vs prior same-length window/retro compare 14d — compare with explicit windowParse the argument to determine the time window. Default to 7 days if no argument given. All times should be reported in the user's local timezone (use the system default — do NOT set TZ).
Midnight-aligned windows: For day (d) and week (w) units, compute an absolute start date at local midnight, not a relative string. For example, if today is 2026-03-27 and the window is 7 days: the start date is 2026-03-20. Use --since="2026-03-20T00:00:00" for git log queries — the explicit T00:00:00 suffix ensures git starts from midnight. Without it, git uses the current wall-clock time (e.g., --since="2026-03-20" at 11pm means 11pm, not midnight). For week units, multiply by 7 to get days (e.g., 2w = 14 days back). For hour (h) units, use --since="N hours ago" since midnight alignment does not apply to sub-day windows.
Argument validation: If the argument doesn't match a number followed by d, h, or w, or the word compare (optionally followed by a window), show this usage and stop:
Usage: /retro [window | compare]
/retro — last 7 days (default)
/retro 24h — last 24 hours
/retro 14d — last 14 days
/retro 30d — last 30 days
/retro compare — compare this period vs prior period
/retro compare 14d — compare with explicit window
First, fetch origin and identify the current user and default branch:
# Detect default branch
DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's|refs/remotes/origin/||')
[ -z "$DEFAULT_BRANCH" ] && DEFAULT_BRANCH=$(git branch -r | grep -E 'origin/(main|master)' | head -1 | sed 's|.*origin/||' | tr -d ' ')
[ -z "$DEFAULT_BRANCH" ] && DEFAULT_BRANCH="main"
echo "DEFAULT_BRANCH: $DEFAULT_BRANCH"
git fetch origin "$DEFAULT_BRANCH" --quiet
# Identify who is running the retro
git config user.name
git config user.email
The name returned by git config user.name is "you" — the person reading this retro. All other authors are teammates. Use this to orient the narrative: "your" commits vs teammate contributions.
Run ALL of these git commands in parallel (they are independent):
# 1. All commits in window with timestamps, subject, hash, author, files changed, insertions, deletions
git log origin/<default> --since="<window>" --format="%H|%aN|%ae|%ai|%s" --shortstat
# 2. Per-commit test vs total LOC breakdown with author
# Each commit block starts with COMMIT:<hash>|<author>, followed by numstat lines.
# Separate test files (matching test/|spec/|__tests__/) from production files.
git log origin/<default> --since="<window>" --format="COMMIT:%H|%aN" --numstat
# 3. Commit timestamps for session detection and hourly distribution (with author)
git log origin/<default> --since="<window>" --format="%at|%aN|%ai|%s" | sort -n
# 4. Files most frequently changed (hotspot analysis)
git log origin/<default> --since="<window>" --format="" --name-only | grep -v '^$' | sort | uniq -c | sort -rn
# 5. PR/MR numbers from commit messages (GitHub #NNN, GitLab !NNN)
git log origin/<default> --since="<window>" --format="%s" | grep -oE '[#!][0-9]+' | sort -t'#' -k1 | uniq
# 6. Per-author file hotspots (who touches what)
git log origin/<default> --since="<window>" --format="AUTHOR:%aN" --name-only
# 7. Per-author commit counts (quick summary)
git shortlog origin/<default> --since="<window>" -sn --no-merges
# 8. TODOS.md backlog (if available)
cat TODOS.md 2>/dev/null || true
# 9. Test file count
find . -name '*.test.*' -o -name '*.spec.*' -o -name '*_test.*' -o -name '*_spec.*' 2>/dev/null | grep -v node_modules | wc -l
# 10. Test files changed in window
git log origin/<default> --since="<window>" --format="" --name-only | grep -E '\.(test|spec)\.' | sort -u | wc -l
If gh CLI is available, also gather PR data:
# PR count in window (if gh is available)
gh pr list --state merged --base <default> --search "merged:>=<start-date>" --json number,title,additions,deletions --limit 100 2>/dev/null || echo "GH_UNAVAILABLE"
Calculate and present these metrics in a summary table:
| Metric | Value |
|---|---|
| Commits to main | N |
| Contributors | N |
| PRs merged | N |
| Total insertions | N |
| Total deletions | N |
| Net LOC added | N |
| Test LOC (insertions) | N |
| Test LOC ratio | N% |
| Version range | vX.Y.Z → vX.Y.Z |
| Active days | N |
| Detected sessions | N |
| Avg LOC/session-hour | N |
| Test Health | N total tests, M changed this period |
Then show a per-author leaderboard immediately below:
Contributor Commits +/- Top area
You (name) 32 +2400/-300 src/
alice 12 +800/-150 lib/
bob 3 +120/-40 tests/
Sort by commits descending. The current user (from git config user.name) always appears first, labeled "You (name)".
Backlog Health (if TODOS.md exists): Read TODOS.md (fetched in Step 1, command 8). Compute:
## Completed section)Include in the metrics table:
| Backlog Health | N open (X high-priority) · Z completed this period |
If TODOS.md doesn't exist, skip the Backlog Health row.
Show hourly histogram in local time using bar chart:
Hour Commits ________________
00: 4 ||||
07: 5 |||||
...
Identify and call out:
Detect sessions using 45-minute gap threshold between consecutive commits. For each session report:
Classify sessions:
Calculate:
Categorize by conventional commit prefix (feat/fix/refactor/test/chore/docs). Show as percentage bar:
feat: 20 (40%) ||||||||||||||||||||
fix: 27 (54%) |||||||||||||||||||||||||||
refactor: 2 ( 4%) ||
Flag if fix ratio exceeds 50% — this signals a "ship fast, fix fast" pattern that may indicate review gaps.
Show top 10 most-changed files. Flag:
Focus score: Calculate the percentage of commits touching the single most-changed top-level directory (e.g., src/, lib/). Higher score = deeper focused work. Lower score = scattered context-switching. Report as: "Focus score: 62% (src/)"
Ship of the week: Auto-identify the single highest-LOC PR (or commit group) in the window. Highlight it:
If collaborative repo (REPO_MODE from preamble is collaborative):
For each contributor (including the current user), compute:
For the current user ("You"): This section gets the deepest treatment. Include all the detail from the solo retro — session analysis, time patterns, focus score. Frame it in first person: "Your peak hours...", "Your biggest ship..."
For each teammate: Write 2-3 sentences covering what they worked on and their pattern. Then:
If solo repo: Skip the team breakdown and proceed to personal insights only — the retro is personal.
If there are Co-Authored-By trailers: Parse Co-Authored-By: lines in commit messages. Credit those authors for the commit alongside the primary author. Note AI co-authors (e.g., noreply@anthropic.com) but do not include them as team members — instead, track "AI-assisted commits" as a separate metric.
Before saving the new snapshot, check for prior retro history:
setopt +o nomatch 2>/dev/null || true # zsh compat
ls -t .context/retros/*.json 2>/dev/null
If prior retros exist: Load the most recent one using the Read tool. Calculate deltas for key metrics and include a Trends vs Last Retro section:
Last Now Delta
Test ratio: 22% -> 41% +19pp
Sessions: 10 -> 14 +4
LOC/hour: 200 -> 350 +75%
Fix ratio: 54% -> 30% -24pp (improving)
Commits: 32 -> 47 +47%
Deep sessions: 3 -> 5 +2
If no prior retros exist: Skip the comparison section and append: "First retro recorded — run again next week to see trends."
Save a JSON snapshot:
mkdir -p .context/retros
Determine the next sequence number for today:
setopt +o nomatch 2>/dev/null || true # zsh compat
today=$(date +%Y-%m-%d)
existing=$(ls .context/retros/${today}-*.json 2>/dev/null | wc -l | tr -d ' ')
next=$((existing + 1))
# Save as .context/retros/${today}-${next}.json
Use the Write tool to save the JSON file with this schema:
{
"date": "2026-03-27",
"window": "7d",
"metrics": {
"commits": 47,
"contributors": 3,
"prs_merged": 12,
"insertions": 3200,
"deletions": 800,
"net_loc": 2400,
"test_loc": 1300,
"test_ratio": 0.41,
"active_days": 6,
"sessions": 14,
"deep_sessions": 5,
"avg_session_minutes": 42,
"loc_per_session_hour": 350,
"feat_pct": 0.40,
"fix_pct": 0.30,
"peak_hour": 22,
"ai_assisted_commits": 32
},
"authors": {
"Alice": { "commits": 32, "insertions": 2400, "deletions": 300, "test_ratio": 0.41, "top_area": "src/" },
"Bob": { "commits": 12, "insertions": 800, "deletions": 150, "test_ratio": 0.35, "top_area": "lib/" }
},
"version_range": ["1.0.0", "1.2.0"],
"tweetable": "Week of Mar 20: 47 commits (3 contributors), 3.2k LOC, 38% tests, 12 PRs, peak: 10pm"
}
Note: Only include the backlog field if TODOS.md exists. Only include the test_health field if test files were found (command 9 returns > 0). If either has no data, omit the field entirely.
Include test health data in the JSON when test files exist:
"test_health": {
"total_test_files": 47,
"test_files_changed": 8
}
Include backlog data in the JSON when TODOS.md exists:
"backlog": {
"total_open": 28,
"high_priority": 2,
"completed_this_period": 3,
"added_this_period": 1
}
Write the narrative — structure the output as:
Tweetable summary (first line, before everything else):
Week of Mar 20: 47 commits (3 contributors), 3.2k LOC, 38% tests, 12 PRs, peak: 10pm
(from Step 2)
(from Step 9, loaded before save — skip if first retro)
(from Steps 3-4)
Narrative interpreting what the patterns mean:
(from Steps 5-6)
Narrative covering:
test_health: show delta "Test count: {last} -> {now} (+{delta})"(from Step 7)
(from Step 8, for the current user only)
This is the section the user cares most about. Include:
(from Step 8, for each teammate — skip if solo repo)
For each teammate (sorted by commits descending), write a section:
AI collaboration note: If many commits have Co-Authored-By AI trailers (e.g., Claude, Copilot), note the AI-assisted commit percentage as a team metric. Frame it neutrally — "N% of commits were AI-assisted" — without judgment.
Identify the 3 highest-impact things shipped in the window. For each:
Specific, actionable, anchored in actual commits. Mix personal and team-level suggestions. Phrase as "to get even better..."
Small, practical, realistic. Each must be something that takes <5 minutes to adopt. At least one should be team-oriented if collaborative repo.
When the user runs /retro compare (or /retro compare 14d):
--since and --until with midnight-aligned dates to avoid overlap.context/retros/ (same as a normal retro run); do not persist the prior-window metrics.context/retros/ JSON snapshot).context/retros/ JSON snapshot.origin/<default> for all git queries (not local main which may be stale)TZ)