analyzing-git-sessions

Analyzes git commits and changes within a timeframe or commit range, providing structured summaries for code review, retrospectives, work logs, or session documentation.

16 stars

Best use case

analyzing-git-sessions is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Analyzes git commits and changes within a timeframe or commit range, providing structured summaries for code review, retrospectives, work logs, or session documentation.

Teams using analyzing-git-sessions should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/analyzing-git-sessions/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/cli-automation/analyzing-git-sessions/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/analyzing-git-sessions/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How analyzing-git-sessions Compares

Feature / Agentanalyzing-git-sessionsStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Analyzes git commits and changes within a timeframe or commit range, providing structured summaries for code review, retrospectives, work logs, or session documentation.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Analyzing Git Sessions

## Core Responsibility

Generate structured analysis of git activity for specified timeframe or commit range, including commit history, file changes, statistics, and optional diffs.

## Inputs

Accept from user:

- **Time range**: "last 2 hours", "since 10am", "today", "since 2025-10-23 14:00"
- **Commit range**: "abc123..def456", "HEAD~5..HEAD", "feature-branch..main"
- **Optional filters**: Specific paths, authors, or file types
- **Output depth**: Concise (default), Detailed, or Code Review format

## Working Process

### Step 1: Parse and Validate Input

1. **Determine range type**:
   - Time-based: Parse relative or absolute time
   - Commit-based: Validate commit references exist
   - Branch-based: Resolve branch names to commits

2. **Validate git repository**:

   ```bash
   git rev-parse --git-dir
   ```

3. **Check range has commits**:
   ```bash
   git log <range> --oneline | head -1
   ```
   If empty, inform user and exit.

### Step 2: Extract Commit History

```bash
# Get all commits in range
git log <range> --oneline --no-decorate

# Get detailed commit info
git log <range> --format="%h|%an|%ar|%s" --no-decorate

# Count commits
git log <range> --oneline | wc -l
```

Store commit data for summary.

### Step 3: Generate Statistics

**Overall change statistics**:

```bash
# Summary stats (insertions/deletions by file)
git diff <start>..<end> --stat

# Numeric stats for parsing
git diff <start>..<end> --numstat

# Count total changes
git diff <start>..<end> --shortstat
```

**Author breakdown** (if multiple authors):

```bash
git shortlog <start>..<end> -sn
```

**File categorization**:

- Identify new files (show in status "A")
- Identify deleted files (show in status "D")
- Identify renamed files (show in status "R")
- Modified files with change magnitude

### Step 4: Identify Key Files for Detailed Analysis

**Prioritization rules**:

1. **Large changes** (>100 lines modified): Always include
2. **New files**: Include (especially if >50 lines)
3. **Deleted files**: Note but don't diff
4. **Architecture files**: `build.gradle.kts`, `AndroidManifest.xml`, module configs
5. **Test files**: Flag separately for test coverage assessment

**Extract key file list**:

```bash
# Files changed with line counts
git diff <start>..<end> --numstat | sort -rn -k1 -k2
```

Limit to top 10 files by default to avoid context overflow.

### Step 5: Generate Selective Diffs (Based on Depth)

**Concise mode**: No diffs, stats only

**Detailed mode**: Diffs for top 3-5 key files

```bash
git diff <start>..<end> -- path/to/key/file.kt
```

**Code Review mode**: Diffs for all modified files, grouped by module

```bash
# Group by directory
git diff <start>..<end> --name-only | cut -d'/' -f1-2 | sort -u

# Generate diffs per module
for module in modules; do
  git diff <start>..<end> -- $module/
done
```

**Context overflow protection**:

- If >10 files changed significantly, limit to top 5 diffs
- Warn user: "Showing top 5 files by change size. Request specific files for full diffs."

### Step 6: Present Structured Summary

**Format based on depth**:

#### Concise Summary

```markdown
## Git Session Summary

**Range**: <start-commit> to <end-commit> (<timeframe>)
**Commits**: X commits by Y author(s)
**Files Changed**: A modified, B added, C deleted
**Net Changes**: +X -Y lines

### Commits

- abc123 Commit message 1
- def456 Commit message 2
  ...

### Top Files Changed

1. path/to/file1.kt (+50 -20)
2. path/to/file2.kt (+30 -15)
   ...
```

#### Detailed Summary

Includes:

- Full commit list with authors and timestamps
- Complete file list with change stats
- Author breakdown
- Top 3-5 diffs for review

#### Code Review Format

```markdown
## Code Review Summary

### Overview

- **PR Title**: [Suggested from commit messages]
- **Changes**: X files across Y modules
- **Scope**: [Inferred from changed files]

### Commits

[Formatted commit list suitable for PR description]

### Changes by Module

**Module: app**

- file1.kt: Description of changes
- file2.kt: Description of changes

**Module: core**
...

### Key Changes

[Diffs for significant modifications]

### Test Coverage

- Test files modified: X
- New tests added: ~Y
```

## Output Guidelines

### Commit Messages

- Show short hash (7 chars)
- Show first line of commit message only
- Truncate long messages to 80 chars
- Group by author if multiple contributors

### File Paths

- Use relative paths from repo root
- Format as code: `path/to/file.kt`
- Include line change magnitude: (+X -Y)
- Highlight file type (source, test, config)

### Statistics

Present in clear tables:

