All skills
gogf avatar

/goframe-v2

@911705d
by GoFramegogf/skills81 stars
3

GoFrame v2 development skill. Use only when the target Go project uses or is explicitly adopting GoFrame v2: the nearest go.mod requires github.com/gogf/gf/v2, existing Go files import github.com/gogf/gf/v2 or any github.com/gogf/gf/v2/... component package, or the user asks to scaffold, migrate, or build with GoFrame. Trigger for GoFrame-backed Go work such as APIs/controllers/services, middleware, routing/config, ORM/DAO/DO/entity/database operations, gf CLI/codegen, HTTP/gRPC services, and microservice conventions. Do not trigger for generic Go projects without GoFrame evidence, frontend-only work, shell scripts, or unrelated infrastructure tasks.

Use this Skill: https://skilld.dev/gh/gogf/skills/goframe-v2

This session only. Nothing lands on disk.

references开发工具开发工具.md

≈909 tokens on demand. Your agent reads this file only when SKILL.md points to it.

GoFrame 框架提供了功能强大的 gf 命令行开发辅助工具,是框架发展的一个重要组成部分,工具地址:

工具安装请参考仓库页面。工具安装成功后,可以通过 gf 或者 gf -h 查看所有支持的命令。复杂的命令可以通过 gf COMMAND -h 查看更详细的使用帮助信息,例如: gf gen -h。

工具职责

  1. 简化工程开发,提高开发效率
  2. 支持框架工程设计规范准确落地

注意事项

  1. 部分命令需要您先安装好 Golang 基础的开发环境,环境安装具体请参考 环境安装 章节。
  2. 最新的 CLI 工具版本会随着最新的框架版本走。

配置支持

工具的所有命令均同时支持命令行及配置文件配置参数,以提高易用性。当给定命令行参数时优先读取命令行参数,如果命令行参数不存在时,自动读取配置文件中对应的参数名称。

配置文件路径优先查找当前目录下的 hack 目录( hack/config.yaml),其次按照框架默认的配置路径检索配置文件。框架默认的配置文件检索路径请参考章节: 配置管理-文件配置

配置文件的格式示例:

# GoFrame CLI tool configuration.
gfcli:
  gen:
    dao:
    - link:            "mysql:root:12345678@tcp(127.0.0.1:3306)/test"
      tables:          "user"
      removePrefix:    "gf_"
      descriptionTag:  true
      noModelComment:  true

  docker:
    build: "-a amd64 -s linux -p temp"
    tagPrefixes:
    - ccr.ccs.tencentyun.com/xxx
    - hkccr.ccs.tencentyun.com/xxx
    - sgccr.ccs.tencentyun.com/xxx

注意以上配置示例仅供参考,具体配置项请参考具体命令帮助。

工具调试

当在工具的使用中遇到问题时,可以尝试打开工具的调试模式获得更详细的工具执行日志信息,打开工具调试模式可以通过 debug 命令行选项开启,例如:

gf build main.go --debug

由于 gf 工具也是使用 GoFrame 框架开发,因此调试信息的开启也是同框架方式一致,更详细的介绍请参考框架介绍文档: 调试模式

命令总览

当前帮助文档以 gf cli v2.0.0 版本为例进行简单的介绍,详细的介绍信息请查看命令行帮助信息。本章内容信息可能会有滞后,最新的具体详细介绍请查看工具帮助信息。

$ gf
USAGE
   gf COMMAND [OPTION]

COMMAND
   env        show current Golang environment variables
   run        running go codes with hot-compiled-like feature
   gen        automatically generate go files for dao/dto/entity/pb/pbentity...
   init       create and initialize an empty GoFrame project
   pack       packing any file/directory to a resource file, or a go file
   build      cross-building go project for lots of platforms
   docker     build docker image for current GoFrame project
   install    install gf binary to system (might need root/admin permission)
   version    show version information of current binary

OPTION
   -y, --yes        all yes for all command without prompt ask
   -v, --version    show version information of current binary
   -d, --debug      show internal detailed debugging information
   -h, --help       more information about this command

ADDITIONAL
    Use "gf COMMAND -h" for details about a command.

相关文档

Source: SKILL.md on GitHub

1 alert16d5 checks · Risk MEDIUM
  • Gen Agent Trust Hub16d

    The skill provides a comprehensive development guide and code examples for the GoFrame v2 framework. While highly informative for Go developers, it contains several examples with hardcoded placeholder secrets, tokens, and specific local file paths to sensitive configuration files (like Kubernetes credentials). These elements are provided for demonstration purposes but represent insecure practices if used in production without modification.

  • Socket16d

    5 alerts: gptSecurity, gptAnomaly

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer6mo

    227/949 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 911705d. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 4 months ago.

Steadyupdated 4 months ago
  • Go
  • Database
  • goframe
  • orm
  • http
  • grpc
  • microservices
  • crud
  • scaffolding
  • middleware

README badge

README badge for gogf/skills

Provides instruction and conventions for developing with GoFrame v2, a modular Go framework for building HTTP and gRPC services, microservices, and database operations using its ORM, CLI tooling, and project scaffolding. Use this skill when the target project has GoFrame v2 as a dependency or when the user requests scaffolding, migrations, or service development with GoFrame conventions.

Generated from the current SKILL.md.

When should I use this skill?
Use this skill only when your Go project uses GoFrame v2, indicated by github.com/gogf/gf/v2 in go.mod or imports. Do not use for generic Go projects, frontend work, or infrastructure tasks unrelated to GoFrame.
Should I manually set created_at and updated_at fields?
No. GoFrame automatically writes created_at on insert and updated_at on insert/update/save. Manually setting these fields is redundant and violates project conventions.
What should I use for database operations instead of g.Map?
Always use DO objects from internal/model/do/. DO struct fields are interface{}, unset fields remain nil and are automatically ignored by the ORM.
How does soft delete work in GoFrame?
Call Delete() on the DAO; GoFrame automatically converts it to UPDATE SET deleted_at = NOW(). Queries automatically filter out soft-deleted rows without requiring manual WhereNull conditions.
Where should I implement business logic?
Implement business logic directly in the service/ directory. Do not use the logic/ directory unless explicitly requested.

Generated from the current SKILL.md. These answers refresh after source changes.