go-service-gen

Generate Go ServiceImpl, DAO interfaces, and DAOImpl scaffolding from a Service interface.

Updated May 11, 2025
One-click install
npx skills add https://github.com/LeiZhang-Hunter/nova-factory-server --skill go-service-gen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-service-gen
Source: https://github.com/LeiZhang-Hunter/nova-factory-server/tree/main/.trae/skills/go-service-gen
Command: npx skills add https://github.com/LeiZhang-Hunter/nova-factory-server --skill go-service-gen

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the repetitive work of manually writing boilerplate Go code for the project’s four-layer architecture (Service Interface → ServiceImpl → DAO Interface → DAOImpl), ensuring consistency in structure, responsibilities, and documentation.

Core Features & Use Cases

  • ServiceImpl auto-generation: Creates the Service implementation that delegates method calls to the corresponding DAO, following the required file path and struct/callback conventions.
  • DAO interface auto-generation: Generates DAO interfaces with method responsibilities aligned to the Service needs.
  • DAOImpl CRUD scaffolding: Produces DAO implementations using gorm and the project’s context utilities (e.g., user/department info), including table naming behavior and baseline CRUD methods.
  • Use Case: When you define a new dataset-related Service interface (e.g., under aidatasetservice) and need consistent persistence and service-layer code immediately, this Skill generates the full scaffolding so you can focus on business rules rather than plumbing.

Quick Start

Ask the AI to generate the missing ServiceImpl and DAO/DAOImpl code for your new I<Name> Service interface, producing files in the specified aidatasetserviceimpl and aidatasetdao locations with complete Go-style comments.

Frequently Asked Questions about go-service-gen

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate Go service layer and DAO scaffolding automatically?

To generate Go service layer scaffolding, you define a Service interface and the tool produces the ServiceImpl, DAO interface, and DAOImpl files automatically. It delegates default method calls to the corresponding DAO, ensuring clean separation across your architecture.

How does gorm-based DAO CRUD scaffolding work in a Go four-layer architecture?

Gorm-based DAO CRUD scaffolding generates DAO implementation files that use gorm for persistence and project context utilities like user and department. It applies table naming behavior and baseline CRUD methods to maintain consistent repository architecture separation.

Can I use this to generate Go code for a new dataset service interface?

Yes, you can generate Go code for a new dataset service interface. When you define a new Service interface, the tool creates the missing ServiceImpl and DAO files in specified locations, allowing you to immediately focus on business rules rather than boilerplate plumbing.

What is the best way to structure Go controller, service, and DAO layers?

The best way to structure Go controller, service, and DAO layers is using a four-tier architecture where ServiceImpl delegates to a DAO interface. This approach enforces consistent responsibilities, file paths, struct signatures, and documentation across modules.

Do I need to manually write gorm CRUD methods for every new Go service module?

No, you do not need to manually write gorm CRUD methods for every new Go service module. The scaffolding tool produces baseline DAO implementations with standard CRUD behavior and table naming automatically, reducing repetitive boilerplate coding.