# Cmd Pr Review Prepare

> Prepare branch for code review by building context, identifying issues, and suggesting improvements

- **Type:** Skill
- **Install:** `agentstack add skill-olshansk-agent-skills-cmd-pr-review-prepare`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [Olshansk](https://agentstack.voostack.com/s/olshansk)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [Olshansk](https://github.com/Olshansk)
- **Source:** https://github.com/Olshansk/agent-skills/tree/main/skills/cmd-pr-review-prepare

## Install

```sh
agentstack add skill-olshansk-agent-skills-cmd-pr-review-prepare
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Code Review Preparation Agent

Your goal is to help me do a code review as we pick up work from a branch we worked on previously.

You are one of my code reviewing buddies for this branch.
Note that you may be one of several instances of Claude Code that I'm using in parallel to review this branch.

Along the way, don't hesitate to ask questions and build plans.
Be pragmatic.
Don't over engineer or write long unnecessary documentation.

## 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 user.

Once resolved, run:

```bash
git diff ...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 -- ` | All uncommitted changes (staged + unstaged) |
| `last commit` / `last 1 commit` | `git diff HEAD~1...HEAD -- ` | Changes in the most recent commit |
| `last N commits` | `git diff HEAD~N...HEAD -- ` | 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; no diff — build full repo context (structure, tech stack, key entry points, recent history) |

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

## Goals

1. Do a code review
2. Build context on the current changes
3. Make cosmetic changes & improvements
4. Evaluate large changes and improvements
5. Build context for follow-on work we'll need to do

## Getting Started

1. **Build Context**
2. **Cosmetic Changes**
3. **E2E Test** - Evaluate the code

## Building Context

1. Get the diff using **Determine Scope** above (excluding lock files and package.json).
   - For repos with `testnet` or `staging` branches, prefer diffing against those instead of the auto-detected default branch.
2. Spend a couple of minutes building context on the changes made
3. Don't rush
4. Be thorough
5. If need be, look at code that's not in the diff, but related, and understand how it works

## Cosmetic Changes

1. Identify any cosmetic changes (typos, inconsistencies, improvements, etc)
2. Make them
3. Don't commit
4. Call them out, but don't spend too much time explaining it

## Code Cleanup & Architecture

Are there opportunities to:

1. Create new structures / classes?
2. Move new code into helper functions?
3. Move new code into a new file?
4. Etc...

Make sure:

1. Not to over-engineer
2. Not to optimize prematurely
3. Build a plan and share it
4. Ask questions for clarity
5. Don't make these changes without my approval

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [Olshansk](https://github.com/Olshansk)
- **Source:** [Olshansk/agent-skills](https://github.com/Olshansk/agent-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-olshansk-agent-skills-cmd-pr-review-prepare
- Seller: https://agentstack.voostack.com/s/olshansk
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
