skills/go-review-ddd/SKILL.md
DDD architecture review for Go projects enforcing layer boundaries, pointer semantics, and domain-driven design patterns.
npx skillsauth add jcleira/agent-skills go-review-dddInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Comprehensive review of Go code for pointer semantics, test coverage, and best practices.
This skill enforces opinionated conventions for DDD-based Go projects:
*T for all model/entity typesinternal/app/, internal/infra/ layoutStandard Go guidance may differ (see go-style skill). These are project-specific conventions prioritizing consistency and architectural clarity over micro-optimization.
Review Go code for correct pointer and value semantics using the "pointer-first" approach.
*T for all model/entity types by defaultstring, int, bool, etc. as valuesWhen reviewing Go code, check and flag issues for:
T instead of *T// Issue: should use pointer
func ProcessUser(user User) { ... }
// Correct
func ProcessUser(user *User) { ... }
[]T instead of []*T// Issue: should use pointer slice
func GetUsers() []User { ... }
// Correct
func GetUsers() []*User { ... }
// Issue: should use pointer receiver
func (u User) UpdateName(name string) { ... }
// Correct
func (u *User) UpdateName(name string) { ... }
T instead of *T// Issue: should return pointer
func NewUser(name string) User { ... }
// Correct
func NewUser(name string) *User { ... }
When reviewing, report findings as:
**Go Pointer Review**
Issues found:
- `file.go:42` - `ProcessUser(user User)` should use `*User`
- `file.go:58` - `[]User` should be `[]*User`
No issues:
- Factory functions correctly return pointers
- Method receivers use pointer semantics
When reviewing files in handlers/, services/, or repositories/ directories, check for test coverage.
_test.go file exists for the file being reviewed_test.go file exist?**Test Coverage Review**
Missing test file:
- `handlers/user.go` has no corresponding `handlers/user_test.go`
Missing test coverage:
- `CreateUser()` has no test coverage
- `DeleteUser()` error path not tested
Offer: Would you like me to create test scaffolding for the missing tests?
This check runs when reviewing:
handlers/ directoryservices/ directoryrepositories/ directoryVerify code follows clean architecture layer boundaries.
cmd/api/main.go → Entry point, dependency wiring
internal/app/aggregates/ → Domain entities
internal/app/services/ → Domain services (business logic)
internal/app/usecases/ → Application use cases
internal/infra/http/handlers/→ HTTP handlers (thin, delegate to services)
internal/infra/http/server/ → Router configuration
internal/infra/repositories/ → External service clients
internal/app/// Issue: handler contains business logic
func (h *UserHandler) Create(w http.ResponseWriter, r *http.Request) {
// Validation, transformation, orchestration here = wrong
}
// Correct: handler delegates to service
func (h *UserHandler) Create(w http.ResponseWriter, r *http.Request) {
result, err := h.userService.Create(ctx, req)
// Only HTTP concerns: parse request, write response, log errors
}
Services should follow the one-file-per-method pattern.
services/<name>/
├── service.go # Service struct, constructor, repository interfaces
├── <method>.go # One file per public method
└── ...
service.go contains method implementations beyond constructor// services/orchestration/service.go - ONLY contains:
type Service struct { ... }
type NotionRepository interface { ... }
func New(...) *Service { ... }
// services/orchestration/process_task.go - Contains:
func (s *Service) ProcessTask(...) { ... }
Repositories are interfaces defined by the service that uses them, not by the implementation.
internal/infra/repositories/service.go// Correct: interface in service.go
// services/llm/service.go
type Repository interface {
Process(ctx context.Context, request *Request) (*Response, error)
HealthCheck(ctx context.Context) error
}
// Issue: interface in repository package
// infra/repositories/claude/repository.go
type Repository interface { ... } // Wrong location!
Errors should be wrapped with context and logged at appropriate levels.
log.Println instead of structured loggingfmt.Errorf("failed to X: %w", err) pattern// Issue: no context
return err
// Issue: logging in service
func (s *Service) Process() error {
log.Println("error:", err) // Wrong!
return err
}
// Correct: wrap with context
return fmt.Errorf("failed to process task %s: %w", taskID, err)
// Correct: log at handler level with structured logging
logger.ErrorContext(ctx, "failed to process request", "error", err, "task_id", taskID)
Follow consistent naming patterns for types and files.
| Type | File Name | Type Name |
|------|-----------|-----------|
| Service | <domain>/service.go | type Service struct |
| Repository | <provider>/repository.go | type Repository struct |
| Handler | <name>_handler.go | type <Name>Handler struct |
ServiceRepository_handler.go<Name>Handler// Issue
type UserService struct { ... } // Should be: type Service struct
type ClaudeRepository struct { ... } // Should be: type Repository struct
type WebhookController struct { ... }// Should be: type WebhookHandler struct
// Correct
type Service struct { ... } // in services/user/service.go
type Repository struct { ... } // in repositories/claude/repository.go
type WebhookHandler struct { ... } // in handlers/webhook_handler.go
This skill auto-invokes after writing or modifying Go files. It checks:
development
Go style and idioms from official Go Code Review Comments wiki.
development
Repository pattern review for Go codebases using Jet ORM, domain models, and adapter patterns.
development
Review Go code using Gin framework for routing patterns, middleware usage, request/response handling, and error conventions.
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.