Merge request check
Goal
Replicate a typical MR review script flow in git: check out the change (branch name, MR number, or merge commit), diff against the integration branch (default develop), feed the diff into the standard review prompt in references/review-prompt-template.md, and produce code_review.md-style output (structured sections, patch block, test suggestions).
Default reviewer: the same in-session AI model Cursor uses for other skills (this chat/agent). Do not assume Ollama unless the user asks for it or you use the fallback below.
Adapting for your repository
- Prompt / domain: Edit references/review-prompt-template.md for your language, framework, and review checklist. The bundled template targets iOS / Swift / SwiftUI; replace that section if your project differs.
- Automation: The optional
./review.sh path applies only if your repo provides that script at the repository root. If there is no script, use only the in-session steps below.
- Base branch: Default is
develop. If your team uses main, trunk, etc., follow the user or use REVIEW_BASE / a user-specified base and state it in the review Assumptions section.
Default — in-session review (preferred)
Git safety
- Refuse to clobber uncommitted work (
git status clean). If not, stop and tell the user to commit, stash, or discard.
- User supplied branch name, MR number, or identifying string (same resolution rules as a typical
review.sh that supports MR grep / branch discovery).
git fetch --all --prune before resolving refs.
Resolve the target (typical script-style resolution)
- Local branch → checkout
origin/<name> → git checkout -b <name> origin/<name>
- Numeric only → treat as MR:
git log --merges --grep="Merge request.*<n>" then checkout that commit; fall back to git log --grep="<n>" as needed
- Further fallbacks: merge commits mentioning the string, partial
git branch -a match, prefix match — mirror whatever your project’s review.sh documents, or use reasonable git discovery and explain what you did in Assumptions
Base branch
- Default
develop unless the user or project specifies otherwise.
- If the project uses another integration branch, use
REVIEW_BASE / user-specified base and state it in the review Assumptions section.
Build the diff (typical script-style logic)
- If HEAD is a merge commit: prefer
git diff --diff-filter=MD <first-parent>..HEAD
- Else:
git diff --diff-filter=MD develop...HEAD (or BASE...HEAD)
- Fallbacks:
develop...<original-branch-arg>, then git merge-base develop HEAD, then develop..HEAD
- Important:
--diff-filter=MD includes modified and deleted only — new files are omitted. For a fuller MR review, also consider git diff develop...HEAD (no filter) or ACM and mention which diff was used in Assumptions.
Prompt and review
- Read references/review-prompt-template.md, replace
<<<GIT_DIFF>>> with the unified diff.
- Perform the review in this session following that template exactly (same default model as other Cursor skills).
Deliverable
- Same structure as required by the template (executive summary through PATCH block). Offer to write
code_review.md in the repo if the user wants a saved artifact.
Assumptions (template section 9 / 10)
- State explicitly that the review was produced by the session default model (in Cursor), not Ollama, unless fallback was used.
After checkout
- Warn if on detached HEAD or a different branch; suggest
git checkout develop (or the chosen base) or git checkout - when done.
Fallback — ./review.sh + Ollama
Use only when ./review.sh exists at the repo root and the user asks for Ollama / local model / review.sh, or wants exact script outputs (prompt.txt + code_review.md from Ollama) without relying on the chat model.
From the repository root:
Same clean working tree precondition as above.
Run:
./review.sh <branch-or-mr-or-identifier>
Optional discovery (if the script supports it):
./review.sh --list-merged
Outputs (as implemented in the script)
prompt.txt — filled prompt including diff
code_review.md — Ollama model output (ANSI stripped)
Model is whatever review.sh sets (MODEL=...); mention that when summarizing script results.
Afterwards: detached HEAD / branch switch — same reminder as in the default path.
If ./review.sh is missing, do not invent a script; stay on the in-session path and say the Ollama fallback is unavailable.
Improvements over / gaps in typical scripts (apply when sensible)
| Topic |
Suggestion |
| Diff completeness |
For reviews, prefer full develop...HEAD (or note MD-only omission). |
| Base branch |
Support REVIEW_BASE or second CLI arg without hardcoding only develop. |
| Detached HEAD |
Always warn and suggest checking out back after review. |
| Secrets |
Treat diff as sensitive; do not paste into public logs without need. |
| Model |
Default: session model — state in Assumptions. Fallback: Ollama model from review.sh. |
Quality bar
- Follow the OUTPUT REQUIREMENTS order in the reference template (do not skip sections; use “N/A” briefly if a section does not apply).
- Respect Mock / #Preview exceptions from section 3 of the template (if still present after you customize the template).
- End with === PATCH START === … === PATCH END === when suggesting a patch.
Canonical source for automation
If your repo maintains review.sh at the root, treat it as the source of truth for automation (checkout rules, heredoc). If the heredoc and references/review-prompt-template.md diverge, prefer review.sh for the exact automation text and update the reference file to match after intentional prompt changes.
1---2name: merge-request-check3description: Merge-request / PR review workflow: resolve a branch or MR number against an integration branch (default develop), build a unified diff, and produce a structured review using the session default model and the bundled prompt template; optional Ollama via ./review.sh when present. Use when the user says merge request check, MR review, /merge-request-check, review.sh, or wants a diff-based PR review before merge.4---56# Merge request check78## Goal910Replicate a typical **MR review script** flow in **git**: **check out** the change (branch name, MR number, or merge commit), **diff against the integration branch** (default `develop`), feed the diff into the **standard review prompt** in [references/review-prompt-template.md](references/review-prompt-template.md), and produce **`code_review.md`-style output** (structured sections, patch block, test suggestions).1112**Default reviewer:** the **same in-session AI model** Cursor uses for other skills (this chat/agent). Do **not** assume Ollama unless the user asks for it or you use the fallback below.1314## Adapting for your repository1516- **Prompt / domain:** Edit [references/review-prompt-template.md](references/review-prompt-template.md) for your language, framework, and review checklist. The bundled template targets **iOS / Swift / SwiftUI**; replace that section if your project differs.17- **Automation:** The **optional** `./review.sh` path applies only if your repo provides that script at the **repository root**. If there is no script, use **only** the in-session steps below.18- **Base branch:** Default is **`develop`**. If your team uses `main`, `trunk`, etc., follow the user or use `REVIEW_BASE` / a user-specified base and state it in the review **Assumptions** section.1920## Default — in-session review (preferred)21221. **Git safety**23 - Refuse to clobber uncommitted work (`git status` clean). If not, stop and tell the user to commit, stash, or discard.24 - User supplied **branch name**, **MR number**, or **identifying string** (same resolution rules as a typical `review.sh` that supports MR grep / branch discovery).25 - `git fetch --all --prune` before resolving refs.26272. **Resolve the target** (typical script-style resolution)28 - Local branch → checkout29 - `origin/<name>` → `git checkout -b <name> origin/<name>`30 - Numeric **only** → treat as MR: `git log --merges --grep="Merge request.*<n>"` then checkout that commit; fall back to `git log --grep="<n>"` as needed31 - Further fallbacks: merge commits mentioning the string, partial `git branch -a` match, prefix match — mirror whatever your project’s `review.sh` documents, or use reasonable git discovery and explain what you did in **Assumptions**32333. **Base branch**34 - Default **`develop`** unless the user or project specifies otherwise.35 - If the project uses another integration branch, use `REVIEW_BASE` / user-specified base and state it in the review **Assumptions** section.36374. **Build the diff** (typical script-style logic)38 - If **HEAD is a merge commit**: prefer `git diff --diff-filter=MD <first-parent>..HEAD`39 - Else: `git diff --diff-filter=MD develop...HEAD` (or `BASE...HEAD`)40 - Fallbacks: `develop...<original-branch-arg>`, then `git merge-base develop HEAD`, then `develop..HEAD`41 - **Important:** `--diff-filter=MD` includes **modified and deleted only** — **new files are omitted**. For a fuller MR review, also consider `git diff develop...HEAD` (no filter) or `ACM` and mention which diff was used in **Assumptions**.42435. **Prompt and review**44 - Read [references/review-prompt-template.md](references/review-prompt-template.md), replace `<<<GIT_DIFF>>>` with the unified diff.45 - **Perform the review in this session** following that template exactly (same default model as other Cursor skills).46476. **Deliverable**48 - Same structure as required by the template (executive summary through PATCH block). Offer to write **`code_review.md`** in the repo if the user wants a saved artifact.49507. **Assumptions (template section 9 / 10)**51 - State explicitly that the review was produced by the **session default model** (in Cursor), not Ollama, unless fallback was used.52538. **After checkout**54 - Warn if on **detached HEAD** or a different branch; suggest `git checkout develop` (or the chosen base) or `git checkout -` when done.5556## Fallback — `./review.sh` + Ollama5758Use **only** when **`./review.sh` exists** at the repo root **and** the user **asks for Ollama** / **local model** / **`review.sh`**, or wants **exact** script outputs (`prompt.txt` + `code_review.md` from Ollama) without relying on the chat model.5960From the **repository root**:61621. Same **clean working tree** precondition as above.632. Run:6465 ```bash66 ./review.sh <branch-or-mr-or-identifier>67 ```6869 Optional discovery (if the script supports it):7071 ```bash72 ./review.sh --list-merged73 ```74753. **Outputs** (as implemented in the script)76 - `prompt.txt` — filled prompt including diff77 - `code_review.md` — Ollama model output (ANSI stripped)78794. Model is whatever **`review.sh`** sets (`MODEL=...`); mention that when summarizing script results.80815. **Afterwards:** detached HEAD / branch switch — same reminder as in the default path.8283If **`./review.sh` is missing**, do **not** invent a script; stay on the **in-session** path and say the Ollama fallback is unavailable.8485## Improvements over / gaps in typical scripts (apply when sensible)8687| Topic | Suggestion |88|--------|------------|89| Diff completeness | For reviews, prefer **full** `develop...HEAD` (or note MD-only omission). |90| Base branch | Support `REVIEW_BASE` or second CLI arg without hardcoding only `develop`. |91| Detached HEAD | Always warn and suggest checking out back after review. |92| Secrets | Treat diff as sensitive; do not paste into public logs without need. |93| Model | **Default:** session model — state in **Assumptions**. **Fallback:** Ollama model from `review.sh`. |9495## Quality bar9697- Follow the **OUTPUT REQUIREMENTS** order in the reference template (do not skip sections; use “N/A” briefly if a section does not apply).98- Respect **Mock** / **#Preview** exceptions from section 3 of the template (if still present after you customize the template).99- End with **=== PATCH START ===** … **=== PATCH END ===** when suggesting a patch.100101## Canonical source for automation102103If your repo maintains **`review.sh`** at the root, treat it as the source of truth for **automation** (checkout rules, heredoc). If the heredoc and `references/review-prompt-template.md` diverge, **prefer `review.sh` for the exact automation text** and update the reference file to match after intentional prompt changes.