```markdown
| Metric        | Count |
| ------------- | ----- |
| Commits       | 15    |
| Files Changed | 23    |
| Insertions    | +450  |
| Deletions     | -180  |
```

### Diffs

- Include file path as header: `### path/to/file.kt`
- Use code blocks with syntax highlighting
- Show context lines (git default: 3 lines before/after)
- Truncate very large diffs (>200 lines) with summary

## Context Budget Management

**Monitor diff sizes**:

- Small session (<10 files, <500 lines): Safe for detailed mode
- Medium session (10-30 files, 500-2000 lines): Use selective diffs
- Large session (>30 files, >2000 lines): Concise mode with warnings

**Progressive disclosure**:

1. Always start with concise summary
2. Ask user: "Would you like detailed diffs for specific files?"
3. Generate diffs on demand rather than upfront

**Fallback for large sessions**:
"This session modified 45 files with 5000+ line changes. Showing concise summary. Request specific files or modules for detailed diffs."

## Anti-Patterns to Avoid

**Don't**:

- Generate diffs for all files in large sessions (context overflow)
- Include full diffs without asking (waste context on unneeded details)
- Ignore file types (treat test changes same as source changes)
- Lose context on what user wants to know
- Use generic summaries ("modified 10 files") without specifics

**Do**:

- Ask user what level of detail they need
- Prioritize key files by change magnitude
- Categorize files (source, test, config, docs)
- Provide actionable summaries
- Offer to drill down on specific files

## Success Criteria

A good git session analysis should:

1. **Inform**: User understands scope of changes at a glance
2. **Focus**: Highlights most significant changes first
3. **Actionable**: Provides paths and diffs for deeper review
4. **Efficient**: Doesn't waste context on unnecessary details
5. **Adaptable**: Adjusts depth based on session size and user needs

## Example Outputs

See `contexts/example-outputs.md` for detailed examples of concise summaries and code review formats.

Related Skills

codex-sessions-skill-scan

16
from diegosouzapw/awesome-omni-skill

Daily skill health scan: analyze ~/.codex/sessions plus per-repo session logs under ~/dev (default last 1 day) and summarize skill invocations + likely failures for personal skills in ~/dev/agent-skills (missing paths, tool failures, complex-task word triggers). Optional: include best-effort local OTel signals.

analyzing-innovation-portfolio

16
from diegosouzapw/awesome-omni-skill

Analyze the CustomGPT.ai Labs Innovation workbook and cost tracking data to surface portfolio-level insights, trends, and recommendations for where to focus Innovation efforts.

analyzing-data

16
from diegosouzapw/awesome-omni-skill

Queries data warehouse and answers business questions about data. Handles questions requiring database/warehouse queries including "who uses X", "how many Y", "show me Z", "find customers", "what is the count", data lookups, metrics, trends, or SQL analysis.

analyzing-auto-insurance-data

16
from diegosouzapw/awesome-omni-skill

Analyzes vehicle insurance daily reports and signing lists. Use when user asks to analyze insurance data, generate business reports, check institution performance, monitor policy trends, or detect business anomalies. Handles Excel/CSV files with fields like premium, institution, customer type, and renewal status.

analyzing-new-energy-trucks

16
from diegosouzapw/awesome-omni-skill

分析新能源货车保险业务数据,识别高风险机构和业务类型。在处理新能源货车承保数据、风险评估报告或制定承保策略时使用。

analyzing-branches

16
from diegosouzapw/awesome-omni-skill

Use when analyzing another branch's iteration journals to extract findings, decisions, and insights from divergent work

analyzing-branch-status

16
from diegosouzapw/awesome-omni-skill

Use when user wants detailed status report for single autonomy branch including iteration timeline and metrics progression

analyzing-tdigest-metrics

16
from diegosouzapw/awesome-omni-skill

Analyze percentile metrics (tdigest type) using OPAL for latency analysis and SLO tracking. Use when calculating p50, p95, p99 from pre-aggregated duration or latency metrics. Covers the critical double-combine pattern with align + m_tdigest() + tdigest_combine + aggregate. For simple metrics (counts, averages), see aggregating-gauge-metrics skill.

analyzing-protocols

16
from diegosouzapw/awesome-omni-skill

Analyzes network protocol implementations to identify parsing vulnerabilities, state machine issues, and protocol-level security problems. Use when analyzing network servers, protocol handlers, or investigating protocol implementation bugs.

analyzing-projects

16
from diegosouzapw/awesome-omni-skill

Analyzes codebases to understand structure, tech stack, patterns, and conventions. Use when onboarding to a new project, exploring unfamiliar code, or when asked "how does this work?" or "what's the architecture?"

analyzing-apm-data

16
from diegosouzapw/awesome-omni-skill

Monitor application performance using the RED methodology (Rate, Errors, Duration) with Observe. Use when analyzing service health, investigating errors, tracking latency, or building APM dashboards. Covers when to use metrics vs spans, combining RED signals, and troubleshooting workflows. Cross-references working-with-intervals, aggregating-gauge-metrics, and analyzing-tdigest-metrics skills.

analyzing-test-coverage

16
from diegosouzapw/awesome-omni-skill

Creates and analyzes tests using Vitest and MSW patterns. Generates test builders, mocks repositories, and configures integration tests. Triggers on: write tests, test coverage, Vitest, MSW mock, vi.fn, vi.mock, unit test, integration test, test builder, mock setup, test failure.