# Diff Scope

> Determine which git diff to analyze based on the user's request. Supports current diff, most recent commit, or current branch.

- Skill: `jamiebrynes7/diff-scope` (Agent Skill)
- Install (CLI): `npx skillmds@latest add jamiebrynes7/diff-scope`
- Raw SKILL.md: https://api.skillmd.com/api/skills/jamiebrynes7/diff-scope/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: jamiebrynes7 (https://skillmd.com/u/jamiebrynes7)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/jamiebrynes7/diff-scope

---


# Diff Scope

Determine which git diff to analyze based on the user's request.

## Current diff (default)

Use when the user mentions "current changes", "my diff", "uncommitted changes", or does not specify a scope.

```bash
git diff HEAD
```

This combines both staged and unstaged changes against HEAD.

## Most recent commit

Use when the user mentions "last commit", "most recent commit", or "previous commit".

```bash
git diff HEAD~1..HEAD
```

## All commits on the current branch

Use when the user mentions "branch changes", "all commits", "changes since main", or "this branch".

First, detect the default branch:

```bash
git rev-parse --verify main 2>/dev/null && echo main || echo master
```

Then diff against it using the merge-base:

```bash
git diff $(git merge-base <default-branch> HEAD)..HEAD
```

---

If the selected diff is empty, STOP and tell the user there are no changes to analyze.

