Agent skill

Go Logging

by Rain-kl in Rain-kl/OpenFlare

在选择日志方案、配置 slog、编写结构化日志语句或决定日志级别时使用。也适用于设置生产日志、为日志添加请求作用域上下文或从 log 迁移到 slog 的场景,即使用户未明确提及日志。不涵盖错误处理策略(参见 go-error-handling)。

Apache-2.0Auto-check passed

Install Go Logging

skills CLI
$ npx skills add Rain-kl/OpenFlare --skill go-logging -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Rain-kl/OpenFlare go-logging --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Rain-kl/OpenFlare.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/go-logging .claude/skills/go-logging && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
go-logging
GitHub stars
288
Token cost
~1.1k tokens
SKILL.md length
155 words
Files
3 (incl. references)
Skills in repo
12
Repo updated
First seen
Licence
Apache-2.0

At a glance

在选择日志方案、配置 slog、编写结构化日志语句或决定日志级别时使用。也适用于设置生产日志、为日志添加请求作用域上下文或从 log 迁移到 slog 的场景,即使用户未明确提及日志。不涵盖错误处理策略(参见 go-error-handling)。

  • SKILL.md covers 核心原则, 选择日志器, 结构化日志 and 日志级别, plus 5 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Go Logging is an agent skill from Rain-kl/OpenFlare. 在选择日志方案、配置 slog、编写结构化日志语句或决定日志级别时使用。也适用于设置生产日志、为日志添加请求作用域上下文或从 log 迁移到 slog 的场景,即使用户未明确提及日志。不涵盖错误处理策略(参见 go-error-handling)。

Its SKILL.md is about 1.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files, including reference files (for example `references/LEVELS-AND-CONTEXT.md` and `references/LOGGING-PATTERNS.md`). Compatibility notes: slog requires Go 1.21+; slog/slogtest requires Go 1.22+

It works with Cloudflare. The repository describes itself as: OpenFlare is an open-source CDN orchestration and edge security platform. It supports reverse proxy, centralized configuration synchronization, in-network tunneling (Tunnels)… The licence is Apache-2.0.

Example prompts

  • “/go-logging”

Requirements

  • Compatibility (from SKILL.md): slog requires Go 1.21+; slog/slogtest requires Go 1.22+

What it can do on your machine

Read from SKILL.md and the folder at commit 7c2304d. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are go).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    slog requires Go 1.21+; slog/slogtest requires Go 1.22+

    From compatibility in the SKILL.md frontmatter.

Context cost

Go Logging loads about 1.1k tokens when it runs, and up to ~4.8k if it reads all its reference files. Until then it costs about 34 tokens; SKILL.md has 155 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~34
When it runs · the whole SKILL.md, loaded when a task matches
~1.1k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~4.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from Rain-kl/OpenFlare at commit 7c2304d, republished under its Apache-2.0 licence (© Rain-kl). 155 words, ~1,052 tokens.

Download SKILL.mdSave it as .claude/skills/go-logging/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
go-logging
description
在选择日志方案、配置 slog、编写结构化日志语句或决定日志级别时使用。也适用于设置生产日志、为日志添加请求作用域上下文或从 log 迁移到 slog 的场景,即使用户未明确提及日志。不涵盖错误处理策略(参见 go-error-handling)。
compatibility
slog requires Go 1.21+; slog/slogtest requires Go 1.22+
license
Apache-2.0
metadata.sources
Google Style Guide, Uber Style Guide

Go 日志

核心原则

日志是给运维人员看的,不是给开发人员看的。每一行日志都应该帮助某人诊断生产问题。如果不能达到这个目的,就是噪音。


选择日志器

规范:在新的 Go 代码中使用 log/slog。

slog 是结构化的、分级别的,并且在标准库中(Go 1.21+)。它涵盖了绝大多数生产日志需求。

选择哪个日志器?
├─ 新的生产代码      → log/slog
├─ 简单 CLI / 一次性  → log(标准库)
└─ 有性能瓶颈        → zerolog 或 zap(先做基准测试)

除非性能分析显示 slog 在热路径中是瓶颈,否则不要引入第三方日志库。引入时,保持相同的结构化键值风格。

