All posts

Quick Tip: Recap Changes with Claude Custom Commands

Tags:
A terminal showing the /summary command next to a git branch diagram and a summary card with file changes

Ever come back to a branch after a meeting, a different project, or a few days off — having no idea what you changed? I know you did.

Best case — you have super descriptive commit messages or AI assistant chat history that jogs your memory. If there are no commits yet (even though it’s not a good practice to leave uncommitted/unpushed changes, it happens) — you can look at the files you changed, but it will take some time. I find it much more useful to get a quick summary of the changes and the reasoning behind them by asking an AI assistant.

You can even create a reusable command for this — here is how I did it with Claude Code.

Custom /summary command

Claude Code supports custom slash commands — markdown files in .claude/commands/ that can act as reusable prompts. I created one for change summaries:

.claude/commands/summary.md
Summarize all changes on the current branch compared to main. Include:

1. A short one-line summary of the overall change
2. A bullet list of each changed file with what was changed and why
3. Any potential concerns or things to watch out for

Use `git diff main --stat` and `git diff main` to get the changes.
Keep it concise and useful.

Now, anytime I forget what I’ve done in a branch, I type /summary in Claude Code and get a clear breakdown in a human-readable format — no extra setup, no waiting, and no need to waste time typing the same questions to my AI assistant.

After creating a new command, you’ll need to restart your Claude Code session for it to show up.

Bonus: /pr-desc command

Once I had /summary, I wanted a second command that formats the output as a ready-to-paste PR description. Same idea, a slightly different structure:

.claude/commands/pr-desc.md
Generate a PR description for the current branch compared to main.
Format the output as GitHub-flavored Markdown using this structure:

## Summary
A short 1-3 sentence overview of the change.

## Changes
- **`file-path`** -- what was changed and why

## Concerns
Any potential risks, or "None" if the changes are clean.

Use `git diff main --stat` and `git diff main` to get the changes.
Use `git log main..HEAD --oneline` to see all commits on this branch.

Now I run /pr-desc and get a formatted PR description I can paste straight into GitHub.

Tip: You can also instruct the command to copy the output to your clipboard automatically by adding cat /tmp/pr-desc.md | pbcopy (macOS) to the prompt — then it’s just Cmd+V.

You can also skip the clipboard entirely and ask Claude Code to create the PR for you — it runs gh pr create under your GitHub account. But for some reason I prefer to keep this part of the job to myself still :D

I really like custom commands and use them for many more things beyond branch summaries — for example, I have one for post review where I ask AI to check typos and post structure without changing my personal writing style.

Since .claude/commands/ lives in the repo and is committed to git, anyone who clones the project gets the command too — no extra setup needed. Very handy for consistency.

You can also automate PR summaries with a Claude Code GitHub Action that posts a summary comment on every PR automatically (+ additional features). It looks amazing, but as far as I know, this requires an Anthropic API key, and API usage is billed separately from a Claude Pro subscription. I think for solo projects, the custom commands above are simpler.