一键导入
code-review
Perform thorough code reviews with security, performance, and quality checks. Use when reviewing PRs, auditing code changes, or finding potential bugs.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Perform thorough code reviews with security, performance, and quality checks. Use when reviewing PRs, auditing code changes, or finding potential bugs.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
RESTful API design best practices. Use when designing endpoints, request/response schemas, error handling, and API versioning.
Database design and optimization. Use for schema design, queries, migrations, indexing, and performance tuning.
Systematic debugging methodology for finding and fixing bugs. Use when investigating issues, tracing errors, or fixing production problems.
Docker and containerization best practices. Use for Dockerfile creation, docker-compose, multi-stage builds, and container optimization.
Technical documentation best practices. Use for writing READMEs, API docs, code comments, and project documentation.
Git and GitHub workflow best practices. Use for commits, branches, PRs, merging, and version control operations.
| name | code-review |
| description | Perform thorough code reviews with security, performance, and quality checks. Use when reviewing PRs, auditing code changes, or finding potential bugs. |
Systematic code review process following industry best practices from Sentry, Trail of Bits, and Google engineering teams.
Before reviewing code:
// ❌ Bad: Ignoring errors
result, _ := doSomething()
// ✅ Good: Handle errors
result, err := doSomething()
if err != nil {
return fmt.Errorf("failed to do something: %w", err)
}
// ❌ Bad: Defer in loop
for _, item := range items {
f, _ := os.Open(item)
defer f.Close() // Won't close until function returns
}
// ✅ Good: Close immediately or use closure
for _, item := range items {
func() {
f, _ := os.Open(item)
defer f.Close()
// process f
}()
}
// ❌ Bad: Missing dependency in useEffect
useEffect(() => {
fetchData(userId);
}, []); // userId missing
// ✅ Good: Include all dependencies
useEffect(() => {
fetchData(userId);
}, [userId]);
// ❌ Bad: Inline object causing re-renders
<Component style={{ margin: 10 }} />
// ✅ Good: Stable reference
const style = useMemo(() => ({ margin: 10 }), []);
<Component style={style} />
-- ❌ Bad: SQL injection risk
query := "SELECT * FROM users WHERE id = " + userInput
-- ✅ Good: Parameterized query
query := "SELECT * FROM users WHERE id = $1"
db.Query(query, userInput)
// ❌ Bad feedback
"This code is wrong"
// ✅ Good feedback
"This might cause a race condition when multiple goroutines access `sharedMap`.
Consider using `sync.RWMutex` or `sync.Map` for thread-safe access."
// Instead of just pointing out the issue, show the fix:
**Issue**: Potential nil pointer dereference
**Current code**:
```go
return user.Name
Suggested fix:
if user == nil {
return ""
}
return user.Name
---
# 🔐 Security Review Focus
## OWASP Top 10 Checklist
1. **Injection** - SQL, NoSQL, OS command injection
2. **Broken Authentication** - Session management, credential storage
3. **Sensitive Data Exposure** - Encryption, data masking
4. **XML External Entities** - XXE attacks
5. **Broken Access Control** - Authorization checks
6. **Security Misconfiguration** - Default credentials, error messages
7. **Cross-Site Scripting (XSS)** - Input/output encoding
8. **Insecure Deserialization** - Object validation
9. **Known Vulnerabilities** - Dependency versions
10. **Insufficient Logging** - Audit trails
---
# 📚 References
- [Google Code Review Guidelines](https://google.github.io/eng-practices/review/)
- [getsentry/code-review](https://github.com/getsentry/skills/tree/main/plugins/sentry-skills/skills/code-review)
- [trailofbits/differential-review](https://github.com/trailofbits/skills/tree/main/plugins/differential-review)
- [obra/requesting-code-review](https://github.com/obra/superpowers/blob/main/skills/requesting-code-review/SKILL.md)