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

goframe-v2goframe V2 命令行

Agent Skill

goframe-v2 用于记录任务执行中的错误、用户纠正、经验和能力缺口,适合在 Codex、Claude、Cursor、Gemini CLI 中希望让 Agent 持续沉淀问题、修正和最佳实践时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

34,608

周安装

1,428

GitHub Stars

57

下载量

10,864
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/gogf/skills --skill goframe-v2

简介

GoFrame v2 的 Go 服务和 API 开发约定和组件标准。

  • 使用 gf 初始化
  • 搭建 HTTP 和微服务项目;自动生成的 dao、do 和实体文件不得手动修改
  • 直接在服务中实现业务逻辑/
  • 目录;避免逻辑/
  • 除非明确要求,否则目录
  • 始终使用内部/模型/do/中的DO对象
  • 用于数据库操作;永远不要使用 g.Map
  • 或地图[字符串]接口{},并利用 nil 字段处理进行条件更新
  • 应用恐怖
  • 对于所有错误处理以维护完整的堆栈跟踪;在创建新组件和方法之前重用现有组件和方法
  • 参考内容包括 HTTP 服务、gRPC 服务和项目模式的最佳实践示例

SKILL.md

Critical Conventions

Project Development Standards

  • For complete projects (HTTP/microservices), install GoFrame CLI and use gf init to create project scaffolding. See Project Creation - init for details.
  • Auto-generated code files (dao, do, entity) MUST NOT be manually created or modified per GoFrame conventions.
  • Unless explicitly requested, do NOT use the logic/ directory for business logic. Implement business logic directly in the service/ directory.
  • Reference complete project examples:

- HTTP service best practice: user-http-service - gRPC service best practice: user-grpc-service

Component Usage Standards

  • Before creating new methods or variables, check if they already exist elsewhere and reuse existing implementations.
  • Use the gerror component for all error handling to ensure complete stack traces for traceability.
  • When exploring new components, prioritize GoFrame built-in components and reference best practice code from examples.
  • Database Operations MUST use DO objects (internal/model/do/), never g.Map or map[string]interface{}. DO struct fields are interface{}; unset fields remain nil and are automatically ignored by the ORM: // Good - use DO object dao.Users.Ctx(ctx).Where(cols.Id, id).Data(do.User{Uid: uid}).Update() // Good - conditional fields, unset fields are nil and ignored data:= do.User{} if password!= "" {data.PasswordHash = hash} if isAdmin!= nil {data.IsAdmin = *isAdmin} dao.Users.Ctx(ctx).Where(cols.Id, id).Data(data).Update() // Good - explicitly set a column to NULL using gdb.Raw dao.Instances.Ctx(ctx).Where(cols.Id, id).Data(do.Instance{IdleSince: gdb.Raw("NULL")}).Update() // Bad - never use g.Map for database operations dao.Users.Ctx(ctx).Data(g.Map{cols.Uid: uid}).Update()

Code Style Standards

  • Variable Declarations: When defining multiple variables, use a var block to group them for better alignment and readability: // Good - aligned and clean var (authSvc *auth.Service bizCtxSvc *bizctx.Service k8sSvc *svcK8s.Service notebookSvc *notebook.Service middlewareSvc *middleware.Service) // Avoid - scattered declarations authSvc:= auth.New() bizCtxSvc:= bizctx.New() k8sSvc:= svcK8s.New()
  • Apply this pattern when you have 3 or more related variable declarations in the same scope.

Soft Delete & Time Maintenance

GoFrame provides automatic soft delete and time maintenance features. When a table contains created_at, updated_at, or deleted_at fields, the ORM handles these automatically.

Automatic Time Fields

FieldAuto Behavior
created_atAuto-written on Insert/InsertAndGetId, never modified afterward
updated_atAuto-written on Insert/Update/Save
deleted_atAuto-written on Delete (soft delete), auto-filtered on queries

Critical Rules

1. NEVER manually set time fields - GoFrame handles these automatically:

// WRONG - redundant manual time setting
dao.User.Ctx(ctx).Data(do.User{
    Name:      "john",
    CreatedAt: gtime.Now(),  // REDUNDANT! Framework handles this
    UpdatedAt: gtime.Now(),  // REDUNDANT! Framework handles this
}).Insert()

// CORRECT - let framework handle time fields
dao.User.Ctx(ctx).Data(do.User{
    Name: "john",
}).Insert()

2. NEVER manually add WhereNull(cols.DeletedAt) - GoFrame auto-adds soft delete filter:

// WRONG - redundant soft delete condition
dao.User.Ctx(ctx).
    Where(do.User{Status: 1}).
    WhereNull(cols.DeletedAt).  // REDUNDANT! Framework auto-adds this
    Scan(&list)

// CORRECT - framework auto-adds deleted_at IS NULL
dao.User.Ctx(ctx).
    Where(do.User{Status: 1}).
    Scan(&list)

3. Use Delete() for soft delete - Framework converts to UPDATE SET deleted_at = NOW():

// CORRECT - use Delete(), framework handles soft delete
dao.User.Ctx(ctx).Where(do.User{Id: id}).Delete()
// Actual SQL: UPDATE `sys_user` SET `deleted_at`=NOW() WHERE `id`=?

// WRONG - manual Update with deleted_at
dao.User.Ctx(ctx).
    Where(do.User{Id: id}).
    Data(do.User{DeletedAt: gtime.Now()}).  // REDUNDANT!
    Update()

Field Type Support

The deleted_at field supports multiple types:

  • DateTime/Timestamp: Default, stores deletion time
  • Integer: Stores Unix timestamp (seconds)
  • Boolean: Stores 0/1 for deleted state

Configuration (Optional)

Time field names can be customized in config.yaml:

database:
  default:
    createdAt: "created_at"   # Custom field name
    updatedAt: "updated_at"
    deletedAt: "deleted_at"
    timeMaintainDisabled: false  # Set true to disable this feature

GoFrame Documentation

Complete GoFrame development resources covering component design, usage, best practices, and considerations: GoFrame Documentation

GoFrame Code Examples

Rich practical code examples covering HTTP services, gRPC services, and various project types: GoFrame Examples

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

33.4%
按下载量换算3,629

Claude

31.27%
按下载量换算3,397

Cursor

17.01%
按下载量换算1,848

Gemini CLI

9.62%
按下载量换算1,045

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

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

来源信息

继续浏览同类 Skills