From gopilot
Add a new business domain to the Go backend with repository, service, and types following domain-driven architecture. Use when adding a new feature area like items, bookings, users, etc.
npx claudepluginhub bishwas-py/gopilot --plugin gopilotThis skill uses the workspace's default tool permissions.
You are adding a new domain to the Go backend. Domains are isolated business areas with their own types, repository (DB access), and service (business logic).
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Guides MCP server integration in Claude Code plugins via .mcp.json or plugin.json configs for stdio, SSE, HTTP types, enabling external services as tools.
You are adding a new domain to the Go backend. Domains are isolated business areas with their own types, repository (DB access), and service (business logic).
skills/_shared/go-patterns.md for conventionsreferences/architecture.md for the architecture overviewbackend/internal/api/router.go to see existing domainsParse $ARGUMENTS as: [domain-name]
item, booking, user)Create the domain package at backend/internal/domain/[name]/:
package [name]
import "time"
type [Name] struct {
ID string `json:"id"`
// Add fields based on user's description
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
package [name]
import (
"context"
"github.com/jackc/pgx/v5/pgxpool"
)
type Repository struct {
pool *pgxpool.Pool
}
func NewRepository(pool *pgxpool.Pool) *Repository {
return &Repository{pool: pool}
}
// Add methods: List, GetByID, Create, Update, Delete
// Use pgx directly — no ORM
// Always accept context.Context as first parameter
// Return (result, error) tuples
package [name]
type Service struct {
repo *Repository
}
func NewService(repo *Repository) *Service {
return &Service{repo: repo}
}
// Business logic methods that call repository
// Validation, authorization checks, side effects go here
// Services know nothing about HTTP
Add the table to backend/schema.sql:
CREATE TABLE IF NOT EXISTS [name]s (
id TEXT PRIMARY KEY DEFAULT gen_random_uuid()::text,
-- fields based on domain types
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
TEXT for IDs (UUIDs stored as text)TIMESTAMPTZ for all timestampsUpdate backend/internal/api/router.go:
[name]Repo := [name].NewRepository(pool)[name]Svc := [name].NewService([name]Repo)/gopilot:api)go vet ./... in backendgo build ./... to check compilation[name] created. Add API endpoints with /gopilot:api [name] list|get|create|update|delete."http.Request, no status codes