Community写作与编辑github.com

LaughingisLaughing/git-repo-doctor

Read-only diagnosis and a safe, rollback-aware cleanup plan for bloated Git repositories. Zero-dependency Python; ships as a Claude Code skill.

git-repo-doctor 是什么?

git-repo-doctor is a Claude Code agent skill that read-only diagnosis and a safe, rollback-aware cleanup plan for bloated Git repositories. Zero-dependency Python; ships as a Claude Code skill.

兼容平台Claude CodeCodex CLICursor
npx skills add LaughingisLaughing/git-repo-doctor

Installed? Explore more 写作与编辑 skills: steipete/notion, affaan-m/seo, affaan-m/brand-voice · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档


name: git-repo-doctor description: Diagnose a bloated or corrupted Git repository and produce a safe, rollback-aware cleanup plan. Use when a .git directory is huge (many GB), full of objects/pack/tmp_pack_* or tmp_obj_* files, or holding hundreds of thousands of loose objects; when git gc/repack/fetch was interrupted (OOM, crash, timeout); when git count-objects reports "garbage"; when an editor or coding agent crashes while scanning a repo; or when the user asks how to safely shrink, clean, prune, or reclaim disk space from a Git repository. The tool is strictly read-only: it inspects and prints a plan but never runs destructive commands.

git-repo-doctor 是做什么的?

Read-only diagnosis plus safe-cleanup advisor for bloated Git repositories.

When to use this skill

  • A .git directory has grown to many gigabytes.
  • objects/pack/tmp_pack_* or objects/??/tmp_obj_* files are piling up.
  • git count-objects -v shows a large garbage count or hundreds of thousands of loose objects.
  • gc.auto=0, or gc / repack / fetch keeps getting interrupted.
  • An editor or coding agent (Codex, Claude Code, Cursor, an IDE indexer) crashes or OOMs while scanning a repository.
  • The user asks to safely shrink, clean, prune, garbage-collect, or reclaim space from a repo.

How to run

Single zero-dependency Python 3 script. It is strictly READ-ONLY.

# Diagnose the repo containing the current directory:
python3 scripts/git_repo_doctor.py

# Point at a specific git dir, including a renamed / disabled one:
python3 scripts/git_repo_doctor.py --git-dir /path/to/.git.disabled-xyz

# Machine-readable output (parse this when acting as an agent):
python3 scripts/git_repo_doctor.py --json

# Skip the remote reachability probe (offline or slow network):
python3 scripts/git_repo_doctor.py --no-remote

What it returns

  1. Size breakdown - definite garbage / loose / packs / reachable history / unreachable estimate / disk headroom.
  2. Health issues - gc.auto=0, stale gc.log, worktree equal to $HOME, Syncthing syncing .git, loose-object flood, leftover temp files.
  3. A recommendation, one of:
    • PATH A (tiny reachable history): bundle safety net, prove it restores, then a layered, delayed delete.
    • PATH B (substantial history): in-place git maintenance + gc/repack; if disk is tight, delete garbage first.
    • filter-repo / BFG hint when giant blobs live in reachable history.
  4. A ready-to-paste, rollback-aware cleanup plan with explicit rollback points. The script prints the commands and executes none of them.

How the agent should use the output

  • Run the script, then summarize the size breakdown, health issues, and the recommended PATH for the user.
  • Present the printed plan but DO NOT execute any command from it automatically. Cleanup is irreversible; the human must confirm each destructive step.
  • Always confirm the $GITDIR value, ensure the bundle is created and verified, and keep the bundle until the user is sure.

Safety contract

This tool never runs gc, prune, repack, rm, reflog expire, or any mutating command. The only things it executes are read-only git queries and filesystem stats, all timeout-guarded. Every destructive action exists solely as text in the printed plan for a human to review and run.

Decision logic (summary)

ConditionRecommendation
reachable < 1 GiB and < 10% of totalPATH A: bundle + layered delete / rebuild
reachable substantial, free space amplePATH B: git maintenance + gc/repack in place
reachable substantial, disk tightdelete garbage first, then repack
few packed objects but huge pack sizegiant-blob hint (run git-sizer, consider git-filter-repo)

See README.md for full documentation and an example report.

相关技能

steipete/notion

Notion CLI/API for pages, Markdown content, data sources, files, comments, search, Workers, and raw API calls.

community

affaan-m/seo

Audit, plan, and implement SEO improvements across technical SEO, on-page optimization, structured data, Core Web Vitals, and content strategy. Use when the user wants better search visibility, SEO remediation, schema markup, sitemap/robots work, or keyword mapping.

community

affaan-m/brand-voice

Build a source-derived writing style profile from real posts, essays, launch notes, docs, or site copy, then reuse that profile across content, outreach, and social workflows. Use when the user wants voice consistency without generic AI writing tropes.

community

affaan-m/crosspost

Multi-platform content distribution across X, LinkedIn, Threads, and Bluesky. Adapts content per platform using content-engine patterns. Never posts identical content cross-platform. Use when the user wants to distribute content across social platforms.

community

affaan-m/x-api

X/Twitter API integration for posting tweets, threads, reading timelines, search, and analytics. Covers OAuth auth patterns, rate limits, and platform-native content posting. Use when the user wants to interact with X programmatically.

community

affaan-m/content-engine

Create platform-native content systems for X, LinkedIn, TikTok, YouTube, newsletters, and repurposed multi-platform campaigns. Use when the user wants social posts, threads, scripts, content calendars, or one source asset adapted cleanly across platforms.

community