Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

go-error发生错误

Agent Skill

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

总安装

404

周安装

17

GitHub Stars

公开资料未说明

下载量

141
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/cristiano-pacheco/ai-tools --skill go-error

简介

用于记录任务执行中的错误、用户纠正和经验缺口。

  • 适合让 Agent 持续沉淀问题并修正最佳实践。
  • 可结合来源仓库和原始 README 核验具体记录格式。
  • 安装前建议确认是否会触发文件写入或日志存储。go-error 属于研究检索类 Skill,可作为该场景下的辅助能力补充。
  • 注意该技能归类为研究检索,但功能更接近知识管理。

SKILL.md

Go Error

Generate typed custom errors for module-level errs packages.

When to Use

  • Add new custom typed error definitions to a module
  • Extend existing errs.go with new error codes
  • Create validation error helpers with field-level details

Pattern

Place errors in:

internal/modules/<module>/errs/errs.go

Each module error file follows:

  1. package errs
  2. Imports:

- net/http - brickserrs "github.com/cristiano-pacheco/bricks/pkg/errs"

  1. var (...) block with exported error variables
  2. Error creation via:

- brickserrs.New("<MODULE>_<NN>", "<message>", http.<Status>, nil)

  1. Optional helper constructors for validation errors that carry field-level details

Example Structure

package errs

import (
	"net/http"

	brickserrs "github.com/cristiano-pacheco/bricks/pkg/errs"
)

var (
	// ErrProfileValidationFailed is returned when profile validation fails.
	ErrProfileValidationFailed = brickserrs.New(
		"PROFILE_01",
		"profile validation failed",
		http.StatusBadRequest,
		nil,
	)
	// ErrProfileNotFound is returned when the profile is not found.
	ErrProfileNotFound = brickserrs.New("PROFILE_02", "profile not found", http.StatusNotFound, nil)
)

Generation Steps

  1. Identify error details:

- Target module (e.g., catalog, profile, ai, export) - Error variable name (ErrProfileNotFound) - Lowercase message ("profile not found") - HTTP status (http.StatusNotFound)

  1. Find the next code:

- Open internal/modules/<module>/errs/errs.go - Extract existing codes for that module prefix - Allocate the next available sequential code: - Single digits are zero-padded: CATALOG_01, CATALOG_02,..., CATALOG_09 - Double digits are not padded: CATALOG_10, CATALOG_11,... - Keep code uniqueness inside the module

  1. Add the new error:

- Insert into the module var (...) block - Keep domain-group ordering used by the file - Add a short doc comment when comments are already present in the file

  1. Add a helper constructor if needed:

- When the error is a validation error that carries field-level details, add a NewXxxValidationError(details []brickserrs.Detail) *brickserrs.Error function - Reuse the pre-defined variable's .Code, .Message, and .Status fields

  1. Validate usage path:

- Ensure new/updated usecases, validators, handlers, or enum constructors return the new typed error - Do not return raw errors.New(...) from business flows when a typed module error exists

  1. Update translations (mandatory):

- Every new custom error must add a translation entry in locales/en.json under the "errors" key - Use the error code as key and a properly capitalized, user-facing sentence as value: "PROFILE_02": "Profile not found" - If additional locale files exist (for example locales/pt_BR.json), add the same key there too - Keep translation keys and structure consistent across all locale files - Do not merge a new custom error without the corresponding locale updates

Naming Conventions

  • Variable: Err + clear domain phrase in PascalCase

- Example: ErrProfileNotFound, ErrAIGenerationFailed

  • Code: <MODULE>_<NN>

- CATALOG_09, EXPORT_15, AI_07 - Always at least 2 digits; single digits are zero-padded

  • Message:

- All lowercase in brickserrs.New() — the locale file (locales/en.json) provides the user-facing capitalized form - Short and specific, no trailing punctuation - Examples: "profile not found", "invalid prompt type", "ai provider unavailable"

  • HTTP status:

- Validation errors: http.StatusBadRequest - Auth failures: http.StatusUnauthorized / http.StatusForbidden - Missing resources: http.StatusNotFound - Conflicts: http.StatusConflict - Rate limit: http.StatusTooManyRequests - Upstream/AI failures: http.StatusBadGateway - Capacity/availability: http.StatusServiceUnavailable - Infra/internal failures: http.StatusInternalServerError

Implementation Checklist

  • Open target internal/modules/<module>/errs/errs.go
  • Compute next unique module code (zero-padded 2-digit format)
  • Add exported Err... variable with brickserrs.New(...)
  • Use all-lowercase message string
  • Match existing domain-group ordering style
  • Ensure message and status align with domain behavior
  • Add NewXxxValidationError(details []brickserrs.Detail) helper if it is a validation error
  • Replace raw error returns in calling code with typed errs.Err... where applicable
  • Add translation for the new error in locales/en.json under "errors" with proper sentence-case value
  • Add the same translation key in every other existing locale file (e.g., locales/pt_BR.json)
  • Run make lint to catch style and static analysis issues
  • Run make nilaway to ensure no nil pointer dereferences are introduced

Usage Pattern

if input.Phone == "" {
	return errs.ErrPhoneNumberRequired
}

if profile == nil {
	return errs.ErrProfileNotFound
}

Critical Rules

  • No standalone functions: When a file contains a struct with methods, do not add standalone functions. Use private methods on the struct instead.
  • Do not create a new error package; use module-local internal/modules/<module>/errs
  • Do not duplicate codes within the same module
  • Do not return persistence or infrastructure-specific raw errors to transport when a typed domain error exists
  • Keep error messages stable once exposed, unless migration/compatibility impact is accepted
  • Every new custom error requires locale entries in locales/en.json and all other existing locale files
  • Messages in brickserrs.New() are always lowercase; user-facing capitalization lives in the locale file

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

38.16%
按下载量换算54

Claude

31.8%
按下载量换算45

Cursor

17.65%
按下载量换算25

Gemini CLI

8.47%
按下载量换算12

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

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

安装前确认

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

来源信息

继续浏览同类 Skills