一键导入
code-review
Shared review rules for automated PR reviews and local manual reviews. Triggered by review commands.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Shared review rules for automated PR reviews and local manual reviews. Triggered by review commands.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Add missed review patterns or newly discovered pitfalls to bad-review.md. Triggered by "Add review checklist item".
Run code review in an independent agent. Automatically used after code implementation or fixes. Triggered by "review this", "code review", "code check", "look at this PR", "check the diff", "is this code OK?".
Add missed review patterns or newly discovered pitfalls to bad-review.md. Triggered by "add review checklist item", "add to review checklist".
基于 SOC 职业分类
| name | code-review |
| description | Shared review rules for automated PR reviews and local manual reviews. Triggered by review commands. |
Review code changes in fullcase-web (Next.js 16 + TypeScript + Firebase client SDK) to detect bugs, design violations, spec violations, and security risks.
Serves as the shared ruleset for both automated PR reviews (referenced by subagents) and local manual reviews (direct invocation).
Obtain the diff based on the provided arguments.
When a PR number is specified:
gh pr diff <PR-number>
When a branch is specified:
git diff <base-branch>...<target-branch>
If the base branch is omitted, default to main.
When nothing is specified (local review of own changes):
git diff
git diff --cached
git status --short
If there are untracked new files, read the file contents directly for review.
For PR reviews (via the review-pr orchestrator): the diff is provided by the caller. Skip this step.
Read AGENTS.md at the project root to understand project-specific rules. AGENTS.md is the canonical source of truth for the architecture, Firestore data model, folder responsibilities, and code-style rules.
Review the diff based on the "Review Criteria" below. If there are no findings, report "No issues found".
Before outputting findings, self-check against the following:
references/bad-review.md?tsc --noEmit would catch?Exclude any findings that match.
Also reference .codex/prompts/codex-output-schema.json as a quality guide for finding structure (severity, priority, confidence, code location).
Output only findings that pass the quality check.
null / undefined, missing await, stale closures, unsubscribed Firestore / Storage listenersdangerouslySetInnerHTML without sanitization, firebase-admin on clienttypes/, manual edits to components/ui/, raw <img> instead of next/image, custom CSS in globals.cssDate / ISO strings (must be serverTimestamp() / Timestamp), missing memberIds update on membership change, inconsistent collection paths vs. the canonical paths in AGENTS.md, non-atomic multi-doc writes where writeBatch / runTransaction is required(dashboard)/layout.tsx auth guard weakened, pendingInvite sessionStorage handling broken, invite token not validated before writing membershipany keyword alone, max-len.next/, next-env.d.ts, components/ui/*, generated type declarations| Level | Priority | Icon | Definition | Examples |
|---|---|---|---|---|
| CRITICAL | P0 | 🔴 | Security vulnerability, data loss / leak risk, guaranteed production breakage | Secret leak, auth guard bypass, dangerouslySetInnerHTML with raw user input, firebase-admin used on client |
| HIGH | P1 | 🔴 | Mandatory rule violation, definite bug | Firebase SDK imported into a component, any used deliberately, date stored as ISO string, <img> instead of next/image, missing await on an async write |
| MEDIUM | P2 | 🟡 | Quality / performance improvement | Unnecessary onSnapshot where getDocs suffices, missing loading/error in a hook, N+1 Firestore reads, inline object prop causing memoized-child re-renders |
| LOW | P3 | 🟢 | Minor improvement suggestion | Small refactor opportunity, non-critical naming polish, optional comment |
Each finding must be written in English.
🔴 [CRITICAL] `path/to/file.tsx:42`
Firebase SDK is imported directly inside a React component. Project rule: components consume hooks; hooks call services; only services touch the Firebase SDK.
Suggestion: Move the Firestore call into `services/<feature>-service.ts` and expose it via a hook under `hooks/`.
When there are no findings:
✅ No issues found
services/* contains pure async functions with zero React imports.hooks/* always expose loading and error.firebase-admin is forbidden. Server Actions / Route Handlers are forbidden for Firestore / Storage operations.types/ and are imported via @/types.(auth) public, (dashboard) protected, invite/[token] public.(dashboard)/layout.tsx must be a client component and redirect via router.replace('/login') inside useEffect. Never use the server-only redirect() helper.next/image everywhere; firebasestorage.googleapis.com and lh3.googleusercontent.com must be in next.config.ts remotePatterns.next/font for fonts.strict: true. Never any (explicit or implicit).unknown + narrowing, Omit<T, 'id'|'createdAt'|'updatedAt'> for create payloads, Partial<Pick<T, ...>> for update payloads.serverTimestamp() or Timestamp for date fields. Never new Date() or ISO strings in stored values.writeBatch for multi-document logical operations (e.g., invite accept).setDoc(..., uid) — not addDoc — when a document ID must equal the user's UID.projects/{id}.memberIds whenever a member is added/removed (security rules depend on it).react-hook-form + zod + shadcn Form primitives.AlertDialog for all destructive confirmations.Skeleton for loading states.style props. No custom classes in globals.css.components/ui/ is shadcn CLI output — never manually edit.try/catch.toast.error(...); never raw Firebase error codes.console.error only when process.env.NODE_ENV !== 'production'.console.log in committed code.process.env.NEXT_PUBLIC_FIREBASE_*....ab12).members / memberIds.Refer to the following for review quality standards:
references/good-review.mdreferences/bad-review.mdPost-review feedback: If you discover missed issues or new pitfalls from this review, add them to the checklist via the update-review-checklist skill.