Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

git-cli-agentic

БесплатноБез исполняемых скриптовНе проверен

Machine-readable git output for scripts: status --porcelain=v2, diff --numstat, log --format placeholders, ahead/behind counts. Use when a script or agent…

laurigatesот laurigates★ 61 звезда на GitHub

Об этом скилле

Git CLI Agentic Patterns

When to Use This Skill

Use this skill when... Use the alternative when...
Writing scriptable git status/diff/log calls in porcelain or --format mode Use gh-cli-agentic for gh JSON queries against the GitHub API
Needing --porcelain=v2 status, --numstat diff counts, or custom --format log placeholders Use git-commit-workflow for staging conventions and commit message structure
Reading branch tracking info or main-branch-development push patterns Use git-branch-pr-workflow for the broader branch + PR design choices
Producing deterministic output for parsers and downstream tooling Use git-derive-docs to mine commit history for rules/PRDs/ADRs/PRPs

Optimized git commands for AI agent consumption using porcelain output and stable formats.

Core Principle

Use --porcelain for machine-readable output that remains stable across Git versions and user configurations.

Working Directory

Run git commands directly — your working directory is the repo:

git status
git log --oneline -5
git diff --stat

The -C flag is only needed when targeting a different repository from your current directory:

# Submodule: run command against parent repo
git -C "$(git rev-parse --show-toplevel)" remote get-url origin

# Script: iterate over multiple repos
for repo in repos/*; do
  git -C "$repo" status --porcelain
done

Status Operations

Porcelain Status

# Version 2 porcelain with branch info (recommended)
git status --porcelain=v2 --branch

# Version 1 porcelain (simpler)
git status --porcelain

# Short format (human-readable but stable)
git status --short --branch

Porcelain v2 Format:

# branch.oid <commit>
# branch.head <branch>
# branch.upstream <upstream>
# branch.ab +<ahead> -<behind>
1 <XY> <sub> <mH> <mI> <mW> <hH> <hI> <path>
2 <XY> <sub> <mH> <mI> <mW> <hH> <hI> <X><score> <path><tab><origPath>
? <path>
! <path>

Status Codes:

Code Meaning
M Modified
A Added
D Deleted
R Renamed
C Copied
? Untracked
! Ignored

Quick Checks

# Check if clean (empty output = clean)
git status --porcelain

# Count changed files
git status --porcelain | wc -l

# Check for uncommitted changes
git diff --quiet || echo "has changes"

Diff Operations

Stat Output

# File change summary
git diff --stat

# Numeric stats (machine-readable)
git diff --numstat

# Name and status only
git diff --name-status

# Names only
git diff --name-only

Numstat Format: <added>\t<deleted>\t<filename>

Staged vs Unstaged

# Unstaged changes
git diff --numstat

# Staged changes
git diff --cached --numstat

# Both (working tree vs HEAD)
git diff HEAD --numstat

Specific Comparisons

# Against specific commit
git diff $COMMIT --numstat

# Between branches
git diff main..feature --numstat

# Between commits
git diff $COMMIT1..$COMMIT2 --name-status

Pathspecs: use :(glob) for **

A plain git pathspec is not a gitignore-style glob. Without magic, * matches across / and ** is just two of them, so a filter can silently miss files:

Pathspec src/proxy.ts src/lib/a.ts
'src/**/*.ts' no (needs a second /) yes
':(glob)src/**/*.ts' yes yes
'src/*.ts' yes yes (* crosses /)
':(glob)src/*.ts' yes no
git diff --name-only origin/main...HEAD -- ':(glob)src/**/*.ts'

The miss produces no error, only a shorter file list. A changed-files step that feeds CI checks then skips top-level files without anyone noticing. Test a new pathspec against a repo that has both top-level and nested matches.

Log Operations

Custom Format

# Hash and subject only
git log --format='%H %s' -n 10

# Oneline (built-in)
git log --oneline -n 10

# With stats
git log --oneline --stat -n 5

# Machine-parseable with multiple fields
git log --format='%H|%an|%ae|%s' -n 10

Format Placeholders:

Placeholder Meaning
%H Full commit hash
%h Short hash
%s Subject
%b Body
%an Author name
%ae Author email
%ad Author date
%cn Committer name

Filtering

# By author
git log --author="name" --oneline -n 10

# By date range
git log --since="2025-01-01" --oneline

# By path
git log --oneline -n 10 -- path/to/file

# Merge commits only
git log --merges --oneline -n 5

Branch Operations

Branch Info

# List with tracking info
git branch -vv

# Formatted output
git branch --format='%(refname:short) %(upstream:short) %(upstream:track)'

# Current branch only
git branch --show-current

# Remote branches
git branch -r --format='%(refname:short)'

Tracking Status

# Ahead/behind count
git rev-list --left-right --count origin/main...HEAD

# Output: <behind>\t<ahead>
``
Полный SKILL.md на GitHub

Установить git-cli-agentic в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Bash(git status *)
Bash(git diff *)
Bash(git log *)
Bash(git branch *)
Bash(git remote *)
Bash(git add *)
Bash(git commit *)
Bash(git push *)
Bash(git restore *)
Read

Вложенные файлы

evals.json

FAQ

Что делает скилл git-cli-agentic?

Machine-readable git output for scripts: status --porcelain=v2, diff --numstat, log --format placeholders, ahead/behind counts. Use when a script or agent parses git state, not to make a commit.

Как установить скилл git-cli-agentic?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл git-cli-agentic запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить git-cli-agentic с