home / skills / aidotnet / moyucode / git-stats

git-stats skill

/skills/tools/git-stats

This skill analyzes Git repository statistics including commits, contributors, and code changes to help you understand project activity and trends.

npx playbooks add skill aidotnet/moyucode --skill git-stats

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
872 B
---
name: git-stats
description: 分析Git仓库统计信息,包括提交、贡献者和代码变更。
metadata:
  short-description: Git仓库统计
source:
  repository: https://github.com/gitpython-developers/GitPython
  license: BSD-3-Clause
---

# Git Stats Tool

## Description
Analyze Git repository statistics including commit history, contributor activity, and code changes.

## Trigger
- `/git-stats` command
- User needs repository analysis
- User wants commit statistics

## Usage

```bash
# Repository overview
python scripts/git_stats.py

# Contributor stats
python scripts/git_stats.py --contributors

# Commit history
python scripts/git_stats.py --commits --since "2024-01-01"

# File changes
python scripts/git_stats.py --files --top 10
```

## Tags
`git`, `stats`, `repository`, `commits`, `analysis`

## Compatibility
- Codex: ✅
- Claude Code: ✅

Overview

This skill analyzes Git repository statistics to surface commit patterns, contributor activity, and file-level changes. It provides quick summaries and filters so teams and maintainers can understand history, authorship, and recent code churn. The output helps prioritize reviews, audits, and refactoring based on objective repository metrics.

How this skill works

The tool parses the repository commit log, aggregates metrics by author, date range, and file paths, and computes summaries such as commits per contributor, lines added/removed, and most-changed files. It supports filters for time windows, top-N lists, and toggles for commits, contributors, or file-level stats. Results are presented as concise tables and counts that are easy to integrate into CI reports or local analysis scripts.

When to use it

  • When you need a quick overview of recent commit activity or trends in a repo
  • To identify top contributors and measure contribution distribution over time
  • When auditing which files or modules have the most churn before refactoring
  • To generate commit or contributor reports for retrospectives and release notes
  • When validating impact of a time window (e.g., sprint or quarter) on codebase

Best practices

  • Run analyses with an explicit --since/--until date range to reduce noise from legacy history
  • Combine contributor stats with email normalization to correctly group identities
  • Exclude vendor, build artifacts, and generated files to focus on source code changes
  • Use top-N file or path filters to surface the most relevant hotspots quickly
  • Integrate frequent runs into CI or dashboards to track trends instead of one-off checks

Example use cases

  • Generate a contributor leaderboard for the past month to credit work for a release
  • Find the top 10 most-changed files to prioritize a refactor or write tests
  • Produce commit counts per author since a given sprint start for capacity planning
  • Detect spikes in deletions or additions after a major merge to investigate regressions
  • Export commit history summary to include in a project health dashboard

FAQ

Does this analyze remote repositories or only local clones?

It analyzes the Git data available in the local clone. Fetch or clone the remote first to ensure analysis reflects the latest remote state.

Can it distinguish merge commits from regular commits?

Yes. The tool can filter or tag merge commits so you can include or exclude them from summaries.