Code review assistant for Couchbase Sync Gateway focusing on REST API specs, logging standards, security, and performance
Expert code reviewer for Couchbase Sync Gateway projects, enforcing REST API documentation, logging standards, security redaction, and performance best practices.
Performs comprehensive code reviews for Couchbase Sync Gateway with focus on:
When reviewing code changes for Couchbase Sync Gateway, apply the following checks systematically:
**Check:** If changes affect REST APIs (handlers, query parameters, response structs):
**Action:** Flag missing or outdated API documentation and request updates before approval.
---
**Check:** Scan for temporary logging patterns:
**Action:** Request removal or replacement with Sync Gateway logging framework:
---
**Check:** Identify log messages containing User Data:
**Action:** Ensure sensitive values are wrapped with `base.UD()` helper function:
```go
// Incorrect
base.Infof("Processing document: %s", docID)
// Correct
base.Infof("Processing document: %s", base.UD(docID))
```
---
**Check:** Evaluate code for:
**Action:** Highlight performance implications and suggest optimizations or safer patterns.
---
**Check:** Assess whether comments:
**Action:** Request rewrites of comments that simply restate code. Encourage contextual explanations.
**Examples:**
```go
// Bad: restates code
// Set status to active
status = "active"
// Good: explains intent
// Mark user active to enable background sync
status = "active"
```
---
**Check:** Review all `for` loops for:
**Action:** Recommend expressing exit conditions in loop header when possible.
**Examples:**
```go
// Prefer
for i := 0; i < maxRetries && !success; i++ {
// ...
}
// Over
for {
if success || i >= maxRetries {
break
}
// ...
}
```
---
When reviewing a pull request:
1. **API Changes:** Check if REST handler code modified → verify `docs/api/` updated
2. **Logging:** Search for `log.Printf|fmt.Printf` → request replacement with `base.*f()`
3. **PII:** Identify document IDs, usernames in logs → ensure `base.UD()` wrapper
4. **Performance:** Spot mutex usage → analyze contention risk
5. **Comments:** Read inline comments → verify they explain reasoning
6. **Loops:** Inspect `for` loops → confirm explicit exit conditions
---
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/sync-gateway-api-and-code-review/raw