Skip to content

Commit 1d53bfc

Browse files
committed
docs(skill): refine code review rules
1 parent 7bf2081 commit 1d53bfc

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

  • examples/skills_code_review_agent/skills/code-review

examples/skills_code_review_agent/skills/code-review/RULES.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ Severity guidance:
3737
- `eval/exec/pickle.loads/shell=True`: high
3838
- `verify=False`: medium to high depending on context
3939

40+
Do not report when:
41+
42+
- the match only appears inside comments or doc-style examples
43+
- YAML parsing already uses `safe_load` or `SafeLoader`
44+
- subprocess invocation does not use `shell=True`
45+
- `verify=False` appears in clearly test-only or mock-only code: lower confidence and route to human review
46+
4047
### Async Error
4148

4249
Heuristic patterns:
@@ -59,6 +66,11 @@ Routing guidance:
5966

6067
- Resource-lifecycle heuristics are useful but often context-sensitive, so medium-confidence routing is preferred in the first version.
6168

69+
Do not report when:
70+
71+
- the handle is created with `with open(...)`
72+
- a created handle or client is explicitly closed later in the added code
73+
6274
### Missing Tests
6375

6476
Diff-level pattern:
@@ -79,12 +91,19 @@ High-confidence patterns:
7991
- `secret = "..."`
8092
- `Bearer ...`
8193
- `AKIA...`
94+
- `sk-...`
95+
- `ghp_...`
8296
- private key headers such as `BEGIN PRIVATE KEY`
8397

8498
Severity guidance:
8599

86100
- Hard-coded credentials are generally high or critical.
87101

102+
Do not report when:
103+
104+
- the value is an obvious placeholder such as `example`, `changeme`, `dummy`, `masked`, or `redacted`
105+
- the match only appears in comments or explanatory documentation
106+
88107
### Database Lifecycle
89108

90109
Heuristic patterns:
@@ -97,6 +116,11 @@ Routing guidance:
97116
- Emit high-confidence findings only when lifecycle handling is clearly absent.
98117
- Otherwise route to `needs_human_review`.
99118

119+
Do not report when:
120+
121+
- the connection/session is visibly closed later in the added code
122+
- transaction handling visibly includes both commit and rollback paths
123+
100124
## Finding Contract
101125

102126
Each finding should include at least:
@@ -116,9 +140,18 @@ Each finding should include at least:
116140
- Do not emit duplicate findings for the same category, file, and line
117141
- Route low-confidence items into warnings or human-review buckets
118142
- Redact secrets before persistence and reporting
143+
- Prefer suppressing obvious placeholders and safe examples over emitting low-value findings
119144

120145
## First-Pass Confidence Guidance
121146

122147
- `confidence >= 0.8`: final finding
123148
- `0.4 <= confidence < 0.8`: `needs_human_review`
124149
- `confidence < 0.4`: warning
150+
151+
## Phase-Two Quality Fixtures
152+
153+
- Positive / safe examples:
154+
- `safe_security_patterns.diff`
155+
- `managed_lifecycle.diff`
156+
- Boundary / negative examples:
157+
- `placeholder_secrets.diff`

0 commit comments

Comments
 (0)