Code generation for Go web APIs with clean architecture using Cobra CLI and native Go templates. Includes task management system and multi-database support.
This skill guides development of **Vibercode CLI** - a command-line tool for generating Go web APIs with clean architecture, built entirely in Go using Cobra CLI and native Go templates.
1. **Check Existing Tasks**: Always review `tasks.md` before adding new tasks
2. **Analyze Dependencies**: Identify task prerequisites and dependents
3. **Maintain Order**: Insert new tasks in correct dependency order for coherent development flow
4. **Document Details**: Create detailed task specification in `/tasks/` directory
When adding a new task:
1. Read current `tasks.md` to understand existing priorities
2. Identify which tasks must be completed before this task
3. Identify which tasks depend on this task
4. Insert task in correct position to maintain logical development flow
5. Create detailed task file in `/tasks/` directory
```
cmd/ # CLI commands
internal/
├── generator/ # Code generation logic
├── templates/ # Template strings
└── models/ # Data models
```
```
cmd/server/ # Application entry point
internal/
├── handlers/ # HTTP layer (Gin framework)
├── services/ # Business logic
├── repositories/ # Data access
└── models/ # Domain models & DTOs
pkg/database/ # Database utilities
```
1. **Use Go Native Templates**: Always use `text/template` package
2. **Helper Functions Available**:
- `ToCamel` - Convert to CamelCase
- `ToLowerCamel` - Convert to lowerCamelCase
- `ToSnake` - Convert to snake_case
- `ToKebab` - Convert to kebab-case
3. **Template Location**: All templates in `internal/templates/`
4. **No External Engines**: Never use Handlebars, Mustache, or other external template engines
Support these types in `internal/models/field.go`:
**Basic Types**:
**Special Types**:
**Relational Types**:
1. **Separation of Concerns**:
- Handlers: HTTP request/response only
- Services: Business logic only
- Repositories: Data access only
- Models: Data structures only
2. **Dependency Direction**: Dependencies flow inward (handlers → services → repositories)
3. **Error Handling**: Proper error propagation through layers
4. **Validation**: Input validation at handler layer
Before starting any development:
```bash
cat tasks.md
cat tasks/[task-name].md
grep -r "depends on" tasks/
```
When creating new generators:
```go
package generator
import (
"text/template"
"github.com/iancoleman/strcase"
)
// Define template with helper functions
tmpl := template.New("name").Funcs(template.FuncMap{
"ToCamel": strcase.ToCamel,
"ToLowerCamel": strcase.ToLowerCamel,
"ToSnake": strcase.ToSnake,
"ToKebab": strcase.ToKebab,
})
```
Priority order for database support:
1. **Supabase** (high priority)
2. PostgreSQL
3. MySQL
4. SQLite
Supabase integration must include:
Ensure generated code includes:
```go
"github.com/spf13/cobra" // CLI framework
"github.com/manifoldco/promptui" // Interactive prompts
"github.com/iancoleman/strcase" // String case conversion
```
```go
"github.com/gin-gonic/gin" // HTTP framework
"gorm.io/gorm" // ORM
"github.com/joho/godotenv" // Environment variables
"github.com/google/uuid" // UUID generation
// Database drivers: postgres, mysql, sqlite, supabase
```
1. **Unit Tests**: All generator functions
2. **Template Validation**: Ensure templates compile correctly
3. **Integration Tests**: Test with actual databases
4. **CLI Command Tests**: Verify command execution
```
generator_test.go # For generator functions
template_test.go # For template validation
integration_test.go # For database integration
```
1. **Check Task Dependencies**:
```bash
cat tasks.md
grep -r "new-feature" tasks/
```
2. **Update Task Documentation**:
```markdown
[Feature description]
1. Step 1
2. Step 2
...
```
3. **Implement Feature**:
4. **Test Integration**:
5. **Update Task Status**:
```markdown
```
When implementing Supabase support:
1. **Connection Setup**:
- Generate connection configuration
- Include API key management
- Set up connection pooling
2. **Auth Integration**:
- User authentication templates
- JWT token handling
- Row-level security
3. **Real-time Features**:
- Subscription setup
- Event handling templates
4. **Storage Integration**:
- File upload utilities
- Bucket configuration
1. **Major Architecture Changes**: Update CLAUDE.md
2. **New Tasks**: Add to `tasks.md` and create detail file in `/tasks/`
3. **Completed Tasks**: Update status in task files
4. **New Features**: Add usage examples and best practices
```
/tasks/
├── task-001-supabase-integration.md
├── task-002-auth-generation.md
└── ...
tasks.md # Main task list
CLAUDE.md # Project context and rules
README.md # User-facing documentation
```
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/vibercode-cli-go-project-development/raw