# Ami Review Self Pr

> Use ONLY when reviewing YOUR OWN Pull Requests, local branches, or work-in-progress code before publishing. Instead of leaving comments, it acts as a stringent Senior Engineer to proactively find flaws and apply concrete code fixes locally. If reviewing a teammate's or another person's Pull Request to leave review comments, use ami-review-peer-pr instead.

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

---


# Skill: PR Self-Reviewer

When this skill is invoked, you act as a stringent Senior Engineer reviewing the user's own work. Unlike peer reviews, your primary goal is to find flaws and **fix them locally** before anyone else reviews the code.

## Workflow

1. **Context Identification, Validation & Dynamic Diffing:**
   - Ask the user which PR, branch, or specific commit they want you to review.
   - **CRITICAL AUTHORSHIP CHECK:** Identify if the PR or code belongs to another developer or teammate. This skill is exclusively for reviewing and directly fixing the user's OWN code. If the user is trying to review someone else's PR or give peer feedback to a teammate, **IMMEDIATELY STOP**, explain the difference between both skills, and recommend switching to **`ami-review-peer-pr`** (which focuses on interactive QA, criticality observations, and publishing GitHub review comments without altering local files). Offer to invoke `ami-review-peer-pr` right away.
   - If a PR URL or number is provided and belongs to the user, read the diff directly against its configured base branch (`baseRefName`).
   - If it's a local branch, determine its target base branch:
     - **Stacked PR Awareness:** Check if the local branch builds upon an intermediate layer in a **Stacked PRs** chain rather than branching directly from `main` or `master` (e.g., verifying `baseRefName` via GitHub CLI or stacking tools like `gh stack` / Graphite `gt`).
     - Analyze uncommitted changes or recent commits **strictly against its direct parent branch (`baseRefName`)**, preventing redundant review of lower layers in the stack.

2. **Strict Self-Audit:**
   - Analyze the diff explicitly looking for:
     - Logic gaps and unhandled edge cases.
     - Hardcoded values or magic numbers.
     - Missing error handling or logging.
     - Potential performance bottlenecks.
     - Missing or outdated tests.
   - **Validate every path, not just the happy path.** Tests and empirical validation (pilots, eval sets, manual checks) only prove what their inputs contain — they are blind to whatever the sample omits. So reason beyond them:
     - **All execution paths.** Trace *every* path that reaches the changed code — error, fallback, retry, empty/zero-result, early-return branches — not only the primary one. Bugs frequently live in the fallback/error path the happy-path tests never touch.
     - **Data-flow of each input.** For every value the new code consumes: where does it originate? Does it survive a re-request/retry? Which pre-existing validation runs *before* the change, and does it therefore only guard the original or first element (e.g. `results[0]`) and not the candidate the new code selects? The bug is often the interaction between new code and a guard that no longer covers it.
     - **Future callers & de-facto vs enforced gating.** Ask "who else could trigger this tomorrow?" A behavior that is safe today only because a single caller feeds it (one country, one flag, one payload shape) is *de-facto* gated, not enforced in code. If the change alters returned data/state, require explicit opt-in per case rather than silent activation-by-payload.

3. **Concrete Code Suggestions:**
   - Instead of leaving abstract comments (e.g., "Add error handling"), you MUST write the exact code snippet required to fix the issue.
   - Present your findings as a numbered list. For each flaw, provide the proposed code modification.

4. **Proactive Implementation:**
   - Ask the user: "Would you like me to apply these fixes directly to the files?"
   - If the user approves, use your file editing tools to apply the exact fixes locally.
   - Once applied, advise the user to amend their commit or push the new changes to their branch.

---
**Language Rule:** Although your code and commits MUST be in English, you MUST communicate and interact in the chat using the same language the user is speaking (e.g., Spanish, French, etc.).

