.agents/skills/gh-pr-review/references/cherry-review-guidance.md
Use this reference as the Cherry Studio project-specific lens for code and
architecture reviews. It complements code-checklist.md; it does not replace
evidence requirements. Only report issues that are grounded in current code.
Classify each reviewed module before looking for issues:
| Area | Common files | Review focus |
|---|---|---|
| Data system | src/main/data/, src/shared/data/, src/renderer/data/, docs/references/data/ | Correct system choice, DataApi scope, migrations, row/entity boundaries |
| Service boundary | src/main/data/services/, src/main/services/ | Owning service, cross-service calls, transactions, side effects |
| IPC / preload | src/shared/ipc/, src/main/ipc/, src/preload/, src/renderer/ipc/, legacy src/shared/IpcChannel.ts | IpcApi routing, input validation, exposure, compatibility, migration completeness |
| Lifecycle / windows / paths | src/main/core/, window services, path access | Lifecycle ownership, cleanup, application.getPath, WindowManager |
| Main architecture | src/main/ moves, additions, imports, services, features | Closed top level, placement, dependency direction, public boundaries |
| Renderer architecture | src/renderer/ moves, additions, imports | Type/domain placement, downward dependencies, feature isolation, public boundaries |
| Shared layer | src/shared/ | Actual cross-process demand, immutable/stateless surface, closed top level, API contracts |
| Renderer data hooks | src/renderer/data/, hooks using useQuery, useMutation, cache/preference hooks | SWR keys, invalidation, optimistic updates, external store snapshots |
| React UI | src/renderer/, packages/ui/ | @cherrystudio/ui, i18n, a11y, hooks correctness, design-system fit |
| Naming / module shape | Added, renamed, or moved files/directories; new classes and barrels | Path casing, export-role naming, Service/Manager roles, promotion, barrel boundaries |
Use these principles before proposing a fix. They prevent scattered local patches, one-off service APIs, and speculative abstractions from spreading through the codebase.
Report these as:
Load references by changed area. Do not paste every external guide into every review. Project docs and repository code win over external references when they conflict.
| Changed area | Consult |
|---|---|
| Added, renamed, or moved files/directories; new classes, services, managers, features, or barrels | docs/references/naming-conventions.md |
src/main/ placement, imports, top-level structure, features, services, or utils | docs/references/main-process-architecture.md, plus the subsystem reference it routes to |
src/renderer/ placement, imports, top-level structure, pages, features, shared buckets, or public APIs | docs/references/renderer-architecture.md |
src/shared/ placement, exports, runtime state, top-level structure, or cross-process contracts | docs/references/shared-layer-architecture.md |
Choosing among DataApi, Cache, Preference, BootConfig, and app_state | docs/references/data/README.md; stop there unless the diff enters one of the subsystem rows below |
| DataApi contracts, schemas, types, or errors | docs/references/data/data-api-overview.md, api-design-guidelines.md, api-types.md |
| DataApi handlers, services, or renderer hooks | Add docs/references/data/data-api-in-main.md for main handlers/services and data-api-in-renderer.md for renderer consumers |
| Cache storage, hooks, service calls, or keys | docs/references/data/cache-overview.md; add cache-usage.md for consumers and cache-schema-guide.md only when keys/schemas change |
| Preference storage, hooks, service calls, or keys | docs/references/data/preference-overview.md; add preference-usage.md for consumers and preference-schema-guide.md only when keys/schemas change |
| BootConfig behavior, access, or keys | docs/references/data/boot-config-overview.md; add boot-config-schema-guide.md only when keys/schemas/mappings change |
| Internal startup continuity markers | docs/references/data/app-state-overview.md |
| v1-to-v2 migrators or migration mappings | docs/references/data/v2-migration-guide.md plus the affected target subsystem guide |
| SQLite schemas, transactions, migrations, defaults, or nullability | docs/references/data/database-patterns.md; add database-construction.md for migration/custom-SQL/FTS build changes and best-practice-default-values-and-nullability.md for default/nullability changes |
| Sortable resources or order keys | docs/references/data/data-ordering-guide.md |
| Offset/cursor pagination or paginated hooks | docs/references/data/data-pagination-guide.md |
| Database seeders or seeding policies | docs/references/data/database-seeding-guide.md |
| Static presets with user overrides | docs/references/data/best-practice-layered-preset-pattern.md |
| Main-process services and long-lived resources | docs/references/lifecycle/README.md, docs/references/lifecycle/lifecycle-usage.md, docs/references/lifecycle/lifecycle-decision-guide.md |
| IpcApi routes/events, preload exposure, main handlers, renderer calls, or legacy IPC migration | docs/references/ipc/README.md; then ipc-usage.md for implementation, ipc-schema-guide.md for contracts/naming, and ipc-migration-guide.md when legacy IPC is touched |
| Windows | docs/references/window-manager/README.md |
| Main-process filesystem paths | src/main/core/paths/README.md |
| SQLite services, handlers, seeders, migrations | docs/references/testing/database-testing.md, tests/__mocks__/README.md |
| UI and shared components | DESIGN.md, packages/ui/, component usage near the diff |
| Repository skills | .agents/skills/README.md, .agents/skills/create-skill/SKILL.md, .agents/skills/gh-pr-review/SKILL.md |
Treat the listed architecture documents as the authority for their scopes. Read the relevant sections before judging placement or dependency direction; nearby code can reflect a documented current deviation and is not a stronger precedent than the target architecture. Do not load unrelated subsystem guides.
Use these skills when they are available in the current runtime:
vercel-react-best-practices: React and Next.js performance, rendering,
data-fetching, and bundle review.create-skill: repository-specific skill creation, public skill whitelist,
skills:sync, and Claude symlink rules.skill-creator: general skill authoring rules, progressive disclosure,
metadata, references, and validation.gh-create-pr: PR template compliance when reviewing PR workflow or PR
documentation changes.cherry-pr-test: Electron UI test workflow when review findings need local
app reproduction.Use external sources only to clarify framework semantics or to strengthen a project-specific finding. Do not report an issue solely because an external source prefers a different style.
Use docs/references/naming-conventions.md as the authority when the diff adds,
renames, or moves a path, changes a primary export's role, or creates a module
boundary. Do not infer the rule from whichever nearby legacy file is easiest to
copy.
Review for:
PascalCase.tsx; hooks/functions use camelCase.ts; class
files use PascalCase.ts; packages/ui and renderer route paths use their
documented kebab-case conventions.*.test.ts(x), never .spec.*, and case-only renames being safe
on macOS, Windows, and Linux.Service
(default) or Manager (homogeneous instance pool) role. Multi-instance
helper classes and stateless modules must not acquire those suffixes merely
because they contain methods.features/<domain>/ only when they are large,
complex, and span concerns.index.ts being a real, lint-enforced encapsulation boundary: explicit named
re-exports only, no logic, no export *, no nesting, and no index.tsx.Apply the process-specific architecture document whenever the diff changes placement, imports, public entry points, or ownership. A documented target/current deviation is context, not permission to introduce more of the deviation.
For src/main/, review for:
core/, and a new capability must not create a new
top-level directory.ai/ does not import features, and main/preload never import renderer code.application.get rather than importing domain implementation directly.services/ and utils/ have no aggregate barrel.For src/renderer/, review for:
index.ts;
no deep imports across the boundary.features/<domain>/ only at the documented promotion
threshold; small pieces remain in the appropriate type bucket.For src/shared/, review for:
@shared (except
the documented Cache schema-registry carve-out). Prospective reuse is not
sufficient.ai, data, ipc, types, or utils top-level
set. Single-process code stays in its owning process.IpcApi is the default command/RPC boundary for non-data main-process
capabilities. Legacy IpcChannel entries describe migration residue, not the
pattern for new work.
Review for:
ipcApi.request unless it meets a
documented escape hatch.IpcContext where
caller identity matters, and delegate stateful business/resource ownership
to the lifecycle or owning service.snake_case, payload fields remaining
camelCase, and types being derived from schemas instead of duplicated.broadcast/send plus useIpcOn;
high-frequency topic streams use directed send and batching rather than an
untyped channel.DataApi is for SQLite-backed, irreplaceable business data. It is not a general-purpose RPC layer.
Flag these as real issues when introduced by the diff:
null, DB rows, or ORM implementation
details to renderer DTOs.When judging system choice:
Data services own their domain tables and the business rules around those tables. Cross-domain collaboration is allowed, but the ownership boundary must stay visible.
Flag these as issues:
Do not over-report:
left join for data matching is acceptable when it does not
encode another domain's business rules. The reviewer should verify it remains
read-only and does not replace the owning service's validation or mapping.useQuery, useMutation, useInfiniteQuery, and usePaginatedQuery use SWR
semantics: cache keys, deduplication, stale-while-revalidate, mutation refresh,
optimistic updates, and revalidation ordering.
Review for:
refresh that is too narrow and leaves stale UI, or too broad (/* over a
high-cardinality resource) and revalidates unrelated data.useMutation triggered concurrently for different IDs from one
hook instance. Use per-row concrete-path hooks for parallel writes.onSuccess that race with pending revalidation.useSWRConfig().cache, unstable_serialize, or raw SWR internals
outside the sanctioned DataApi cache helpers.useCache and usePreference use useSyncExternalStore-style external store
semantics. Review for:
subscribe returns cleanup and does not leak listeners.getSnapshot returns the same value when the store has not changed.React issues are worth reporting when they can cause stale data, missed cleanup, excessive work in hot paths, or incorrect UI state.
Review for:
useEffect used for pure render-derived state, event-specific logic, or
parent/child state synchronization that can be handled during render or in an
event handler.useEffectEvent used outside Effect-owned non-reactive callbacks, or used to
evade dependencies. It is appropriate for subscription/timer callbacks that
need latest props/state without restarting the Effect.useMemo used as a correctness mechanism. It is only for expensive
calculations, stable object/array props to memoized children, or stable hook
dependencies.useCallback wrapped around ordinary inline handlers with no identity-sensitive
consumer. It is useful for memo children, hook dependencies, or stable custom
hook APIs.useMemo / useCallback dependencies that are incomplete or defeated by
always-new object dependencies.UI-specific checks:
@cherrystudio/ui and project design rules.Flag type issues when they create runtime mismatch or caller ambiguity:
null vs undefined semantics are inconsistent across DB row, service entity,
IPC payload, and renderer type.Every finding should answer:
file:line and a short snippet.Use severity language carefully: