ワンクリックで
go-feature
Use when implementing a new feature, endpoint, or use case in a Go/Fiber backend with clean architecture and PostgreSQL
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Use when implementing a new feature, endpoint, or use case in a Go/Fiber backend with clean architecture and PostgreSQL
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Use when the user wants to free disk space, investigate disk usage, clean caches, remove unused artifacts, or when disk capacity is high. Also use when asked to "clean up", "free space", "disk full", or "what's using disk space". Always uses AskUserQuestion for every deletion decision.
Use at the start of every conversation and for every user message — orchestrates the full engineering skills suite by understanding intent, clarifying requirements interactively, and invoking the right skills
Use when refactoring Go code, cleaning up legacy codebases, optimizing performance, or enforcing clean architecture boundaries in a Go/Fiber backend
Use when refactoring Python code, cleaning up legacy codebases, optimizing performance, enforcing type safety, or improving clean architecture in a FastAPI backend
Use when refactoring React components, cleaning up legacy frontends, optimizing performance, improving component architecture, or reducing bundle size
Use when reviewing changed code before committing or after completing a feature — checks performance, architecture, type safety, and code quality against project standards
| name | go-feature |
| description | Use when implementing a new feature, endpoint, or use case in a Go/Fiber backend with clean architecture and PostgreSQL |
Layer-by-layer TDD workflow for Go/Fiber backends following clean architecture. Build inside-out: domain → application → infrastructure → interfaces.
Core principle: Every layer gets its own test before implementation. Never skip a layer.
// internal/domain/user.go
type User struct {
ID uuid.UUID
Email string
Name string
CreatedAt time.Time
}
func NewUser(email, name string) (*User, error) {
if email == "" {
return nil, ErrEmptyEmail
}
// validation...
}
Test first: Table-driven tests for all validation rules.
func TestNewUser(t *testing.T) {
tests := []struct {
name string
email string
wantErr error
}{
{"valid", "a@b.com", nil},
{"empty email", "", ErrEmptyEmail},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
_, err := NewUser(tt.email, "name")
assert.ErrorIs(t, err, tt.wantErr)
})
}
}
// internal/domain/user_repository.go
type UserRepository interface {
Create(ctx context.Context, user *User) error
GetByID(ctx context.Context, id uuid.UUID) (*User, error)
GetByEmail(ctx context.Context, email string) (*User, error)
}
// internal/application/create_user.go
type CreateUserUseCase struct {
repo domain.UserRepository
}
func (uc *CreateUserUseCase) Execute(ctx context.Context, input CreateUserInput) (*domain.User, error) {
// validate, create entity, persist
}
Test with mocks: Use testify/mock or manual mocks for the repository interface.
// internal/infrastructure/postgres/user_repository.go
type userRepository struct {
pool *pgxpool.Pool
}
Test with testcontainers: Real Postgres, real queries.
REQUIRED: Invoke go-integration-test for testcontainers patterns.
// internal/interfaces/http/user_handler.go
// CreateUser godoc
// @Summary Create a new user
// @Description Create a new user account
// @Tags users
// @Accept json
// @Produce json
// @Security BearerAuth
// @Param request body dto.CreateUserRequest true "Create user request"
// @Success 201 {object} dto.UserResponse
// @Failure 400 {object} pkg.ErrorResponse "Validation error"
// @Failure 401 {object} pkg.ErrorResponse "Unauthorized"
// @Failure 500 {object} pkg.ErrorResponse "Internal server error"
// @Router /api/v1/users [post]
func (h *UserHandler) Create(c fiber.Ctx) error {
body, err := pkg.ValidateBody[CreateUserRequest](c)
if err != nil {
return err // returns structured ErrorResponse automatically
}
result, err := h.useCase.Execute(c.Context(), body.ToDomain())
if err != nil {
return mapDomainError(err)
}
return c.Status(201).JSON(result.ToResponse())
}
Every handler MUST have swaggo annotations. Add example tags to DTO structs. Run swag init -g cmd/api/main.go -o docs after adding/changing handlers. See api-design for full annotation reference.
Use generic pkg.ValidateBody[T], pkg.ValidateQuery[T], pkg.ValidateParams[T] — never manually parse + validate. Validation uses struct tags (validate:"required,email") with go-playground/validator/v10. Supports default tags for zero-value defaults.
Test: Use app.Test(httptest.NewRequest(...)) for HTTP-level tests.
api := app.Group("/api/v1")
users := api.Group("/users")
users.Post("/", userHandler.Create)
users.Get("/:id", userHandler.GetByID)
| Layer | Package | Tests | Dependencies |
|---|---|---|---|
| Domain | internal/domain/ | Unit (table-driven) | None |
| Application | internal/application/ | Unit (mocked repo) | Domain |
| Infrastructure | internal/infrastructure/ | Integration (testcontainers) | Domain |
| Interfaces | internal/interfaces/http/ | HTTP (fiber test) | Application |
limit/offset), repo returns (items, total, error), handler wraps in PaginatedResponseUnitOfWork interface in domain, implemented in infrastructuresuperpowers:test-driven-development at each layercode-quality standards — no N+1 queries, batch operations, pre-allocated slices, indexed columns, O(n) not O(n^2)claude-md)db-migrate before implementing repositoryapi-design for request/response patterns