Agent skill

Go Coding Standards

by ZhangShenao in ZhangShenao/harness9

A skill your agent uses when writing or reviewing Go code — explains harness9 project coding conventions and patterns

MITAuto-check passedDevelopment

Install Go Coding Standards

skills CLI
$ npx skills add ZhangShenao/harness9 --skill go-coding-standards -a claude-code

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

GitHub CLI
$ gh skill install ZhangShenao/harness9 go-coding-standards --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/ZhangShenao/harness9.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/go-coding-standards .claude/skills/go-coding-standards && 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-coding-standards
GitHub stars
141
Token cost
~719 tokens
SKILL.md length
77 words
Files
1
Skills in repo
7
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when writing or reviewing Go code — explains harness9 project coding conventions and patterns

  • Works in 4 steps: 在 internal/tools/ 下创建 xxx.go,实现 BaseTool… → 使用 safePath() 校验所有文件路径参数 → 在 internal/tools/xxx_test.go 中添加表驱动测试 → …
  • Reviewing Go code — explains harness9 project coding conventions and patterns
  • SKILL.md covers 命名规范, 错误处理, 构造函数 and 接口定义原则, plus 4 more sections
  • Calls go

What it does

Go Coding Standards is an agent skill from ZhangShenao/harness9. Use when writing or reviewing Go code — explains harness9 project coding conventions and patterns

Its SKILL.md is about 720 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Code quality. The repository describes itself as: Local-First · 轻量级 · 功能完备 · 生产可用的通用 Agent 框架. The licence is MIT.

When your agent uses it

  • Reviewing Go code — explains harness9 project coding conventions and patterns
  • Tasks that involve Code quality

Example prompts

  • “/go-coding-standards”

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. 在 internal/tools/ 下创建 xxx.go,实现 BaseTool 接口
  2. 使用 safePath() 校验所有文件路径参数
  3. 在 internal/tools/xxx_test.go 中添加表驱动测试
  4. 在 cmd/harness9/main.go 中注册工具

What it can do on your machine

Read from SKILL.md and the folder at commit f73d0f1. 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

    Shell commands in SKILL.md call:

    • 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.

Context cost

Go Coding Standards loads about 719 tokens when it runs. Until then it costs about 29 tokens; SKILL.md has 77 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~29
When it runs · the whole SKILL.md, loaded when a task matches
~719

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 ZhangShenao/harness9 at commit f73d0f1, republished under its MIT licence (© ZhangShenao). 77 words, ~719 tokens.

