Code Review
Review Posture
Review as a principal engineer responsible for long-term product health. Prioritize correctness, architecture, maintainability, reusability, testing, documentation, observability, operational risk, and delivery safety. Keep style comments secondary unless they hide a real defect or maintenance cost.
For broad or full-app reviews, read references/principal-review-checklist.md after identifying the stack, app boundaries, and user workflows.
Workflow
Establish scope:
- Identify the app type, primary workflows, deployment model, data stores, background jobs, integrations, and test framework.
- Inspect recent diffs when reviewing a branch or PR; inspect the full flow when reviewing an application area.
- Note what was not reviewed or could not be verified.
Build the mental model:
- Trace request, UI, job, and data paths end to end.
- Identify shared abstractions, ownership boundaries, and repeated patterns.
- Prefer the repository's existing conventions before recommending new structure.
Review high-impact concerns first:
- Correctness and user-visible behavior.
- Data integrity, migrations, lifecycle cleanup, idempotency, and concurrency.
- Architecture boundaries, coupling, duplication, and cohesion.
- Reusability of helpers, services, components, templates, and tests.
- Error handling, logging, observability, and operational failure modes.
- Security-adjacent risks when obvious, while leaving deep vulnerability review to a dedicated security review.
Check README and docs:
- Verify setup, environment variables, commands, background jobs, deployment steps, and important workflows match the code.
- Flag stale, missing, or misleading README content.
- Recommend exact documentation updates when possible.
Check test coverage:
- Identify the test strategy and what commands should be run.
- Look for coverage of critical flows, edge cases, failure paths, integrations, migrations, and background jobs.
- Flag untested behavior when the risk justifies tests.
- Prefer focused tests that protect behavior over broad, brittle test expansion.
Validate findings:
- Ground each issue in code, config, docs, tests, or observed behavior.
- Avoid speculative complaints without impact.
- Run focused tests or static checks when feasible.
- Distinguish confirmed findings from questions or improvement ideas.
Output Format
Use a code-review stance by default:
- Findings first, ordered by severity.
- Include file and line references for local code when available.
- For each finding, state impact and a concrete fix.
- Then list open questions or assumptions.
- Then summarize what was reviewed and tests/checks run.
If no material issues are found, say so clearly and mention residual risks or missing verification.
Severity
- Critical: likely data loss, major outage, broken core workflow, unsafe deployment behavior, or severe security-impacting defect.
- High: incorrect cross-user behavior, broken billing/auth/notification flows, migration or cleanup risks, major test gap around risky logic, or architectural issue likely to cause recurring defects.
- Medium: maintainability or reuse issue with clear cost, brittle integration, incomplete docs for important operations, missing tests for meaningful edge cases.
- Low: minor cleanup, naming, local readability, non-blocking documentation polish, or optional hardening.
Implementation Follow-Through
When the user asks to fix issues, make scoped changes that fit the existing codebase. Add or adjust tests proportional to risk, update the README when behavior or configuration changes, and run the smallest meaningful verification set before reporting back.
Guardrails
- Do not turn reviews into broad rewrites unless the user asks for implementation.
- Do not report generic best practices without a specific app impact.
- Do not demand abstractions for one-off code; recommend reuse only when it reduces real duplication or coupling.
- Do not overwrite user changes or unrelated work in a dirty tree.
- Do not expose secrets found during review; redact values and identify the location safely.
1---2name: code-review3description: Perform application code reviews from an application architect or principal developer perspective. Use when Codex is asked to review app code, pull requests, branches, architecture, maintainability, quality, reusability, README accuracy, test coverage, operational readiness, or technical debt, and to provide prioritized findings with practical remediation guidance.4---56# Code Review78## Review Posture910Review as a principal engineer responsible for long-term product health. Prioritize correctness, architecture, maintainability, reusability, testing, documentation, observability, operational risk, and delivery safety. Keep style comments secondary unless they hide a real defect or maintenance cost.1112For broad or full-app reviews, read `references/principal-review-checklist.md` after identifying the stack, app boundaries, and user workflows.1314## Workflow15161. Establish scope:17 - Identify the app type, primary workflows, deployment model, data stores, background jobs, integrations, and test framework.18 - Inspect recent diffs when reviewing a branch or PR; inspect the full flow when reviewing an application area.19 - Note what was not reviewed or could not be verified.20212. Build the mental model:22 - Trace request, UI, job, and data paths end to end.23 - Identify shared abstractions, ownership boundaries, and repeated patterns.24 - Prefer the repository's existing conventions before recommending new structure.25263. Review high-impact concerns first:27 - Correctness and user-visible behavior.28 - Data integrity, migrations, lifecycle cleanup, idempotency, and concurrency.29 - Architecture boundaries, coupling, duplication, and cohesion.30 - Reusability of helpers, services, components, templates, and tests.31 - Error handling, logging, observability, and operational failure modes.32 - Security-adjacent risks when obvious, while leaving deep vulnerability review to a dedicated security review.33344. Check README and docs:35 - Verify setup, environment variables, commands, background jobs, deployment steps, and important workflows match the code.36 - Flag stale, missing, or misleading README content.37 - Recommend exact documentation updates when possible.38395. Check test coverage:40 - Identify the test strategy and what commands should be run.41 - Look for coverage of critical flows, edge cases, failure paths, integrations, migrations, and background jobs.42 - Flag untested behavior when the risk justifies tests.43 - Prefer focused tests that protect behavior over broad, brittle test expansion.44456. Validate findings:46 - Ground each issue in code, config, docs, tests, or observed behavior.47 - Avoid speculative complaints without impact.48 - Run focused tests or static checks when feasible.49 - Distinguish confirmed findings from questions or improvement ideas.5051## Output Format5253Use a code-review stance by default:5455- Findings first, ordered by severity.56- Include file and line references for local code when available.57- For each finding, state impact and a concrete fix.58- Then list open questions or assumptions.59- Then summarize what was reviewed and tests/checks run.6061If no material issues are found, say so clearly and mention residual risks or missing verification.6263## Severity6465- Critical: likely data loss, major outage, broken core workflow, unsafe deployment behavior, or severe security-impacting defect.66- High: incorrect cross-user behavior, broken billing/auth/notification flows, migration or cleanup risks, major test gap around risky logic, or architectural issue likely to cause recurring defects.67- Medium: maintainability or reuse issue with clear cost, brittle integration, incomplete docs for important operations, missing tests for meaningful edge cases.68- Low: minor cleanup, naming, local readability, non-blocking documentation polish, or optional hardening.6970## Implementation Follow-Through7172When the user asks to fix issues, make scoped changes that fit the existing codebase. Add or adjust tests proportional to risk, update the README when behavior or configuration changes, and run the smallest meaningful verification set before reporting back.7374## Guardrails7576- Do not turn reviews into broad rewrites unless the user asks for implementation.77- Do not report generic best practices without a specific app impact.78- Do not demand abstractions for one-off code; recommend reuse only when it reduces real duplication or coupling.79- Do not overwrite user changes or unrelated work in a dirty tree.80- Do not expose secrets found during review; redact values and identify the location safely.