Pr review

From LedgerHQ/lumen · View interactive version

Pr review is an AI agent skill from the GitHub repository LedgerHQ/lumen. Review a PR or the current branch for a Lumen design-system change — routes each changed file to React (web/Tailwind) or React Native (useStyleSheet) guidelines, checks the Nx version plan, and reports a flat, severity-scored finding list. Use when the user asks to review a PR, review code changes,

How to use this skill

Skill file

PR Review

Review a change against Lumen's conventions. The distinctive skill here is

platform routing: this is a cross-platform monorepo, so the same finding

category means different things in libs/ui-react (Tailwind) versus

libs/ui-rnative (useStyleSheet). Apply the right rules to the right files

and never leak one platform's rules onto the other.

Setup

Local branch

git fetch origin main
git diff origin/main...HEAD --stat
git diff origin/main...HEAD
git log origin/main...HEAD --oneline

Remote PR (GitHub link)

gh pr view <PR_NUMBER> --json title,body,baseRefName,headRefName,files
gh pr diff <PR_NUMBER>

Then read the full diff. For each changed file, read the whole file (not

just the hunk) so findings account for surrounding context. Group changes into

new files, modified files, deleted files.

Platform routing (do this first)

Derive the touched libs from the changed paths (`git diff origin/main...HEAD

--name-only | cut -d/ -f1-2 | sort -u`), map each to its platform via the

Libraries table in AGENTS.md, then apply the matching topic skill's

## Review checks. Applying the wrong platform's rules is the main failure mode

— decide deliberately.

The concrete, diff-verifiable violations for each topic live in that topic

skill's ## Review checks table — this skill does not restate them:

| Topic | Skill (see its ## Review checks) |

| -------------------------------------------------------------------- | ---------------------------------- |

| API design & composition (props, compound, controlled state, parity) | component-architecture |

| Styling (Tailwind vs useStyleSheet) | component-styling |

| Tests (Vitest vs Jest) | component-testing |

| File/folder layout & required files | component-anatomy |

| Stories | component-stories |

| MDX docs | component-mdx |

| Code Connect | code-connect |

| Dependencies (any package.json, .syncpackrc.json) | dependency-management |

| Version plan | release-plan (scored below) |

Rules:

and native together). When both ui-react and ui-rnative are touched,

apply both the web and RN review checks and add the API-parity check:

prop names, defaults, and variant vocabulary should match across the two

implementations unless there's a platform reason not to (Parity).

file.** The token _vocabulary_ is shared (bg-muted ↔ t.colors.bg.muted),

the _mechanism_ is not.

Components/visualization/ use useTheme() + flat stories, no .mdx/figma).

Don't flag files a lib does not use.

never edited by hand: flag any hand edit under Consistency, and ask for the

change in internals/design-sources (or the target) instead.

below, no styling rules.

Already enforced — do not review by hand

These are ESLint errors (see eslint.config.mjs) and a Stop hook runs

nx affected --target=lint --fix automatically. Flagging them by hand is noise;

spend findings on things a linter can't catch. Do not raise:

Animated/Easing/LayoutAnimation, ElementRef, MutableRefObject.

import/no-default-export, import/no-unused-modules.

import type (consistent-type-imports), T[] over Array<T>

(array-type).

default-param-last, no-console, and all formatting (prettier).

(@nx/enforce-module-boundaries scope tags).

includes raw palette and typography classes (text-gray-500, font-bold):

Lumen's preset removes them, so they are unknown classes.

@ledgerhq/lumen-lint-plugin). They are warnings in this repo, so a new one in

a diff is already visible.