Download SKILL.mdSave it as .claude/skills/go-coding-standards/SKILL.md (or your agent's skills folder).
name
go-coding-standards
description
Use when writing or reviewing Go code — explains harness9 project coding conventions and patterns
trigger
write, review, refactor, add, implement

harness9 Go 编码规范

命名规范

类别规范示例
包名小写、单单词、无下划线engine、provider、schema
导出类型/函数PascalCaseAgentEngine、NewRegistry
未导出类型/函数camelCasemainLoop、runLoop
接口名以 -er 后缀为惯例Provider、Registry、BaseTool
常量PascalCase(导出)或 camelCase(未导出),不使用全大写RoleSystem、maxLogOutputLen
配置选项函数With 前缀WithMaxTurns、WithToolTimeout

错误处理

  • 显式检查所有 error 返回值,禁止 _ 忽略
  • 错误消息不以大写字母开头、不以句号结尾
  • 使用 fmt.Errorf("context: %w", err) 包装错误,保留错误链
go
// ✅ 正确
result, err := doSomething()
if err != nil {
    return fmt.Errorf("do something: %w", err)
}

// ❌ 错误
result, _ := doSomething()

构造函数

命名规范:New + 类型名

go
func NewReadFileTool(workDir string) *ReadFileTool {
    return &ReadFileTool{workDir: filepath.Clean(workDir)}
}

接口定义原则

接口定义在使用者侧,而非实现者侧。

go
// ✅ 正确:Registry 接口定义在 tools 包(使用者侧)
// internal/tools/registry.go
type Registry interface {
    Register(tool BaseTool) error
    GetAvailableTools() []schema.ToolDefinition
    Execute(ctx context.Context, call schema.ToolCall) schema.ToolResult
}

// ❌ 错误:不要在实现所在的包中定义接口

并发模式

并发工具执行使用预分配切片 + 索引写入,确保结果顺序:

go
// Go 1.22+ 中 for range 每次迭代已自动创建新绑定,无需手动传参捕获。
// 本项目使用 Go 1.25,以下写法是正确的:
results := make([]schema.ToolResult, len(toolCalls))
var wg sync.WaitGroup
for i, tc := range toolCalls {
    wg.Add(1)
    go func() {
        defer wg.Done()
        toolCtx, cancel := context.WithTimeout(ctx, e.toolTimeout)
        defer cancel()
        results[i] = e.registry.Execute(toolCtx, tc)
    }()
}
wg.Wait()

添加新工具的步骤

  1. 在 internal/tools/ 下创建 xxx.go,实现 BaseTool 接口
  2. 使用 safePath() 校验所有文件路径参数
  3. 在 internal/tools/xxx_test.go 中添加表驱动测试
  4. 在 cmd/harness9/main.go 中注册工具
go
type MyTool struct {
    workDir string
}

func (t *MyTool) Name() string { return "my_tool" }
func (t *MyTool) Definition() schema.ToolDefinition { /* JSON Schema */ }
func (t *MyTool) Execute(ctx context.Context, args json.RawMessage) (string, error) { /* ... */ }

测试规范

  • 使用标准库 testing 包,不引入第三方断言库
  • 表驱动测试优先
  • 运行:go test ./...
go
func TestXxx(t *testing.T) {
    cases := []struct {
        name  string
        input string
        want  string
    }{
        {"normal", "foo", "bar"},
        {"empty", "", ""},
    }
    for _, tc := range cases {
        t.Run(tc.name, func(t *testing.T) {
            got := Xxx(tc.input)
            if got != tc.want {
                t.Errorf("got %q, want %q", got, tc.want)
            }
        })
    }
}

代码检查

提交前必须通过:

bash
gofmt -l .        # 无输出表示格式正确
go vet ./...      # 无 warning
go test ./...     # 全部通过

© ZhangShenao, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/go-coding-standards of ZhangShenao/harness9.

Open the folder on GitHubat commit f73d0f1

Compare with similar skills

Go Coding Standards 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 Coding Standards compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Go Coding Standards this skillZhangShenao/harness9141—~719Automated safety check: PassMIT
Install Anti-Slop Oxlint Rulesdmmulroy/anti-slop5.3k1 repos~2.2kAutomated safety check: PassMIT
WooCommerce Code Reviewwoocommerce/woocommerce11k3 repos~1.1kAutomated safety check: PassCustom licence
Systematic Code Refactoringluongnv89/claude-howto42k—~3kAutomated safety check: PassMIT
Constraint-Driven Developmentaddyosmani/agent-skills103k2 repos~5.2kAutomated safety check: PassMIT
Skill Doli Code ReviewDolibarr/dolibarr7.7k1 repos~1.1kAutomated safety check: PassMIT

Similar skills

  • Installs, updates or migrates the vendored anti-slop Oxlint plugin in a repository, keeping local rule changes and the plugin's license and provenance files.

    5.3k GitHub starsUsed in 1 repo~2.2k tokens
    DevelopmentAuto-check passed
  • WooCommerce Code Review

    woocommerce/woocommerce

    Reviews WooCommerce code changes against the project's standards, flagging backend PHP architecture, naming, documentation, data integrity and testing violations.

    11k GitHub starsUsed in 3 repos~1.1k tokens
    DevelopmentAuto-check passed
  • Systematic Code Refactoring

    luongnv89/claude-howto

    Guides refactoring in phases based on Martin Fowler's method: research, test coverage check, planning and small tested steps, with your approval at each phase.

    42k GitHub stars~3k tokensUpdated 8 days ago
    DevelopmentAuto-check passed
  • Constraint-Driven Development

    addyosmani/agent-skills

    Records a project's quality bar in CONSTRAINTS.md and watches diffs for signs an agent quietly weakened it, such as suppressions, skipped tests or lowered thresholds.

    103k GitHub starsUsed in 2 repos~5.2k tokens
    DevelopmentAuto-check passed
  • Skill Doli Code Review

    Dolibarr/dolibarr

    Reviews Dolibarr PHP code for compliance with coding standards and security best practices, and fixes identified issues.

    7.7k GitHub starsUsed in 1 repo~1.1k tokens
    DevelopmentAuto-check passed
  • Ponytail Lazy Developer Mode

    DietrichGebert/ponytail

    Makes the agent pick the laziest solution that works: skip unneeded work, reuse what exists, prefer the standard library and platform features, and keep diffs small.

    158k GitHub stars~871 tokensUpdated today
    DevelopmentAuto-check passed

More from ZhangShenao/harness9

  • Architecture Overview

    ZhangShenao/harness9

    A skill your agent uses when asked about harness9 architecture, module design, or how components interact — explains the system design

    141 GitHub stars~717 tokensUpdated today
    Auto-check passed
  • Debugging Guide

    ZhangShenao/harness9

    A skill your agent uses when debugging Go errors, test failures, or unexpected behavior — step-by-step diagnosis approach

    141 GitHub stars~563 tokensUpdated today
    Auto-check passed
  • PR

    ZhangShenao/harness9

    A skill your agent uses when the user invokes /pr or asks to push changes and open a pull request, after commits are ready to be pushed to a remote branch and merged into the main branch.

    141 GitHub starsUsed in 1 repo~423 tokens
    Auto-check passed
  • Commit

    ZhangShenao/harness9

    A skill your agent uses when the user invokes /commit or asks to commit changes, after a code review has been completed and the changes are confirmed ready to stage and commit to git.

    141 GitHub stars~327 tokensUpdated today
    Auto-check: notes
  • Cr

    ZhangShenao/harness9

    A skill your agent uses when the user invokes /cr, requests a code review, or before committing to verify correctness, security, and quality of new or modified code in the working tree.

    141 GitHub stars~304 tokensUpdated today
    Auto-check: notes
  • Autodev

    ZhangShenao/harness9

    Feature auto-development — clarify requirements, generate spec, dispatch dev sub-agent to implement and merge into current branch

    141 GitHub stars~606 tokensUpdated today
    Auto-check: notes

Categories

Questions about Go Coding Standards

What does Go Coding Standards do?

A skill your agent uses when writing or reviewing Go code — explains harness9 project coding conventions and patterns. Go Coding Standards is an agent skill from ZhangShenao/harness9.

When should I use Go Coding Standards?

Go Coding Standards fits situations like: reviewing Go code — explains harness9 project coding conventions and patterns; tasks that involve Code quality.

How do I install Go Coding Standards in Claude Code?

Run `npx skills add ZhangShenao/harness9 --skill go-coding-standards -a claude-code`. Or copy the skill folder (skills/go-coding-standards in ZhangShenao/harness9) into .claude/skills/go-coding-standards in your project. Claude Code loads it when a task matches its description.

How do I install Go Coding Standards in Codex?

Run `npx skills add ZhangShenao/harness9 --skill go-coding-standards -a codex`. Or copy the skill folder (skills/go-coding-standards in ZhangShenao/harness9) into .agents/skills/go-coding-standards in your project. Codex loads it when a task matches its description.

Can I use Go Coding Standards 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 ZhangShenao/harness9 --skill go-coding-standards -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-coding-standards, .gemini/skills/go-coding-standards, .github/skills/go-coding-standards and .opencode/skills/go-coding-standards in your project.

What does Go Coding Standards need to run?

Going by SKILL.md and its folder, Go Coding Standards needs the command-line tools its instructions call (go).

Does Go Coding Standards 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 Coding Standards 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 Coding Standards use?

Go Coding Standards is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Go Coding Standards use?

About 719 tokens (SKILL.md is roughly 2.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Go Coding Standards?

Skills that share tags, products or a category with Go Coding Standards: Install Anti-Slop Oxlint Rules (dmmulroy/anti-slop, 5.3k stars), WooCommerce Code Review (woocommerce/woocommerce, 11k stars), Systematic Code Refactoring (luongnv89/claude-howto, 42k stars) and Constraint-Driven Development (addyosmani/agent-skills, 103k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Go Coding Standards?

ZhangShenao (a GitHub user) maintains it in ZhangShenao/harness9, which has 141 GitHub stars. The repository holds 7 skills in this directory. The repository was last updated on October 8, 2026.

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