new-service
Scaffold a new Go microservice with the standard Kensan layered architecture
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Menu
Scaffold a new Go microservice with the standard Kensan layered architecture
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Baseado na classificação ocupacional SOC
| name | new-service |
| description | Scaffold a new Go microservice with the standard Kensan layered architecture |
| argument-hint | ["service-name"] |
| disable-model-invocation | true |
Create a new microservice $ARGUMENTS[0] following the Kensan backend conventions.
Read backend/ARCHITECTURE.md and an existing service (e.g., backend/services/memo/) for reference.
backend/services/$0/
├── cmd/main.go
├── internal/
│ ├── model.go
│ ├── handler/handler.go
│ ├── service/service.go
│ ├── service/interface.go
│ ├── service/service_test.go
│ └── repository/
│ ├── interface.go
│ └── repository.go
├── Dockerfile
└── Makefile
cmd/main.go: Use bootstrap.New("$0") for initialization. Register routes with svc.RegisterRoutes() and svc.RegisterPublicRoutes() as needed.
internal/model.go: Define domain types and DTOs. All entities must have ID, UserID, CreatedAt, UpdatedAt.
internal/repository/interface.go: Define repository interface following ISP (split by entity if multiple).
internal/repository/repository.go: PostgreSQL implementation using pgx. All queries must include WHERE user_id = $1. Use pgx.ErrNoRows → errors.NotFound().
internal/service/interface.go: Define service interface (Reader + Writer pattern).
internal/service/service.go: Business logic. Use shared/errors for domain errors. Accept ctx context.Context and userID string as first parameters.
internal/service/service_test.go: Table-driven tests with mock repository.
internal/handler/handler.go: HTTP handlers. Use middleware.GetUserID(r.Context()), middleware.JSON(), middleware.Error(). Follow the error mapping pattern.
Dockerfile: Copy from existing service, update binary name.
Makefile: Copy from existing service, update service name.
Database migration: If needed, create backend/migrations/NNN_create_$0_tables.sql with user_id, UUID PKs, timestamps, and update trigger.
docker-compose.yml: Add service entry with appropriate port.
cd backend && make test to verify compilationbackend/ARCHITECTURE.md service listRun both frontend and backend builds to verify everything compiles
Add a new API endpoint to an existing service with full-stack integration (backend handler + frontend API service + store)
Create a new frontend page with routing, store, and API service following Kensan conventions
Review uncommitted changes for security issues, code quality, and best practices
Run Go backend tests, analyze failures, and auto-fix