border-l, text-left on web (better-tailwindcss/enforce-logical-properties), left-*/right-* on web (better-tailwindcss/no-restricted-classes), marginLeft, paddingRight, borderTopLeftRadius and a lone left/right in RN style objects (lumen/enforce-logical-properties, the lint plugin's react-native-strict preset). Not linted: physical anchors paired with measured x/translateX (keep them physical, as SegmentedControl and Switch do), and directional icons that should mirror.

without a matching migration (npm run check:breaking-changes, breaking-changes job).

Caveat: a valid token class that is the wrong one for the design lints

clean, and hardcoded colors in style objects or SVG props are not linted at all —

both stay manual checks, see component-styling's Review checks.

Findings vs severity — independent

number, never cap at one.

with how many findings there are.

No hallucinated findings

Only report issues you can point to at a concrete file:line. If the code is

correct and follows conventions, report zero findings and recommend

approval. Never invent, pad, or raise speculative "could maybe" issues. Do not

flag style that already matches the codebase.

Severity scale

that compiles but fails at runtime, missing version plan.

missing tests for important paths, wrong version-plan bump type.

on public API.

Shared review criteria (both platforms)

Apply these regardless of platform; platform specifics are in the references.

Correctness

empty arrays, error/loading states)?

comments that just narrate mechanics, and complex logic left uncommented.

Type safety

Performance

Abstraction & API quality

The rules — prop naming, positive booleans, minimal public API, Base*Props

layering, compound composition, controlled/uncontrolled state, cross-platform

parity, memoization — are owned by the component-architecture skill. Apply its

## Review checks table here (routed above); this skill does not restate them.

Docs vs implementation consistency

removed/renamed props, default values match the implementation, interactive

examples still work. (Not applicable to RN charts under Components/visualization/.)

Version plan check

The version-plan rules (when a plan is required, the exemption list, the

path→package mapping, filename convention, always-patch, one-package-per-file)

live in the release-plan skill — the single source. Load it if you need the

detail. Here, just verify and score:

git diff origin/main...HEAD --name-only -- .nx/version-plans/

(8/10)**, category Release. (A PR touching only exempt files needs no plan.)

patch.

Moderate (6/10), Release.

release-plan) → Moderate (6/10), Release.

lacks ! (format in release-plan) → Minor (4/10), Release.

Migration check

CI fails on structural breaks without a migration; it cannot see behavior or

visual changes. For every change under libs/*/src/, ask: **would a consumer

see or feel a difference after upgrading?** (new default, different DOM, focus

or event behavior, spacing, density, colors.)

category Release. Recommend a migration with signal: silent (behavior)

or signal: visual (appearance).

find → Moderate (6/10), Release.

Output

If the review is short (fewer than ~15 findings), return it directly. If long,

write it to tmp/pr-review-[branch-name].md and report the path (tmp is

gitignored).

The review is a flat, scored list — one item per finding, sorted by severity

(highest first). No per-file nesting; each item is self-contained.

# PR Review: [branch-name]

## Summary

[1-3 sentence overview of the PR's purpose and scope]

**Platforms touched**: React web / React Native / both / design-core / utils-shared
**Files changed**: X | **Added**: +X | **Removed**: -X

## Component Checklist (if a new component was added)

[Fill in the required-files checklist from `component-anatomy` for the component's
lib, marking each item pass/fail]

## Findings

| #   | Severity | Category    | Finding                                                    | Location                                                 |
| --- | -------- | ----------- | ---------------------------------------------------------- | -------------------------------------------------------- |
| 1   | 9/10     | Type Safety | Uses `any` for payload type                                | `libs/ui-react/src/lib/Components/core/Menu/types.ts:28` |
| 2   | 7/10     | Consistency | Raw Tailwind color `text-gray-500` instead of `text-muted` | `libs/ui-react/src/lib/Components/core/Menu/Menu.tsx:26` |

### Details

**1. [Finding title]** — 9/10 Type Safety — `libs/ui-react/src/lib/Components/core/Menu/types.ts:28`
[1-3 sentence description]

> **Fix**: [concrete suggestion]

Key rules for output

Use a range (:42-50) when it spans lines. The location in the table must

match the location in the details entry.

Abstraction, API Quality, Docs Consistency, Release, Parity.

Tips

pattern alignment.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.