在设置 slog handler、配置 JSON/文本输出或从 log.Printf 迁移到 slog 时,阅读 references/LOGGING-PATTERNS.md。


结构化日志

规范:始终使用键值对。永远不要将值插值到消息字符串中。

消息是描述发生了什么的静态描述。动态数据放在键值属性中:

go
// 好:静态消息,结构化字段
slog.Info("order placed", "order_id", orderID, "total", total)

// 不好:动态数据嵌入到消息字符串中
slog.Info(fmt.Sprintf("order %d placed for $%.2f", orderID, total))
键名

建议:日志属性键使用 snake_case。

键应为小写、下划线分隔,并在整个代码库中保持一致:user_id、request_id、elapsed_ms。

类型化属性

对于性能关键路径,使用类型化构造函数以避免分配:

go
slog.LogAttrs(ctx, slog.LevelInfo, "request handled",
    slog.String("method", r.Method),
    slog.Int("status", code),
    slog.Duration("elapsed", elapsed),
)

在优化日志性能或使用 Enabled() 进行预检查时,阅读 references/LEVELS-AND-CONTEXT.md。


日志级别

建议:一致地遵循这些级别语义。

级别何时使用生产默认
Debug仅开发人员的诊断,跟踪内部状态禁用
Info重要的生命周期事件:启动、关闭、配置加载启用
Warn意外但可恢复:使用了弃用功能、重试成功启用
Error操作失败,需要运维人员关注启用

经验法则:

  • 如果没有人需要对其采取行动,那就不是 Error——使用 Warn 或 Info
  • 如果只在连接调试器时才有用,那就是 Debug
  • slog.Error 应始终包含 "err" 属性
go
slog.Error("payment failed", "err", err, "order_id", id)
slog.Warn("retry succeeded", "attempt", n, "endpoint", url)
slog.Info("server started", "addr", addr)
slog.Debug("cache lookup", "key", key, "hit", hit)

在 Warn 和 Error 之间选择或定义自定义详细级别时,阅读 references/LEVELS-AND-CONTEXT.md。


请求作用域日志

建议:从 context 派生日志器以携带请求作用域字段。

使用中间件为日志器添加请求 ID、用户 ID 或跟踪 ID,然后通过 context 或作为显式参数将增强后的日志器传递给下游:

go
func middleware(next http.Handler) http.Handler {
    return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
        logger := slog.With("request_id", requestID(r))
        ctx := context.WithValue(r.Context(), loggerKey, logger)
        next.ServeHTTP(w, r.WithContext(ctx))
    })
}

该请求中所有后续的日志调用都会自动携带 request_id。

在实现日志中间件或通过 context 传递日志器时,阅读 references/LOGGING-PATTERNS.md。


日志或返回,不要同时

规范:每个错误恰好处理一次——要么记录它,要么返回它。

记录错误然后返回它会导致重复噪音,因为栈上游的调用者也会处理该错误。

go
// 不好:在这里记录,并且栈上游的每个调用者也会记录
if err != nil {
    slog.Error("query failed", "err", err)
    return fmt.Errorf("query: %w", err)
}

// 好:包装并返回——让调用者决定
if err != nil {
    return fmt.Errorf("query: %w", err)
}

例外:HTTP 处理器和其他栈顶边界可以在服务端记录详细错误,同时向客户端返回脱敏消息:

go
if err != nil {
    slog.Error("checkout failed", "err", err, "user_id", uid)
    http.Error(w, "internal error", http.StatusInternalServerError)
    return
}

参见 go-error-handling 了解完整的处理一次模式和错误包装指导。


不应记录的内容

规范:永远不要记录密钥、凭证、PII 或高基数无界数据。

  • 密码、API 密钥、令牌、会话 ID
  • 完整的信用卡号、社会安全号
  • 可能包含用户数据的请求/响应体
  • 无界大小的完整切片或映射

在决定哪些数据可以安全包含在日志属性中时,阅读 references/LEVELS-AND-CONTEXT.md。


快速参考

应该不应该
slog.Info("msg", "key", val)log.Printf("msg %v", val)
静态消息 + 结构化字段在消息中使用 fmt.Sprintf
snake_case 键camelCase 或不一致的键
日志或返回错误同时日志和返回同一错误
从 context 派生日志器每次调用创建新日志器
slog.Error 配合 "err" 属性用 slog.Info 记录错误
在热路径上预检查 Enabled()始终分配日志参数

