编程

Git Troubleshooter

试用

Diagnose a tangled git situation and give the exact, safe commands to fix it. Use when asked to undo a commit, recover lost work, fix a bad merge or rebase,...

它能做什么

Diagnose a tangled git situation and give the exact, safe commands to fix it. Use when asked to undo a commit, recover lost work, fix a bad merge or rebase, resolve a detached HEAD, unstage files, or get out of a git mess. Produces the diagnosis, the precise commands to run in order, what each does, and a recovery note if something goes wrong.

技能文档

Git Troubleshooter Skill

Get the user un-stuck from git — calmly, safely, and without destroying work.

Working from a brief

Infer the current state from what the user describes (and typical git output); label assumptions (assumed — confirm). Always give a concrete command sequence. If a step is destructive, say so loudly before it.

Input

What happened / what they want (e.g. "committed to main instead of a branch", "rebase went wrong", "deleted a branch with unpushed work"), plus any git status/error output. Infer the rest.

Output Structure

Diagnosis

One or two lines: what state the repo is in and why the user is stuck.

Fix — run these in order

A numbered list of exact commands, each with a one-line note of what it does:

1. git reflog                # find the lost commit's SHA
2. git checkout -b rescue    # recover it onto a new branch

Prefer non-destructive routes (branch, reflog, --soft) over destructive ones. Flag any command that rewrites history or discards work with ⚠️ and what it will lose.

Safety net

How to undo if the fix doesn't do what they expected (usually git reflog + reset to the prior HEAD), plus a one-line habit to avoid the situation next time.

Quality Checks

  • The command sequence is exact and ordered (copy-pasteable)
  • Destructive commands are clearly marked with what they destroy
  • A non-destructive option is offered first where one exists
  • A recovery/undo path is included

Anti-Patterns

  • Do not suggest git push --force, reset --hard, or clean -fd without a ⚠️ and a safer alternative first
  • Do not give commands without saying what each one does
  • Do not assume the remote state — ask or label it if it changes the safe path
  • Do not skip git reflog when work might be recoverable — it usually is

相关技能

Scan for orphaned worktrees and stale branches after crashes or abandoned sessions. Offers safe cleanup options.

1 次安装

Scan for orphaned worktrees and stale branches after crashes or abandoned sessions. Offers safe cleanup options.

1 次安装

Git 进阶操作助手,涵盖交互式变基、二分查找、工作树与引用日志恢复。Use when 需要AI模型调用、智能对话、Agent编排、LLM应用时使用。不适用于需要100%确定性的关键决策。适用于独立开发者、企业团队和自动化工作流场景。支持中文交互,无需复杂配置即开即用。输出结果可直接使用,减少二次加工成本。

1 次安装

Smart Git workflows and secret scanning

MUST USE for ANY git operations. Atomic commits, rebase/squash, history search (blame, bisect, log -S). STRONGLY RECOMMENDED Use with session_send/session_spwan to save context. Triggers by 'commit', 'rebase', 'squash', 'who wrote', 'when was X added', 'find the commit that'.

2 次安装

Generate structured summaries of recent git commit activity. Use when the user asks for a commit summary, changelog draft, standup notes from git, or to understand what changed in a repo over a time range. Supports filtering by author, date range, and output format.

1 次安装