com um clique
code-review
// Reviews code for correctness and potential bugs, pinpoints bug locations by file and line, and suggests concrete fixes. Use when the user asks for a code review, wants to find bugs, or mentions reviewing code or changes.
// Reviews code for correctness and potential bugs, pinpoints bug locations by file and line, and suggests concrete fixes. Use when the user asks for a code review, wants to find bugs, or mentions reviewing code or changes.
Develops Go microservices with Kratos v2 following official design philosophy, DDD/Clean Architecture layout, Protobuf API, error/config/middleware patterns, and observability. Use when building or modifying Kratos services, wiring servers, writing proto APIs, middleware, errors, config, or when the user mentions Kratos, go-kratos, kratos-layout, or microservice framework conventions.
Implements backend modules from proto definitions for goddess, marksman, and rabbit apps. Keeps style consistent with existing project structure, reuses magicbox and in-app code, follows Go and project conventions, and requires syncing README (API overview, features, usage) when adding, modifying, or removing modules or APIs. Use when the user says "帮我完成某某功能" or manually @ this skill to implement a module based on proto.
| name | code-review |
| description | Reviews code for correctness and potential bugs, pinpoints bug locations by file and line, and suggests concrete fixes. Use when the user asks for a code review, wants to find bugs, or mentions reviewing code or changes. |
Review the given code for correctness and potential bugs. For each issue found, report the exact location (file and line) and provide a recommended fix.
GET /v1/resource/simple while GET /v1/resource/{id} exists causes the former URL to be matched as id=simple and can lead to parse errors (e.g. strconv.ParseInt "parsing "simple": invalid syntax"). Check that no new path is a prefix or literal segment that would be captured by an existing path parameter.Use this structure for the review:
# Code Review
## Summary
[1–2 sentence overview: scope and overall risk level]
## Findings
### [Severity] Brief title
- **Location**: `path/to/file.ext:LINE` (and optional `:END_LINE` if spanning multiple lines)
- **Issue**: What is wrong and why it can cause a bug.
- **Recommendation**: Concrete fix (code snippet or step-by-step change).
---
[Repeat for each finding]
Severity:
google.api.http or generated *_http.pb.go), verify that no new path is matched by an existing parameterized route (e.g. /v1/foo/{id} matching /v1/foo/simple). Resolve by using a distinct path prefix (e.g. /v1/foos/simple) or extra segment.path:line (and line range if needed). Do not say "somewhere in this function" without the line.### [High] Possible nil pointer dereference
- **Location**: `app/service/user.go:42`
- **Issue**: `u` may be nil when `FindByID` returns no user; calling `u.Name` can panic.
- **Recommendation**: Check and handle nil before use:
if u == nil {
return nil, ErrUserNotFound
}
return u.Name, nil