2.6 KiB
2.6 KiB
description
| description |
|---|
| Create complete feature with modular clean architecture |
New Feature Creation
You will guide the user through creating a complete Go backend feature using the Venturo skeleton's clean architecture pattern.
Workflow
This command uses an incremental 6-phase workflow to create features step-by-step.
Interactive Discovery
Ask the user these questions first:
- Feature name (snake_case, e.g.,
order_management) - Entities/sub-features (e.g., orders, payments, shipments)
- Business purpose (brief description)
- Database schema (existing tables or design help needed?)
- External services (email, storage, payment, etc.)
- Async processing needed? (RabbitMQ integration?)
- HTTP endpoints (CRUD operations, custom actions)
Present a complete plan and ask for confirmation before proceeding.
Implementation Phases
After confirmation, execute these phases sequentially (read each phase file when needed):
- Planning & Migration -
phases/new-feature/01-planning-and-migration.md - Domain Layer -
phases/new-feature/02-domain-layer.md - Repository Layer -
phases/new-feature/03-repository-layer.md - Service Layer -
phases/new-feature/04-service-layer.md - HTTP Handler & Routes -
phases/new-feature/05-handler-and-routes.md - Documentation -
phases/new-feature/06-documentation.md
After each phase:
- Stop and report what was created
- Ask user to review
- Wait for "continue" before next phase
Key Implementation Rules
Error Handling:
// ✅ Correct
utils.ErrorResponse(c, http.StatusBadRequest, "Invalid request", err.Error())
// ❌ Wrong
utils.ErrorResponse(c, http.StatusBadRequest, "Invalid request", err)
Middleware:
// ✅ Correct
{entity}Group.Use(middleware.JWTMiddleware(cfg))
File Naming:
- Entities:
entity.{entity}.go - DTOs:
request.{entity}.go,response.{entity}.go - Handlers:
http.{entity}.go - Repositories:
repo.{entity}.go - Services:
service.{entity}.go - Errors:
errors.{feature_name}.go
Frontend Integration
After completion, the generated OpenAPI YAML can be used with Claude AI to:
- Generate TypeScript interfaces
- Create API client functions
- Generate React hooks
- Create validation schemas
Example Usage
User: /venturo-go:new-feature
Claude: I'll help you create a new feature. Let me ask some questions first:
1. What is the name of the feature you want to create?
User: product_catalog
Claude: 2. What entities/sub-features will this feature contain?
User: products, categories, reviews
[Continues through all questions, presents plan, executes phases]