相关技能

  • 错误处理:在决定是记录还是返回错误,或了解处理一次模式时,参见 go-error-handling
  • 上下文传播:在通过 context 传递请求作用域值(包括日志器)时,参见 go-context
  • 性能:在优化热路径日志或减少日志调用中的分配时,参见 go-performance
  • 代码审查:在审查 Go PR 中的日志实践时,参见 go-code-review

© Rain-kl, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (references) in .agents/skills/go-logging of Rain-kl/OpenFlare.

  • SKILL.md
  • references/LEVELS-AND-CONTEXT.md
  • references/LOGGING-PATTERNS.md

Open the folder on GitHubat commit 7c2304d

Compare with similar skills

Go Logging next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Go Logging compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Go Logging this skillRain-kl/OpenFlare288—~1.1kAutomated safety check: PassApache-2.0
Cloudflare Browser Renderingcloudflare/moltworker9.9k—~742Automated safety check: PassApache-2.0
Turnstile Spincloudflare/skills3k4 repos~7.2kAutomated safety check: NotesApache-2.0
Star Office UI Setupringhyacinth/Star-Office-UI7.5k—~1.3kAutomated safety check: PassMIT
Cloudflarehodgef/apiker1277 repos~2.2kAutomated safety check: PassMIT
Webhome Extension Builderwebhtv/webhtv1.7k—~2.8kAutomated safety check: PassGPL-3.0

