gopher-refactor

gopher-refactor is a command for coding agents from car12o/claude-workflows. It costs 25 tokens per session (1,454 once invoked), scanned A, original, MIT.

A Claude Code plugin collection for Go 1.24 or newer, with separate helpers for development tasks. TDD means writing tests before or alongside the code they check.

In plain words
What is it for?
Use it to analyze, implement, test, refactor, and review Go code through specialized agents and workflow commands.
Why use it?
It gives Go projects a defined process for planning changes, checking quality, and reviewing code instead of handling each step ad hoc.

Command

Part of the gopher plugin — 6 skills, 5 commands, 5 agents, 1 hook shipped together

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 commands/car12o/claude-workflows/gopher-refactor
Clone the repo
git clone --depth 1 https://github.com/car12o/claude-workflows

Or install gopher, the plugin that ships this one along with the rest of its 6 skills, 5 commands, 5 agents, 1 hook.

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 gopher-refactor

README.md
[![agentmods](https://agentmods.dev/badge/commands/car12o/claude-workflows/gopher-refactor.svg)](https://agentmods.dev/commands/car12o/claude-workflows/gopher-refactor)
Your own site
<a href="https://agentmods.dev/commands/car12o/claude-workflows/gopher-refactor"><img src="https://agentmods.dev/badge/commands/car12o/claude-workflows/gopher-refactor.svg" alt="Measured on agentmods" height="20"></a>
Per session 25 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,454 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.00025 $0.01454
Opus 5 $0.00013 $0.00727
Sonnet 5 $0.00005 $0.00291
Haiku 4.5 $0.00003 $0.00145

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

Security

Grade A, and why

gopher-refactor 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.

plugins/gopher/commands/gopher-refactor.md · 158 lines

How it starts

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

You are the gopher-refactor orchestrator for Go 1.24+ projects.

Core rule: You are an orchestrator. Your job is to delegate work to specialized subagents via the Task tool, make decisions at stop points, and communicate with the user.

Refactoring Request

$ARGUMENTS

Workflow

Phase 1: Analysis    → go-analyzer (scope, coverage, risks)
         [STOP 1: Plan approval]
Phase 2: Safety Net  → go-implementer (add tests if needed)
         → go-quality-gate (verify tests pass)
Phase 3: Refactor    → go-implementer (apply changes)
         → go-quality-gate (verify no regressions)
         → git commit
Phase 4: Review      → go-reviewer (verify behavior preserved)
         [STOP 2: Final approval]

Subagent Reference

Phase Agent subagent_type
Analysis go-analyzer gopher:go-analyzer
Safety Net / Refactor go-implementer gopher:go-implementer
Quality Gates go-quality-gate gopher:go-quality-gate
Review go-reviewer gopher:go-reviewer

Phase 1: Analysis

Use the Task tool with subagent_type: "gopher:go-analyzer" to delegate analysis. Include in the task prompt:

  • The refactoring description from $ARGUMENTS
  • Instruction to focus on: target files, existing test coverage on those files, dependencies between packages, and blast radius
  • Do NOT ask the analyzer to determine scale or ADR triggers — this is a refactoring, not a new feature

The analyzer should return:

  • Files targeted for refactoring
  • Current test coverage on those files (run go test -coverprofile on target packages)
  • Blast radius (files that import/reference the target code)
  • Risks (behavior changes, interface changes, breaking dependents)

Capture the analysis output for subsequent phases.

[STOP 1: Plan Approval]

Present to the user:

  • Files targeted for refactoring
  • Current test coverage on target packages
  • Safety net decision (tests will be added or coverage is adequate)
  • Blast radius (files that import/reference the target code)
  • Risks (behavior changes, interface changes, breaking dependents)
  • Proposed approach (incremental steps if the refactoring is large)

Read the full file on GitHub · 158 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. 3d ago First seen · 158 lines · 25 tokens per session scan A fb4c70ae01ca

Subscribe to this mod's changes

gopher-refactor is a command published in the GitHub repository car12o/claude-workflows (2 stars, last pushed 6mo ago), licensed MIT. It adds 25 tokens to every session and 1,454 once invoked, about $0.0001 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-31.