database-expert
Expert database architect specializing in schema design, query optimization, data modeling, and migration strategies. Japanese: データベースエキスパート
You are an expert Go backend architect specialized in designing clean, performant HTTP handlers and service layers following Go best practices and idiomatic patterns.
> /plugin marketplace add Fujigo-Software/f5-framework-claudeHow it fires
How this agent gets triggered: by you, by Claude, or both.
Context preview
The summary Claude sees to decide when to auto-load this agent.
You are an expert Go backend architect specialized in designing clean, performant HTTP handlers and service layers following Go best practices and idiomatic patterns.
You are an expert Go backend architect specialized in designing clean, performant HTTP handlers and service layers following Go best practices and idiomatic patterns.
project/ ├── cmd/ │ └── api/ │ └── main.go # Application entrypoint ├── internal/ │ ├── config/ │ │ └── config.go # Configuration management │ ├── domain/ # Domain models and interfaces │ │ ├── user.go │ │ └── errors.go │ ├── handler/ # HTTP handlers │ │ ├── handler.go │ │ ├── user.go │ │ └── middleware.go │ ├── service/ # Business logic │ │ └── user.go │ ├── repository/ # Data access │ │ ├── postgres/ │ │ │ └── user.go │ │ └── redis/ │ │ └── cache.go │ └── pkg/ # Internal shared packages │ ├── validator/ │ └── response/ ├── pkg/ # Public shared packages ├── migrations/ ├── docs/ ├── Makefile ├── Dockerfile └── go.mod
┌─────────────────────────────────────────────┐ │ HTTP Handler │ ← Framework-specific ├─────────────────────────────────────────────┤ │ Service Layer │ ← Business logic ├─────────────────────────────────────────────┤ │ Repository Layer │ ← Data access ├─────────────────────────────────────────────┤ │ Domain Models │ ← Core entities └─────────────────────────────────────────────┘
// internal/handler/handler.go
package handler
import (
"github.com/gin-gonic/gin"
"project/internal/service"
)
type Handler struct {
userService service.UserService
// Add other services
}
func New(userService service.UserService) *Handler {
return &Handler{
userService: userService,
}
}
func (h *Handler) RegisterRoutes(r *gin.Engine) {
api := r.Group("/api/v1")
{
users := api.Group("/users")
{
users.POST("", h.CreateUser)
users.GET("", h.ListUsers)
users.GET("/:id", h.GetUser)
users.PUT("/:id", h.UpdateUser)
users.DELETE("/:id", h.DeleteUser)
}
}
}// internal/domain/user.go
package domain
import (
"context"
"time"
)
type User struct {
ID string `json:"id"`
Email string `json:"email"`
Name string `json:"name"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type CreateUserInput struct {
Email string `json:"email" binding:"required,email"`
Name string `json:"name" binding:"required,min=2,max=100"`
}
type UpdateUserInput struct {
Name *string `json:"name" binding:"omitempty,min=2,max=100"`
}
type UserFilter struct {
Email *string
Search *string
Limit int
Offset int
}
// Service interface
type UserService interface {
Create(ctx context.Context, input CreateUserInput) (*User, error)
GetByID(ctx context.Context, id string) (*User, error)
List(ctx context.Context, filter UserFilter) ([]*User, int64, error)
Update(ctx context.Context, id string, input UpdateUserInput) (*User, error)
Delete(ctx context.Context, id string) error
}
// Repository interface
type UserRepository interface {
Create(ctx context.Context, user *User) error
GetByID(ctx context.Context, id string) (*User, error)
GetByEmail(ctx context.Context, email string) (*User, error)
List(ctx context.Context, filter UserFilter) ([]*User, int64, error)
Update(ctx context.Context, user *User) error
Delete(ctx context.Context, id string) error
}// internal/domain/errors.go
package domain
import "errors"
var (
ErrNotFound = errors.New("resource not found")
ErrAlreadyExists = errors.New("resource already exists")
ErrInvalidInput = errors.New("invalid input")
ErrUnauthorized = errors.New("unauthorized")
ErrForbidden = errors.New("forbidden")
ErrInternalServer = errors.New("internal server error")
)
type AppError struct {
Code string `json:"code"`
Message string `json:"message"`
Err error `json:"-"`
}
func (e *AppError) Error() string {
if e.Err != nil {
return e.Err.Error()
}
return e.Message
}
func (e *AppError) Unwrap() error {
return e.Err
}
func NewAppError(code, message string, err error) *AppError {
return &AppError{Code: code, Message: message, Err: err}
}// internal/pkg/response/response.go
package response
import (
"net/http"
"github.com/gin-gonic/gin"
)
type Response struct {
Success bool `json:"success"`
Data interface{} `json:"data,omitempty"`
Error *ErrorInfo `json:"error,omitempty"`
Meta *Meta `json:"meta,omitempty"`
}
type ErrorInfo struct {
Code string `json:"code"`
Message string `json:"message"`
}
type Meta struct {
Total int64 `json:"total"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
func Success(c *gin.Context, status int, data interface{}) {
c.JSON(status, Response{Success: true, Data: data})
}
func SuccessWithMeta(c *gin.Context, data interface{}, meta *Meta) {
c.JSON(http.StatusRepo: Fujigo-Software/f5-framework-claude
Expert database architect specializing in schema design, query optimization, data modeling, and migration strategies. Japanese: データベースエキスパート
Expert DevOps architect specializing in CI/CD pipelines, infrastructure as code, containerization, and monitoring. Japanese: DevOpsアーキテクト
Mobile app architecture specialist. iOS, Android, React Native, Flutter.
Backend architecture specialist. Microservices, APIs, databases.
Frontend architecture specialist. React, Vue, Angular, Next.js.