Similar skills

  • Cloudflare Browser Rendering

    cloudflare/moltworker

    Official

    Drives headless Chrome through Cloudflare Browser Rendering over a CDP WebSocket to take screenshots, navigate and scrape pages, and record multi-page videos.

    9.9k GitHub stars~742 tokensUpdated 5 mo ago
    Productivity & AutomationAuto-check passed
  • Turnstile Spin

    cloudflare/skills

    Official

    Set up, repair, or migrate to Cloudflare Turnstile bot verification in an existing frontend and backend, including server-side Siteverify.

    3k GitHub starsUsed in 4 repos~7.2k tokens
    Frontend & DesignAuto-check: notes
  • Star Office UI Setup

    ringhyacinth/Star-Office-UI

    Sets up Star Office UI, a pixel-art office dashboard that shows AI agent states, lets other agents join and can be opened from a phone or a public link.

    7.5k GitHub stars~1.3k tokensUpdated 7 mo ago
    Agent WorkflowsAuto-check passed
  • Cloudflare

    hodgef/apiker

    Comprehensive Cloudflare platform skill covering Workers, Pages, storage (KV, D1, R2), AI (Workers AI, Vectorize, Agents SDK), feature flags (Flagship), networking (Tunnel, Spectrum), security (WAF…

    127 GitHub starsUsed in 7 repos~2.2k tokens
    DevOps & CloudAuto-check passed
  • Build, review, debug, reverse-engineer, and package WebHome injected extension scripts for FongMi/WebHome App WebView pages.

    1.7k GitHub stars~2.8k tokensUpdated today
    SecurityAuto-check passed
  • Nextjs On Cloudflare

    cloudflare/skills

    Official

    Build, migrate, and deploy Next.js apps on Cloudflare Workers with vinext.

    3k GitHub starsUsed in 2 repos~678 tokens
    DevOps & CloudAuto-check passed

More from Rain-kl/OpenFlare

All 12 skills in this repo
  • Code Review Skill

    Rain-kl/OpenFlare

    Provides comprehensive code review guidance for React 19, Vue 3, Angular 17+, Svelte 5, Rust, TypeScript, Java, PHP, Python, Django, Go, C/.NET, Kotlin, Swift, NestJS, C/C++, and more.

    288 GitHub stars~2.3k tokensUpdated today
    Auto-check: notes
  • New API

    Rain-kl/OpenFlare

    Wavelet 项目专用:当新增或修改自定义业务 API、新增业务路由、新增 service 层核心逻辑时必须使用。本技能指导包职责划分、推荐文件结构、路由解耦、Swagger 文档生成与质量门禁验证。

    288 GitHub stars~1.4k tokensUpdated today
    Auto-check passed
  • Cache Framework

    Rain-kl/OpenFlare

    Wavelet 项目专用:当新增或修改业务缓存(RAM/Redis/DB 三层读路径)、缓存失效、多节点 pub/sub 同步、或评估高频读是否应接入缓存时必须使用。本技能说明系统标准缓存框架、参考实现、禁止写法与分布式一致性要求。

    288 GitHub stars~1.7k tokensUpdated today
    Auto-check passed
  • Clickhouse Batchwriter

    Rain-kl/OpenFlare

    Wavelet 项目专用:当新增或修改 ClickHouse 批量写入、接入 internal/infra/persistence/batchwriter、将业务域异步 flush 到分析表、迁移 riskcontrol/节点访问日志/可观测时序写入、或评估 asyncinsert 与背压策略时必须使用。本技能指导分层职责、各域独立 Writer 实例、repository 批量 API…

    288 GitHub stars~1.4k tokensUpdated today
    Auto-check passed
  • Database Migration

    Rain-kl/OpenFlare

    Wavelet 项目专用:当新增或修改数据库表结构、索引、初始化数据、系统配置 seed、模板 seed、默认管理员、goose SQL 迁移、internal/infra/persistence/migrator、ClickHouse 分析库 DDL 或数据库升级流程时必须使用。本技能指导在 internal/infra/persistence/migrator/goose 下编写…

    288 GitHub stars~1.3k tokensUpdated today
    Auto-check passed
  • File Upload

    Rain-kl/OpenFlare

    Wavelet 项目专用:当业务需要上传文件、读取已上传文件、在 Worker/任务中程序化摄取字节流、选择存储引擎能力、或排查 wuploads / 文件统计异常时必须使用。本技能指导 storage 与 upload 分层、upload.Ingest 策略选型、前后端接入与禁止旁路写表。

    288 GitHub stars~1.7k tokensUpdated today
    Auto-check passed

Works with

Questions about Go Logging

What does Go Logging do?

在选择日志方案、配置 slog、编写结构化日志语句或决定日志级别时使用。也适用于设置生产日志、为日志添加请求作用域上下文或从 log 迁移到 slog 的场景,即使用户未明确提及日志。不涵盖错误处理策略(参见 go-error-handling)。. Go Logging is an agent skill from Rain-kl/OpenFlare.

How do I install Go Logging in Claude Code?

Run `npx skills add Rain-kl/OpenFlare --skill go-logging -a claude-code`. Or copy the skill folder (.agents/skills/go-logging in Rain-kl/OpenFlare) into .claude/skills/go-logging in your project. Claude Code loads it when a task matches its description.

How do I install Go Logging in Codex?

Run `npx skills add Rain-kl/OpenFlare --skill go-logging -a codex`. Or copy the skill folder (.agents/skills/go-logging in Rain-kl/OpenFlare) into .agents/skills/go-logging in your project. Codex loads it when a task matches its description.

Can I use Go Logging in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Rain-kl/OpenFlare --skill go-logging -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/go-logging, .gemini/skills/go-logging, .github/skills/go-logging and .opencode/skills/go-logging in your project.

What does Go Logging need to run?

SKILL.md names no scripts, command-line tools or credentials: Go Logging is instructions for the agent only. Compatibility (from SKILL.md): slog requires Go 1.21+; slog/slogtest requires Go 1.22+.

Does Go Logging access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Go Logging safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Go Logging use?

Go Logging is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Go Logging use?

About 1.1k tokens (SKILL.md is roughly 4.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.7k tokens, read only when the agent opens those files.

What are the alternatives to Go Logging?

Skills that share tags, products or a category with Go Logging: Cloudflare Browser Rendering (cloudflare/moltworker, 9.9k stars), Turnstile Spin (cloudflare/skills, 3k stars), Star Office UI Setup (ringhyacinth/Star-Office-UI, 7.5k stars) and Cloudflare (hodgef/apiker, 127 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Go Logging?

Rain-kl (a GitHub user) maintains it in Rain-kl/OpenFlare, which has 288 GitHub stars. The repository holds 12 skills in this directory. The repository was last updated on October 8, 2026.

Source: Rain-kl/OpenFlare on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.