debugging-guide

debugging-guide is a skill for Claude Code, Codex from ZhangShenao/harness9. It costs 22 tokens per session (883 once invoked), scanned A, original, MIT.

A step-by-step guide for diagnosing Go build errors, failed tests, crashes, and unexpected agent behavior. Go is a programming language, and an agent is a system that uses a language model and tools to perform tasks.

In plain words
What is it for?
Use it to run builds and tests, apply the race detector, inspect panic traces, check tool schemas and limits, and examine prompts or API requests when needed.
Why use it?
It gives a consistent order for checking compilation, tests, runtime errors, tool registration, and provider requests instead of guessing at the cause.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is go test -v ./internal/engine/.

Good fit Use it to run builds and tests, apply the race detector, inspect panic traces, check tool schemas and limits, and examine prompts or API requests when needed.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/ZhangShenao/harness9
agentmods
npx agentmods add skills/zhangshenao/harness9/debugging-guide

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for debugging-guide

README.md
[![agentmods](https://agentmods.dev/badge/skills/zhangshenao/harness9/debugging-guide/github.svg)](https://agentmods.dev/skills/zhangshenao/harness9/debugging-guide)
Your own site
<a href="https://agentmods.dev/skills/zhangshenao/harness9/debugging-guide"><img src="https://agentmods.dev/badge/skills/zhangshenao/harness9/debugging-guide/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for debugging-guide

Your own site · 80×15
<a href="https://agentmods.dev/skills/zhangshenao/harness9/debugging-guide"><img src="https://agentmods.dev/badge/skills/zhangshenao/harness9/debugging-guide.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 22 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 883 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00022 $0.00883
Opus 5.5 $0.00009 $0.00353
Sonnet 5.5 $0.00004 $0.00177
Haiku 4.5 $0.00002 $0.00088

Measured 1mo ago against content hash 2875c5183add, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

debugging-guide scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.zcode/skills/debugging-guide/SKILL.md · 122 lines

How it starts

The opening of the file, as written. The whole thing — 122 lines — stays where its author put it; the contents beside it link to each section on GitHub.

harness9 调试指南

诊断顺序

遇到问题时,按以下顺序排查:

1. 编译错误

go build ./...

常见原因:

  • 未使用的 import → 删除或添加 _ blank import
  • 类型不匹配 → 检查接口实现是否完整
  • 循环依赖 → 将接口定义移到使用者侧包中

2. 测试失败

# 详细输出
go test -v ./internal/engine/

# 单个测试
go test -v -run TestAgentLoop ./internal/engine/

# 带 race detector
go test -race ./...

3. 运行时 panic

查看完整 goroutine stack:

go run ./cmd/harness9 2>&1 | head -100

nil pointer panic 通常来自:

  • 未初始化的 map(用 make(map[K]V) 初始化)
  • 接口值为 nil 但调用了方法

4. Agent 行为异常

LLM 不调用工具: 检查工具的 Definition() 描述是否清晰,JSON Schema 是否正确。

工具执行失败: 查看 ToolResult.IsError 和 Output 字段,错误信息会回传给 LLM。

无限循环: 检查 WithMaxTurns 配置,默认 50 Turn。

常用调试技巧

打印 System Prompt

在 internal/context/builder.go 的 Build() 方法末尾临时添加:

fmt.Fprintf(os.Stderr, "=== SYSTEM PROMPT ===\n%s\n===================\n", prompt)

检查工具注册

在 registry.Execute 前打印可用工具列表:

for _, def := range registry.GetAvailableTools() {
    fmt.Fprintf(os.Stderr, "tool: %s\n", def.Name)
}

Provider 请求/响应

如需查看实际 API 请求,在 internal/provider/openai.go 中打印消息列表。

harness9 特有问题

Anthropic Provider:user/assistant 必须严格交替

症状:400 Bad Request 或 invalid_request_error

原因:Anthropic Messages API 禁止连续 assistant 消息。

修复:检查 contextHistory 的消息顺序,确保 system→user→assistant→user→assistant 交替。

路径沙箱拒绝访问

症状:工具返回 路径超出工作区范围 或类似错误

原因:路径包含 ../ 或绝对路径指向启动目录之外。

修复:Agent 应使用相对于启动目录的路径,如 internal/engine/agent_loop.go 而非 /absolute/path/...。

Skills 未加载

症状:Agent 不知道有 Skills 可用

检查:

  1. skills/ 目录是否在项目根目录(启动目录)下
  2. 每个 Skill 是否在独立子目录中,且子目录内有 SKILL.md 文件
  3. SKILL.md 是否包含 name 和 description frontmatter 字段
  4. 启动日志中是否有 [skills] warn 输出

正确的目录结构示例:

skills/
├── go-coding-standards/
│   └── SKILL.md      ← 必须是这个文件名
└── debugging-guide/
    └── SKILL.md

go vet 常见 warning

Warning 含义 修复
printf 格式不匹配 %s 传入了非 string 类型 修正格式或类型
unreachable code return 后有代码 删除死代码
loop variable captured goroutine 捕获了循环变量 传参而非捕获

Read the full file on GitHub · 122 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 122 lines · 22 tokens per session scan A 2875c5183add

Subscribe to this mod's changes

debugging-guide is a skill published in the GitHub repository ZhangShenao/harness9 (143 stars, last pushed today), licensed MIT. It adds 22 tokens to every session and 883 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

printing-press-polish

Polish a generated CLI to pass verification and become publish-ready. Runs diagnostics (dogfood, verify, scorecard, go vet, gosec), automatically fixes all issues (verify failures, static-analysis findings, dead code, descriptions, README, MCP tool quality), reports the before/after delta, and offers to publish. Use…

mvanhorn/cli-printing-press · 125 tokens

stack-trace-go-probe

Internal helper for meta-stack-trace-investigator. Use when a Go panic or stack trace needs Go-specific nil/error checks, go test reproducer guidance, and patch targets.

opensquilla/opensquilla · 42 tokens

golang-troubleshooting

Troubleshoot Golang programs systematically - find and fix the root cause. Use when encountering bugs, crashes, deadlocks, races, or unexpected behavior in Go code. Covers debugging methodology, common Go pitfalls, test-driven debugging, pprof setup and capture, Delve, race detection, GODEBUG tracing, and production…

samber/cc-skills-golang · 175 tokens

golang-error-handling

Idiomatic Golang error handling — creation, wrapping with %w, errors.Is/As, errors.Join, custom error types, sentinel errors, panic/recover, the single handling rule, structured logging with slog, HTTP request logging middleware, and samber/oops for production errors. Built to make logs usable at scale with log…

samber/cc-skills-golang · 144 tokens

go-concurrency-patterns

Master Go concurrency with goroutines, channels, sync primitives, and context. Use when building concurrent Go applications, implementing worker pools, or debugging race conditions.

rmyndharis/antigravity-skills · 37 tokens

tree-sitter-language-pack-extracting-code-structure

Use when the user wants structured code metadata from a source file — functions, classes, imports, exports, symbols, docstrings, comments, or syntax diagnostics. Covers ts-pack process feature flags, the JSON result shape, and the default feature set.

xberg-io/tree-sitter-language-pack · 52 tokens