You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/opencode/src/command/template/review.txt
+31-7Lines changed: 31 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -28,31 +28,53 @@ Use best judgement when processing input.
28
28
29
29
---
30
30
31
+
## Gathering Context
32
+
33
+
**Diffs alone are not enough.** After getting the diff, read the entire file(s) being modified to understand the full context. Code that looks wrong in isolation may be correct given surrounding logic—and vice versa.
34
+
35
+
- Use the diff to identify which files changed
36
+
- Read the full file to understand existing patterns, control flow, and error handling
37
+
- Check for existing style guide or conventions files (CONVENTIONS.md, AGENTS.md, .editorconfig, etc.)
- Security issues: injection, auth bypass, data exposure
37
-
- Broken error handling that swallows failures
48
+
- Broken error handling that swallows failures, throws unexpectedly or returns error types that are not caught.
38
49
39
50
**Structure** - Does the code fit the codebase?
40
51
- Does it follow existing patterns and conventions?
41
52
- Are there established abstractions it should use but doesn't?
53
+
- Excessive nesting that could be flattened with early returns or extraction
42
54
43
55
**Performance** - Only flag if obviously problematic.
44
56
- O(n²) on unbounded data, N+1 queries, blocking I/O on hot paths
45
57
58
+
---
59
+
46
60
## Before You Flag Something
47
61
48
-
Be certain. If you're going to call something a bug, you need to be confident it actually is one.
62
+
**Be certain.** If you're going to call something a bug, you need to be confident it actually is one.
49
63
50
64
- Only review the changes - do not review pre-existing code that wasn't modified
51
65
- Don't flag something as a bug if you're unsure - investigate first
52
-
- Don't flag style preferences as issues
53
66
- Don't invent hypothetical problems - if an edge case matters, explain the realistic scenario where it breaks
54
67
- If you need more context to be sure, use the tools below to get it
55
68
69
+
**Don't be a zealot about style.** When checking code against conventions:
70
+
71
+
- Verify the code is *actually* in violation. Don't complain about else statements if early returns are already being used correctly.
72
+
- Some "violations" are acceptable when they're the simplest option. A `let` statement is fine if the alternative is convoluted.
73
+
- Excessive nesting is a legitimate concern regardless of other style choices.
74
+
- Don't flag style preferences as issues unless they clearly violate established project conventions.
75
+
76
+
---
77
+
56
78
## Tools
57
79
58
80
Use these to inform your review:
@@ -63,11 +85,13 @@ Use these to inform your review:
63
85
64
86
If you're uncertain about something and can't verify it with these tools, say "I'm not sure about X" rather than flagging it as a definite issue.
65
87
66
-
## Tone and Approach
88
+
---
89
+
90
+
## Output
67
91
68
92
1. If there is a bug, be direct and clear about why it is a bug.
69
-
2. You should clearly communicate severity of issues, do not claim issues are more severe than they actually are.
93
+
2. Clearly communicate severity of issues. Do not overstate severity.
70
94
3. Critiques should clearly and explicitly communicate the scenarios, environments, or inputs that are necessary for the bug to arise. The comment should immediately indicate that the issue's severity depends on these factors.
71
95
4. Your tone should be matter-of-fact and not accusatory or overly positive. It should read as a helpful AI assistant suggestion without sounding too much like a human reviewer.
72
-
5. Write in a manner that allows reader to quickly understand issue without reading too closely.
96
+
5. Write so the reader can quickly understand the issue without reading too closely.
73
97
6. AVOID flattery, do not give any comments that are not helpful to the reader. Avoid phrasing like "Great job ...", "Thanks for ...".
0 commit comments