Token导航 LogoToken导航TokenDH.com
前端设计只读github未标认证来源可访问许可证需确认审计通过

go-create-service去创建服务

Agent Skill

go-create-service 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

188

周安装

8

GitHub Stars

公开资料未说明

下载量

66
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:go-create-service(去创建服务)
来源仓库:https://github.com/cristiano-pacheco/ai-rules
仓库路径:skills/go-create-service
安装命令:
npx skills add https://github.com/cristiano-pacheco/ai-rules --skill go-create-service
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/cristiano-pacheco/ai-rules --skill go-create-service

简介

用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中围绕仓库状态进行整理。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装,需确认权限范围。
  • 使用前建议核验是否会触发联网或文件读写操作。
  • go-create-service 属于前端设计类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Go Create Service

Generate service files for GO modular architechture conventions.

Three-File Pattern

Every service requires up to three files:

  1. DTO structs (if needed): internal/modules/<module>/dto/<service_name>_dto.go
  2. Port interface: internal/modules/<module>/ports/<service_name>_service.go
  3. Service implementation: internal/modules/<module>/service/<service_name>_service.go

DTO File Layout Order

  1. Input/output structs

Port File Layout Order

  1. Interface definition (XxxService — no suffix)

Service File Layout Order

  1. Implementation struct (XxxService)
  2. Compile-time interface assertion
  3. Constructor (NewXxxService)
  4. Methods

DTO Structure

Location: internal/modules/<module>/dto/<service_name>_dto.go

package dto

type DoSomethingInput struct {
	Field string
}

Port Interface Structure

Location: internal/modules/<module>/ports/<service_name>_service.go

package ports

import (
	"context"

	"github.com/cristiano-pacheco/pingo/internal/modules/<module>/dto"
)

type DoSomethingService interface {
	Execute(ctx context.Context, input dto.DoSomethingInput) error
}

Service Implementation Structure

Location: internal/modules/<module>/service/<service_name>_service.go

package service

import (
	"context"

	"github.com/cristiano-pacheco/bricks/pkg/logger"
    "github.com/cristiano-pacheco/bricks/pkg/otel/trace"
	"github.com/cristiano-pacheco/pingo/internal/modules/<module>/dto"
	"github.com/cristiano-pacheco/pingo/internal/modules/<module>/ports"
)

type DoSomethingService struct {
	logger logger.Logger
	// other dependencies
}

var _ ports.DoSomethingService = (*DoSomethingService)(nil)

func NewDoSomethingService(
	logger logger.Logger,
) *DoSomethingService {
	return &DoSomethingService{
		logger: logger,
	}
}

func (s *DoSomethingService) Execute(ctx context.Context, input dto.DoSomethingInput) error {
	ctx, span := trace.Span(ctx, "DoSomethingService.Execute")
	defer span.End()

	// Business logic here
	// if err != nil {
	// 	s.logger.Error("DoSomethingService.Execute failed", logger.Error(err))
	// 	return err
	// }

	return nil
}

Service Variants

Single-action service (Execute pattern)

Use Execute method with a dedicated input struct when the service does one thing.

DTO (dto/send_email_confirmation_dto.go):

type SendEmailConfirmationInput struct {
	UserModel             model.UserModel
	ConfirmationTokenHash []byte
}

Port (ports/send_email_confirmation_service.go):

type SendEmailConfirmationService interface {
	Execute(ctx context.Context, input dto.SendEmailConfirmationInput) error
}

Multi-method service (named methods)

Use descriptive method names when the service groups related operations.

Port (ports/hash_service.go):

type HashService interface {
	GenerateFromPassword(password []byte) ([]byte, error)
	CompareHashAndPassword(hashedPassword, password []byte) error
	GenerateRandomBytes() ([]byte, error)
}

Stateless service (no dependencies)

Omit logger and config when the service is a pure utility with no I/O.

type HashService struct{}

func NewHashService() *HashService {
	return &HashService{}
}

Tracing

Services performing I/O MUST use trace.Span. Pure utilities (hashing, template compilation) skip tracing.

ctx, span := trace.Span(ctx, "ServiceName.MethodName")
defer span.End()

Span name format: "StructName.MethodName"

## Naming

- Port interface: `XxxService` (in `ports` package, no suffix)
- Implementation struct: `XxxService` (in `service` package, same name — disambiguated by package)
- Constructor: `NewXxxService`, returns a pointer of the struct implementation

## Fx Wiring

Add to `internal/modules/<module>/fx.go`:

fx.Provide( fx.Annotate( service.NewXxxService, fx.As(new(ports.XxxService)), ), ),


## Dependencies

Services depend on interfaces only. Common dependencies:

- `logger.Logger` — structured logging
- Other `ports.XxxService` interfaces — compose services
- `ports.XxxRepository` — data access
- `ports.XxxCache` — caching layer

## Error Logging Rule

- Always use the Bricks logger package: `github.com/cristiano-pacheco/bricks/pkg/logger`
- Every time a service method returns an error, log it immediately before returning
- Preferred pattern:

if err != nil { s.logger.Error("ServiceName.MethodName failed", logger.Error(err)) return err }


## Critical Rules

1. **Three files**: DTOs in `dto/`, port interface in `ports/`, implementation in `service/`
2. **Interface in ports**: Interface lives in `ports/<name>_service.go`
3. **DTOs in dto**: Input/output structs live in `dto/<name>_dto.go`
4. **Interface assertion**: Add `var _ ports.XxxService = (*XxxService)(nil)` below the struct
5. **Constructor**: MUST return pointer `*XxxService`
6. **Tracing**: Every I/O method MUST use `trace.Span` with `defer span.End()`
7. **Context**: Methods performing I/O accept `context.Context` as first parameter
8. **No comments on implementations**: Do not add redundant comments above methods in the implementations
9. **Add detailed comment on interfaces**: Provide comprehensive comments on the port interfaces to describe their purpose and usage
10. **Dependencies**: Always depend on port interfaces, never concrete implementations
11. **Error logging**: Every returned error must be logged first using Bricks logger (`s.logger.Error(..., logger.Error(err))`)

## Workflow

1. Create DTO file in `dto/<name>_dto.go` (if input/output structs are needed)
2. Create port interface in `ports/<name>_service.go`
3. Create service implementation in `service/<name>_service.go`
4. Add Fx wiring to module's `module.go` (or `fx.go`)
5. Run `make lint` to verify
6. Run `make nilaway` for static analysis

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.4%
按下载量换算23

Claude

30.36%
按下载量换算20

Cursor

19.5%
按下载量换算13

Gemini CLI

9.17%
按下载量换算6

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills