Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问clear审计通过

diff-preview差异预览

Agent Skill

diff-preview 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

1,256

周安装

51

GitHub Stars

23

下载量

420
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:diff-preview(差异预览)
来源仓库:https://github.com/johnlindquist/claude
仓库路径:skills/diff-preview
安装命令:
npx skills add https://github.com/johnlindquist/claude --skill diff-preview
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/johnlindquist/claude --skill diff-preview

简介

diff-preview 提供 Git 变更的预览与分析功能,辅助理解代码修改内容。

  • 适合在代码审查、分支对比或变更解释等场景中快速掌握差异细节。
  • 通过 CLI 命令调用,支持与多种 AI 宿主环境集成。
  • 使用前需配置 Git 和 Gemini API,并确保密钥安全与环境权限合规。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Diff Preview & Analysis

Preview, explain, and analyze git changes with AI assistance.

Prerequisites

# Git
git --version

# Gemini for AI explanations
pip install google-generativeai
export GEMINI_API_KEY=your_api_key

CLI Reference

Basic Diff Commands

# Working directory changes
git diff

# Staged changes
git diff --staged
git diff --cached

# Specific file
git diff path/to/file.ts

# Between commits
git diff abc123 def456

# Between branches
git diff main feature-branch
git diff main...feature-branch  # Since branch diverged

# Show stat summary
git diff --stat
git diff --shortstat

# Name only
git diff --name-only
git diff --name-status  # With status (M/A/D)

Diff Output Options

# Word diff (better for prose)
git diff --word-diff

# Color words
git diff --color-words

# Ignore whitespace
git diff -w
git diff --ignore-all-space

# Context lines
git diff -U10  # 10 lines of context (default 3)

# Show function names
git diff --function-context

Commit Comparison

# Last commit
git diff HEAD~1

# Last N commits
git diff HEAD~5

# Specific commit range
git diff abc123..def456

# What changed in a specific commit
git show abc123

AI-Powered Analysis

Explain Changes

# Get diff and explain
DIFF=$(git diff --staged)
gemini -m pro -o text -e "" "Explain these code changes in plain English:

$DIFF

Summarize:
1. What was changed
2. Why it might have been changed
3. Any potential issues"

Impact Analysis

DIFF=$(git diff main...feature-branch)
gemini -m pro -o text -e "" "Analyze the impact of these changes:

$DIFF

Consider:
1. Breaking changes
2. Performance implications
3. Security considerations
4. Files/systems affected
5. Testing recommendations"

Pre-Commit Review

# Review staged changes before commit
git diff --staged | gemini -m pro -o text -e "" "Review this code diff for:
1. Bugs or issues
2. Code style problems
3. Missing error handling
4. Security concerns

Provide specific line references if issues found."

Generate Commit Message

DIFF=$(git diff --staged)
gemini -m pro -o text -e "" "Based on this diff, suggest a commit message:

$DIFF

Use conventional commit format (feat/fix/chore/etc).
First line under 50 chars, then details."

Comparison Patterns

Compare Branches

# Summary
git diff main feature-branch --stat

# Full diff
git diff main feature-branch

# Since branch point
git diff main...feature-branch

# Commits unique to feature branch
git log main..feature-branch --oneline

Find What Changed

# What files changed between commits
git diff --name-only abc123 def456

# What changed in a file
git log -p -- path/to/file.ts

# When was a line added
git blame path/to/file.ts

Merge Preview

# Preview merge conflicts
git merge --no-commit --no-ff feature-branch
git diff --staged
git merge --abort  # Clean up

Workflow Patterns

Pre-Commit Check

#!/bin/bash
# Check staged changes before commit

echo "=== Changes to commit ==="
git diff --staged --stat

echo ""
echo "=== Detailed diff ==="
git diff --staged

echo ""
read -p "Proceed with commit? (y/n) " -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
  git commit
fi

PR Review Prep

# Get full PR diff for review
BASE=${1:-main}
BRANCH=$(git branch --show-current)

echo "=== Files changed ==="
git diff $BASE...$BRANCH --name-status

echo ""
echo "=== Stats ==="
git diff $BASE...$BRANCH --shortstat

echo ""
echo "=== AI Summary ==="
git diff $BASE...$BRANCH | gemini -m pro -o text -e "" "Summarize this PR's changes for a code reviewer. Focus on the intent and key changes."

Track Specific Changes

# Find all changes to a function
git log -p -S "functionName" -- "*.ts"

# Find changes mentioning something
git log -p --grep="JIRA-123"

Best Practices

  1. Review before commit - Always check git diff --staged
  2. Use stat first - Get overview before full diff
  3. Compare with base - Use main...branch for PR context
  4. Ignore whitespace - Use -w for meaningful changes
  5. Request AI review - For complex changes
  6. Save important diffs - Redirect to file for reference

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

29.11%
按下载量换算122

OpenCode

25.38%
按下载量换算107

Antigravity

18.49%
按下载量换算78

Gemini CLI

11.84%
按下载量换算50

windsurf

8.65%
按下载量换算36

Cursor

3.25%
按下载量换算14

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills