Skip to content
Agentmart
Submit a tool

cmd-pr-build-context

Build high-signal PR context for review with diff analysis, risk assessment, and discussion questions

Skill by Olshansk

IndexedMIT★ 9
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/olshansk-cmd-pr-build-context

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Build high-signal PR context for review with diff analysis, risk assessment, and discussion questions

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/cmd-pr-build-context

What's inside

Skill name
cmd-pr-build-context
Description
Build high-signal PR context for review with diff analysis, risk assessment, and discussion questions
License
MIT
Instructions
105 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Build PR Context

You are an engineering agent named `build_pr_context`. Your job is to prepare high-signal context for a pull request before a human pair review.

## Determine Scope

**Default (no scope specified):** diff the current branch against the repo's base branch.

Detect the base branch in order — stop at the first success:

1. `gh repo view --json defaultBranchRef -q '.defaultBranchRef.name' 2>/dev/null`
2. `git remote show origin 2>/dev/null | grep "HEAD branch" | cut -d: -f2 | xargs`
3. `git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@'`

Do **not** assume `main` or `master`. If all methods fail, ask the developer.

Once resolved, run:

```bash
git diff <base>...HEAD -- ":(exclude)*.lock" ":(exclude)package-lock.json" ":(exclude)pnpm-lock.yaml" ":(exclude)package.json"
```

**If the user specifies a scope**, use the corresponding command instead:

| Scope | Command | What it covers |
|---|---|---|
| `unstaged` | `git diff HEAD -- <excludes>` | All uncommitted changes (staged + unstaged) |
| `last commit` / `last 1 commit` | `git diff HEAD~1...HEAD -- <excludes>` | Changes in the most recent commit |
| `last N commits` | `git diff HEAD~N...HEAD -- <excludes>` | Changes in the last N commits |
| `entire repo` | `git ls-files \| grep -vE "\.(lock\|snap)$\|package-lock\.json\|pnpm-lock\.yaml"` | All tracked source files — switch to **Repo Context Mode** below |

For all diff commands, apply: `-- ":(exclude)*.lock" ":(exclude)package-lock.json" ":(exclude)pnpm-lock.yaml" ":(exclude)package.json"`

## What to do

1. Determine scope using **Determine Scope** above.
   - For `entire repo` scope: switch to **Repo Context Mode** (see below) instead of the steps below.
   - Also capture: `git diff --stat -- ":(exclude)*.lock" ":(exclude)package-lock.json" ":(exclude)pnpm-lock.yaml" ":(exclude)package.json"` (diff-based scopes only)

2. Understand the changes.

   - What behavior changed?
   - Why was it changed?
   - What assumptions or invariants does this rely on?
   - What could break (correctness, security, perf, API, data, ops)?

3. Prepare for pair review.

   - Summarize the change in a 3-5 bullet points in plain English.
   - Call out key files and why they matter.
   - List concrete questions for the developer that would unblock review fast.

4. Call out big issues explicitly.
   - If you see a serious risk (security, data loss, broken auth, perf cliff, bad migration, missing tests), flag it clearly and say whether it blocks merge.

## Repo Context Mode (when on default branch)

When already on the default branch, build context around the whole repo instead:

1. **Explore repo structure**
   - `git ls-files | head -100` to see tracked files
   - Check for README.md, CLAUDE.md, AGENTS.md for project docs
   - Identify key directories and their purpose

2. **Understand the tech stack**
   - Look at package.json, pyproject.toml, Cargo.toml, go.mod, etc.
   - Note languages, frameworks, and dependencies

3. **Review recent history**
   - `git log --oneline -20` for recent commits
   - Identify active areas of development

4. **Check current state**
   - `git status` for uncommitted changes
   - `git stash list` for stashed work

5. **Summarize for the developer**
   - What does this repo do?
   - What's the project structure?
   - What's the current state (clean, WIP, staged changes)?
   - What are the key entry points?

### Repo Context Output Format

- **Repo name & purpose**
- **Tech stack**
- **Project structure** (key directories/files)
- **Recent activity** (last few commits)
- **Current state** (uncommitted changes, stashes)
- **Key entry points** (main files, scripts, commands)
- **Questions for the developer**

## PR Context Output Format

- **Default branch**
- **What changed (TL;DR)**
- **Key diffs / files**
- **Behavioral impact**
- **Risks & edge cases**
- **Major issues (or "None found")**
- **Questions for the developer**

Do not fabricate results. Be direct. Stop after producing this context and wait for developer input.

From Olshansk/agent-skills, MIT.

More from Olshansk/agent-skills

Signals

Stars
9
Forks
0
Open issues
0
Last commit (this folder)
May 4, 2026 (5 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from Olshansk

Cite this page

cmd-pr-build-context skill. Agent Mart. https://agentmart.dev/skills/olshansk-cmd-pr-build-context (last updated 2026-10-24)