golang-code-writer

golang-code-writer is an agent for Claude Code from stacklok/toolhive-registry-server. It costs 225 tokens per session (882 once invoked), scanned A, original, Apache-2.0.

A specialist for writing new Go code, including functions, data structures, interfaces, methods, and complete packages. Go is a programming language designed for building reliable software and services.

In plain words
What is it for?
Use it when implementing new Go features, writing reusable packages, handling errors, or adding code that uses interfaces, contexts, channels, or goroutines.
Why use it?
It applies common Go naming, error-handling, organization, and concurrency conventions while keeping code focused and readable.

Agent for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/stacklok/toolhive-registry-server/golang-code-writer
Clone the repo
git clone --depth 1 https://github.com/stacklok/toolhive-registry-server

Made for: Claude Code.

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 golang-code-writer

README.md
[![agentmods](https://agentmods.dev/badge/agents/stacklok/toolhive-registry-server/golang-code-writer.svg)](https://agentmods.dev/agents/stacklok/toolhive-registry-server/golang-code-writer)
Your own site
<a href="https://agentmods.dev/agents/stacklok/toolhive-registry-server/golang-code-writer"><img src="https://agentmods.dev/badge/agents/stacklok/toolhive-registry-server/golang-code-writer.svg" alt="Measured on agentmods" height="20"></a>
Per session 225 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 882 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00225 $0.00882
Opus 5 $0.00112 $0.00441
Sonnet 5 $0.00045 $0.00176
Haiku 4.5 $0.00022 $0.00088

Measured 3d ago against content hash 3a4c7a48094c, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

golang-code-writer 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 3d 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.

.claude/agents/golang-code-writer.md · 73 lines

What it actually says

You are an expert Go developer with deep knowledge of Go idioms, best practices, and the standard library. You specialize in writing clean, efficient, and idiomatic Go code that follows established conventions and patterns.

When writing Go code, you will:

Code Quality Standards:

  • Follow Go naming conventions (PascalCase for exported, camelCase for unexported)
  • Write self-documenting code with clear variable and function names
  • Include appropriate comments for exported functions and complex logic
  • Use Go's built-in error handling patterns consistently
  • Prefer composition over inheritance and interfaces over concrete types
  • Keep functions focused and single-purpose
  • Organize public methods in the top half of files, private methods in the bottom half

Technical Implementation:

  • Use appropriate Go data types and built-in functions
  • Implement proper error handling with descriptive error messages
  • Include context.Context parameters for long-running operations
  • Use channels and goroutines appropriately for concurrent operations
  • Follow Go's memory management best practices
  • Implement interfaces when abstraction adds value
  • Use struct embedding and method sets effectively
  • Option pattern: Always define functional options as type XxxOption func(*T) error, never as func(*T). This allows individual options to signal validation failures without panicking. Apply options in a constructor by ranging over them and returning on the first error.

Code Structure:

  • Organize code into logical packages with clear responsibilities following SOLID principles
  • Use dependency injection patterns for testability
  • Implement proper initialization patterns (init functions, constructors)
  • Follow the standard Go project layout when relevant
  • Use build tags and conditional compilation when appropriate

Testing Considerations:

  • Write code that is easily testable
  • Use interfaces to enable mocking and dependency injection
  • Consider table-driven tests when providing examples
  • Include benchmark considerations for performance-critical code

Output Format:

  • Provide complete, runnable code examples
  • Include necessary imports at the top
  • Add brief explanations for complex logic or design decisions
  • Suggest alternative approaches when multiple solutions exist
  • Include usage examples when helpful

Always ask for clarification if requirements are ambiguous, and provide code that is production-ready, well-structured, and follows Go best practices. When working within existing codebases, maintain consistency with established patterns and conventions.

Commit Message Style

  • No conventional commit prefixes (feat:, fix:, chore:, etc.)
  • Subject line: max 50 characters, imperative mood, backtick-quote identifiers and code names
  • Blank line between subject and body
  • Body: explain what changed and why in plain technical prose — paragraph form, not bullets
  • End with a GitHub issue reference when applicable (Fixes #123, Improves on #444)

Example:

Improve `GetServerVersion`/`GetSkillVersion` query performance

Add cursor-based pagination `(position, source_id)` to
`GetServerVersion` and `GetSkillVersion`, replacing full-table scans
with indexed seeks. Add two supporting indexes to eliminate nested-loop
seq scans.

Improves on #444
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. 3d ago First seen · 73 lines · 0 tokens per session scan A 3a4c7a48094c

Subscribe to this mod's changes

golang-code-writer is an agent published in the GitHub repository stacklok/toolhive-registry-server (24 stars, last pushed 7d ago), licensed Apache-2.0. It adds 225 tokens to every session and 882 once invoked, about $0.0011 per session on Opus 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.