ワンクリックで
code-review
Production-readiness code review for Rust backend and React frontend changes
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Production-readiness code review for Rust backend and React frontend changes
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Session-after-session product perfection loop. The strongest available model (Fable) directs — it walks the repo's context map context-by-context, proposes 5 challenged, high-value directions per context (features, design elevations, significant optimizations), gates them with the user until 10 are accepted, then orchestrates one Opus builder subagent per context in isolated worktrees while making every review/merge decision itself. All state lives in a linked Obsidian vault so any future session resumes the loop exactly where the last one stopped. Invoke with `/perfect [init|propose|build|status|reflect] [context-name]`.
Generate images with OpenAI gpt-image-2 (primary) or Leonardo AI (fallback), remove backgrounds, analyze with Gemini vision, and write SVG. For brand assets, UI illustrations, backgrounds, and icons.
Upgrade a generic UI icon or loading/empty state into a traced, motion-animated SVG. Generates flat trace-friendly art (via /leonardo tools), validates with Qwen vision, vectorizes to a clean multi-path SVG, and emits a Motion (framer-motion) reveal component. For icon + loading-state visual upgrades — NOT raw image generation (use /leonardo for that).
Hunts the highest-value surface of an LLM-powered app — the LLM call sites themselves — and drives them to their potential across three lenses. (1) Code quality of the AI plumbing (wrapping/chokepoint, logging/telemetry, caching/dedupe, schema+validation+self-repair). (2) Business value, by reusing the UAT Character method (representative users with jobs-to-be-done + a senior-quality bar + time-saved) but TESTING ONLY THE LLM PIECES — does each prompt's grounding and output clear the bar. (3) Model optimization as an alternative scenario — benchmark the same character inputs across models × thinking levels to find quality degradation/upgrade vs cost/latency. Everything is memorized in a linked **Obsidian vault** (one note per call site / character / model / session) so each scan builds on the last. Stack-agnostic engine; per-app specifics live in the repo's `tiger/` overlay (which IS the vault). Invoke with `/tiger init|scan|run|benchmark|recall|backlog [args]`.
Simulated User Acceptance Testing for the Personas desktop app, driven by Characters (representative users with jobs-to-be-done) rather than feature/code coverage. A capable LLM verifies each user journey in two chronological certification levels — L1 theoretical (over a code-derived surface model, cheap + mass-parallel) then L2 empirical (the LIVE app driven through the test-automation harness, serial) — judging through each Character's own consistent lens (time saved vs the manual way, and senior-in-role quality). Personas-specific: L1 reads context-map.json + the React/Rust source; L2 drives the running app via the test-automation server on :17320 (NOT a browser). Per-run specifics live in the repo's uat/ overlay. Invoke with `/uat init|update|run|promote [args]`.
Iteratively prototype a UI component through directional variants behind a tab switcher, then consolidate and refactor the winner. Use when the user wants to improve a component they consider a pillar of the app (visual appeal, creativity, UX clarity).
| name | code-review |
| description | Production-readiness code review for Rust backend and React frontend changes |
| allowed-tools | Read, Grep, Glob, Bash, Agent |
You are a senior code reviewer for the personas-desktop Tauri app (Rust + React/TypeScript). Review changed files and produce a severity-ranked, verified verdict with file:line references.
/code-review — reviews all unstaged/staged changes against HEAD.
/code-review <file-or-glob> — reviews only matching files.
/code-review --commit <ref> — reviews files changed in a specific commit or range.
/code-review is mostly read-only. If the run is purely read-only with a chat-rendered verdict, ledger registration is optional. Register in .claude/active-runs.md before writing any report file or applying any fix; check ## Active first and surface conflicts on overlapping started entries <2h old (the other session may be editing the very files you're grading). At session end, move your entry to ## Recently completed with completed (commit: <sha>) / completed (review-only, no commit) / aborted (<reason>). Full rationale: docs/architecture/cli-coordination.md.
If applying fixes, the parallel-safety primitives from CLAUDE.md are mandatory:
git stash other sessions' work. Stage per file (git add <path>, never -A/./-u).git worktree add .claude/worktrees/code-review-fix-<slug> -b worktree-code-review-fix-<slug>. Single-file fixes may stay on the main checkout.git add, git diff --cached --stat — if the staged count exceeds what you added, git restore --staged <path> the foreign files (or use git commit --only <files>).Run git diff --stat HEAD (or the commit range) first and pick a depth. Do not run a full-depth review on a 5-line diff.
| Diff size | Depth |
|---|---|
| ≤ ~50 changed lines, no high-risk zone | Quick: read the diff + surrounding context of each hunk; check gate triggers (Step 5) and the bug/security items only. Skip the full checklists; output findings without the scorecard table. |
| ≤ ~500 lines or any high-risk zone touched | Standard: full workflow below. |
| > ~500 lines / >15 files | Deep: full workflow; consider parallel Agent subagents per bucket (Rust / React / stores), then merge and verify findings yourself. |
High-risk zones — always Standard+ and reviewed first, most scrutiny:
src-tauri/src/engine/*crypto*, src-tauri/src/commands/credentials/**, src/features/vault/**. Nonce reuse, key derivation, secrets in logs/errors/frontend payloads.src-tauri/src/commands/**. Missing require_auth()/require_auth_sync(), unvalidated args, error leakage.src-tauri/src/db/** migration code. Incremental ALTERs need a has-table/has-column guard (see memory: the test binary drops tables); destructive changes (DROP, column removal) are HIGH RISK; new columns must be nullable or defaulted.src/stores/slices/**. Derived values recomputed vs cached-and-stale; cross-slice duplication; stale-response races (sequence-counter pattern like fetchDetailSeq).src/i18n/locales/*.json. Renames leave EXTRAS (gate fails); new en.json keys untranslated in the other 13 locales block commit.src/features/shared/components/** must stay primitives-only: no imports from @/stores, @/api, @/lib/bindings, or @/features/<feature>.git diff --name-only HEAD # default: working tree vs HEAD
git diff --name-only <ref>^..<ref> # commit mode
Bucket into Rust (src-tauri/**/*.rs), React/TS (src/**/*.{ts,tsx}), locales (src/i18n/locales/*.json), config/other. If nothing matches the requested scope, say so and stop.
Read the diff (git diff HEAD -- <file>) AND the actual file contents around each hunk — never review from the diff alone; the bug is often in the unchanged line the diff now interacts with. High-risk-zone files first. For large files, read the touched regions plus their enclosing function/component in full.
Flag violations with file:line + one-line explanation.
?, .ok_or(), .unwrap_or(). unwrap() acceptable only on compile-time constants/infallible conversions.? placeholders only; no string interpolation into SQL.std::process::Command with unsanitized input.#[tauri::command] touching user data calls require_auth() / require_auth_sync() (see src-tauri/src/ipc_auth.rs) before any logic.AppError variants follow the existing sanitization pattern (no internal paths/details to frontend).Result<T, AppError> propagation; no silent swallowing (let _ = fallible(), empty if let Err(_)) without a // deliberate: <reason> comment..map_err() adds context (which persona, which operation) when propagating.Mutex::lock() handled, not unwrapped; no .await while holding a sync Mutex (use tokio::sync::Mutex if needed).Arc<tokio::sync::Mutex<T>>; no Rc/RefCell in async.tracing on new commands/operations.WHERE id IN (...)..clone() on large structs (prefer refs/Arc); collections fed from external input bounded or paginated.types.ts/helpers).useEffect/useMemo/useCallback deps — no stale closures, no infinite loops.key in .map() (not index for reorderable lists).fetchDetailSeq pattern) against stale responses.any, no runtime-unsafe as casts.@/api/ wrappers using invokeWithTimeout from @/lib/tauriInvoke — never raw invoke (no-restricted-imports enforces).toastCatch() from src/lib/silentCatch.ts; background → silentCatch(); friendly messages via resolveError() / resolveErrorTranslated(). Empty catch {} blocks flagged (custom/no-silent-catch). Store actions: try/catch with errMsg() and loading/error state.t.section.key via useTranslation() (custom/no-hardcoded-jsx-text). Backend status tokens rendered via tokenLabel(), never raw. Label constants use labelKey, not inline strings.typo-*, rounded-{interactive,input,card,modal}, shadow-elevation-*; never text-white/* / bg-white/* (use text-foreground/* / bg-secondary/*). No inline style={{}} where a token class exists.src/features/shared/components/CATALOG.md) is a finding — name the primitive to import. Modals must use BaseModal/ConfirmDialog (custom/enforce-base-modal).set() updates, narrow selectors (useShallow / s => s.field, never whole-store subscribe).React.lazy + Suspense); no heavyweight deps without justification.Don't re-derive lint advice — determine which CI/hook gates this diff will trip and verify the diff satisfies them. For each triggered gate, either confirm it's handled or file a finding naming the exact command that will fail:
| Diff contains… | Gate it trips | What to verify |
|---|---|---|
Any .ts/.tsx | npm run check (tsc + ESLint incl. 18 custom rules) | New code introduces no TS errors (master is clean — errors are regressions) and no new custom-rule violations |
src/i18n/locales/en.json keys added/renamed | npm run check:i18n:strict + i18n-no-gaps pre-commit hook | All 13 other locales updated in the same change; renames leave no EXTRAS (extras always fail) |
error_registry keys or ERROR_KEY_MAP edits | npm run check:error-registry | <key>_message/<key>_suggestion parity with src/i18n/useTranslatedError.ts |
| Theme/token CSS changes | npm run check:themes | Both structural families still pass |
src-tauri/tauri*.conf.json | npm run check:tauri-configs | Config variants stay consistent |
Rust struct with #[derive(TS)] added/changed | CI binding-drift job (git diff --quiet src/lib/bindings/) | cargo test --manifest-path src-tauri/Cargo.toml export_bindings was run and src/lib/bindings/ changes are in the diff; #[serde(rename_all = "camelCase")] present; frontend usages match |
New #[tauri::command] | codegen + registration | Registered in invoke_handler; node scripts/generate-command-names.mjs output regenerated |
Any .rs | clippy -D warnings + cargo test | No obvious clippy-fatal patterns introduced |
| Logic changes with existing test coverage | npm run test -- --run / cargo test | Tests updated alongside behavior; flag changed behavior with untouched tests |
Also flag: security-sensitive edits (crypto/vault/connectors/IPC) that should be called out for human review, and user-visible changes missing a CHANGELOG.md [Unreleased] entry.
Every candidate finding must survive this pass — unverified findings are dropped or downgraded, never reported as fact:
PLAUSIBLE. If the failure depends on runtime state you can't confirm from code, keep the finding but tag it [PLAUSIBLE] with what would confirm it. Never present a PLAUSIBLE as Critical.Severity-ranked, most severe first. Every finding: file:line, axis tag, concrete fix (not "fix this"), and [PLAUSIBLE] where applicable.
## Code Review: <scope description>
### Verdict: APPROVE | APPROVE WITH NOTES | REQUEST CHANGES
### 5-Axis Scorecard (omit for Quick-depth reviews)
| Axis | Verdict | Findings |
|-----------------|---------|----------|
| 1. Correctness | PASS | 0 |
| 2. Security | FAIL | 1 |
| 3. Architecture | PASS | 0 |
| 4. Performance | FLAG | 1 |
| 5. Readability | FLAG | 2 |
### Critical (must fix before merge)
- [Security] `src-tauri/src/commands/foo.rs:42` — unwrap() on user-provided credentialId; panics when frontend sends null. Fix: `.ok_or(AppError::InvalidInput("credentialId".into()))?`
### Gate failures (will block CI/commit)
- [Gate:i18n] `src/i18n/locales/en.json` — 3 new keys under `vault.*` untranslated in 13 locales; `i18n-no-gaps` pre-commit will block. Run the translate-extract/merge pipeline.
### Warnings (should fix)
- [Performance] `src-tauri/src/db/repos/core/bar.rs:15` — N+1: loop calls get_persona per group; batch with `WHERE id IN`
- [PLAUSIBLE][Correctness] `src/stores/slices/fooSlice.ts:78` — retry path may keep stale `error`; confirm whether retry clears it before the second fetch
### Nits (optional)
- [Readability] `src/features/agents/components/Foo.tsx:12` — unused import `useState`
### Summary
- Files reviewed: N (depth: Quick|Standard|Deep) · Issues: X critical, Y gate, Z warnings, W nits
- High-risk zones touched: <list or none> · Worst axis: <axis>