Index of every page on this site: llms.txt
All skills
wghust avatar

/git-intelligence

@e591e3f
by wghustwghust/stark-skills5 stars
Run it yourself

AI-powered git repository analysis. Summarizes commits, generates release notes, analyzes PR risk, detects risky changes, and maps code impact — no installation required. AI 驱动的 git 仓库分析。汇总提交、生成 Release Notes、分析 PR 风险、检测高危变更、映射代码影响范围。零安装,安装即用。

Use this Skill: https://skilld.dev/gh/wghust/stark-skills/git-intelligence

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

git-commands.md

≈1.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

git-intelligence: Command Reference

Agent-internal reference for git commands used by each capability. All commands are read-only and do not modify the repository.


Repository Health Check

git rev-parse --git-dir
# ✅ Returns: .git (or path to git dir)
# ❌ Fails:   not a git repository (or any of the parent directories)

Base Branch Detection

git symbolic-ref refs/remotes/origin/HEAD
# ✅ Returns: refs/remotes/origin/main  → extract "main"
# ✅ Returns: refs/remotes/origin/master → extract "master"
# ❌ Fails:   no upstream configured → fallback to "master"

summarize-commits

Duration → ISO date conversion

Input Formula
7d today − 7 days
2w today − 14 days
1mo today − 1 month
2024-01-15 use as-is

Collect commits

git log --since="2024-06-01" --oneline --no-merges
# Output format: <short-hash> <subject>
# Example:
#   a1b2c3d feat: add SSR fallback
#   e4f5a6b fix: resolve login redirect

Edge cases

# Empty result = no commits in range
git log --since="2030-01-01" --oneline --no-merges
# (returns nothing)

# Check total commit count
git rev-list --count HEAD
# 0 = empty repository

release-notes

Verify tags exist

git rev-parse --verify refs/tags/v1.2.0
# ✅ Returns: commit hash
# ❌ Fails:   fatal: Needed a single revision

git tag -l
# List all available tags (show when tag not found)

Collect commits between tags

git log v1.2.0..v1.3.0 --oneline --no-merges
# Note: v1.2.0 commits are EXCLUDED, v1.3.0 commits are INCLUDED

analyze-pr / detect-risk / change-impact

Get diff statistics (per-file line counts)

git diff master...feature/my-feature --numstat
# Output format (tab-separated): <added> <removed> <filepath>
# Example:
#   45    12    src/auth/login.ts
#   8     3     src/utils/helpers.ts
#   -     -     assets/logo.png     ← binary file (ignore)

Note: Use three-dot ... syntax (merge base diff), not two-dot .. (direct diff).

Count changed files and lines

git diff master...feature/my-feature --shortstat
# Example: 12 files changed, 340 insertions(+), 89 deletions(-)

List changed file paths only

git diff master...feature/my-feature --name-only

Sensitive path detection

Check if any changed file path contains:

  • auth/ — authentication module
  • payment/ — payment processing
  • infra/ — infrastructure / deployment
  • middleware/ — request middleware
  • cache/ — caching layer

suggest-reviewers (part of analyze-pr)

Run blame on changed files (up to 5 files)

git blame --porcelain -- src/auth/login.ts
# Output: one header block per blamed line
# Key lines to parse:
#   <40-char commit hash> <orig-line> <final-line> <line-count>
#   author John Doe
#   author-mail <john@example.com>
#   ...
#   <tab><line content>

Parsing logic

  1. For each line starting with a 40-char hex hash: a new blame entry starts
  2. Parse author <name> (not author-mail, author-time, etc.)
  3. Parse author-mail <email@domain> → strip <> → use as unique key
  4. Skip author-mail <not.committed.yet> (uncommitted changes)
  5. Count entries per email → rank by count → take top 3 display names

Fallback roles for sensitive paths

Path contains Role label
auth/ or payment/ "security team"
infra/ "infra team"
middleware/ "backend team"
cache/ "infrastructure team"

Apply fallbacks only when fewer than 2 distinct blame authors are found.


Risk Scoring Reference

score = 1  (base)
+ 3  if total files changed > 50
+ 3  if total lines changed (added + removed) > 1000
+ 2  per unique sensitive folder touched (max contribution: +4)
+ 1  if test files < 10% of changed files
     (test files match: *.test.*, *.spec.*, __tests__/*)

final_score = clamp(score, 1, 10)

Display:

  • 🔴 if score ≥ 8
  • 🟡 if score 5–7
  • 🟢 if score ≤ 4

Large Diff Handling

When git diff --numstat returns > 100 file entries:

  • Analyze first 100 files only
  • Append to report: [Large diff — showing top 100 of N total changed files]
  • Still count total lines from --shortstat for risk scoring

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning8mo4 checks · Risk MEDIUM
  • Gen Agent Trust Hub8mo

    This skill performs automated git repository analysis by executing shell commands. While it is intended to be read-only, it carries risks related to command execution with user-influenced variables and indirect prompt injection from repository history. It also accesses contributor email addresses and source code diffs.

  • Socket8mo

    No alerts

  • Snyk8mo

    Risk: LOW · No issues

  • Runlayer8mo

    2/2 files flagged

Signed by skilld at e591e3f. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 4 weeks ago.

Dormantupdated 9 months ago
Other metadata
triggers
[
  "summarize commits",
  "release notes",
  "analyze PR",
  "PR risk",
  "code impact",
  "git history",
  "提交总结",
  "发版说明",
  "PR 分析",
  "代码影响",
  "git 分析"
]

README badge

README badge for wghust/stark-skills/git-intelligence