AgentSkillsCN

session-analyzer

Analyzes git changes and creates retrospective drafts with Before/After context.

SKILL.md
--- frontmatter
name: session-analyzer
description: Analyzes git changes and creates retrospective drafts with Before/After context.
context: fork
user-invocable: false

Session Analyzer

Agent สำหรับวิเคราะห์ session และสร้าง retrospective draft พร้อม Before/After context

Purpose

  • วิเคราะห์ git changes ของ session
  • สร้าง retrospective draft อัตโนมัติ
  • Extract Before/After context
  • ระบุ type และ tags
  • เตรียม input สำหรับ /td

When to Use

  • ก่อนใช้ /td command
  • จบ coding session
  • เมื่อต้องการสรุป session
  • Auto-capture trigger

Instructions

Step 1: Gather Session Context

bash
export TZ='Asia/Bangkok'

echo "=== Session Info ==="
echo "Date: $(date '+%Y-%m-%d')"
echo "Time: $(date '+%H:%M:%S')"
echo "Branch: $(git branch --show-current)"

echo "=== Current Focus ==="
cat docs/current.md 2>/dev/null || echo "No focus set"

Step 2: Analyze Git Changes

bash
echo "=== Changed Files ==="
git diff --name-only HEAD

echo "=== Staged Files ==="
git diff --cached --name-only

echo "=== Diff Stats ==="
git diff --stat HEAD

echo "=== Recent Commits (this session) ==="
git log --oneline -10 --since="4 hours ago"

Step 3: Determine Session Type

TypeIndicators
featureNew files, new functionality
bugfixFix in existing code, test additions
refactorCode restructure, no behavior change
docsOnly .md files changed
configConfig files, build scripts
testOnly test files added/changed
decisionArchitecture changes, new patterns

Step 4: Extract Before/After Context

Before Context:

  • What problem existed?
  • What was the previous behavior?
  • What metrics/state before?

After Context:

  • What solution was applied?
  • What is the new behavior?
  • What metrics/state after?

Step 5: Identify Key Insights

From the changes, extract:

  • Technical decisions made
  • Patterns discovered
  • Gotchas encountered
  • Lessons learned

Step 6: Generate Tags

Analyze changes for:

  • Technologies used
  • Problem domains
  • Patterns applied
  • Tools involved

Output Format

markdown
## Session Analysis

**Date:** YYYY-MM-DD HH:MM:SS (Asia/Bangkok)
**Branch:** branch-name
**Duration:** ~Xh (estimated from commits)

---

### Classification

| Field | Value |
|-------|-------|
| Type | feature/bugfix/refactor/etc |
| Status | completed/pending/blocked |
| Complexity | low/medium/high |

**Tags:** tag1, tag2, tag3

---

### Summary

[2-3 sentence summary of what was accomplished]

---

### Context: Before

- **Problem:** What issue or need existed
- **Existing Behavior:** How it worked before
- **Pain Points:** What wasn't working well

---

### Context: After

- **Solution:** What was implemented
- **New Behavior:** How it works now
- **Improvements:** What's better

---

### Changes Overview

| Metric | Count |
|--------|-------|
| Files changed | X |
| Files added | Y |
| Files deleted | Z |
| Lines added | +N |
| Lines removed | -M |

---

### Key Insights

1. **Technical:** [insight about code/architecture]
2. **Process:** [insight about workflow]
3. **Gotcha:** [something to watch out for]

---

### Decisions Made

| Decision | Options Considered | Chosen | Rationale |
|----------|-------------------|--------|-----------|
| [decision] | A, B, C | B | [why] |

---

### Follow-up Items

- [ ] Item that needs attention later
- [ ] Improvement for future