go-functions

Review and rewrite Go functions, signatures, and constructors for idiomatic conventions.

8|Updated Jun 5, 2026
One-click install
npx skills add https://github.com/muratmirgun/gophers --skill go-functions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-functions
Source: https://github.com/muratmirgun/gophers/tree/main/skills/go-functions
Command: npx skills add https://github.com/muratmirgun/gophers --skill go-functions

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you design Go functions that are easier to read, safer to call, and more consistent across a codebase. It reduces common API mistakes like pointer-to-interface parameters, unclear boolean flags, and poorly formatted multi-line signatures.

Core Features & Use Cases

  • Function ordering in files: Keeps types, constructors, exported methods, unexported helpers, and utilities in a predictable sequence.
  • Signature and return-value design: Guides when to keep signatures on one line, how to wrap long parameter lists, and how to structure return values clearly.
  • Call-site clarity: Recommends named options, typed parameters, and inline comments when naked booleans or integers would be confusing.
  • Formatting and naming conventions: Enforces the f suffix for printf-style helpers and encourages %q for safe string interpolation in errors and logs.
  • Receiver and interface correctness: Helps avoid pointer-to-interface mistakes and choose consistent pointer or value receivers.
  • Use case: A developer adding a new service method or constructor can follow the Skill to produce Go APIs that are idiomatic, vet-friendly, and easy to maintain.

Quick Start

Use the go-functions skill to review this Go file and rewrite its functions, signatures, and constructors to follow the repository’s function-design conventions.

Frequently Asked Questions about go-functions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I design Go function signatures for better API readability?

To design Go function signatures for better API readability, keep short signatures on one line, wrap long parameter lists consistently, and use named options or typed parameters instead of naked booleans to ensure call-site clarity.

What is the correct way to order functions in a Go file?

The correct way to order functions in a Go file is to follow a predictable sequence: types first, then constructors, exported methods, unexported helpers, and finally utilities, which keeps the codebase organized and maintainable.

How do I choose between pointer and value receivers in Go?

Choosing between pointer and value receivers in Go requires maintaining consistency across methods and avoiding pointer-to-interface parameters, ensuring correct interface implementation and safe memory handling.

What are the naming conventions for printf-style helpers in Go?

Naming conventions for printf-style helpers in Go require adding an `f` suffix to the function name and using `%q` for safe string interpolation in errors and logs to ensure vet-friendly formatting.

Can I use this approach to refactor existing constructors in my Go codebase?

Yes, you can refactor existing constructors in your Go codebase by applying consistent function organization, signature clarity, and return-value shaping to produce idiomatic and vet-friendly APIs.

Why should I avoid passing pointers to interfaces in Go functions?

You should avoid passing pointers to interfaces in Go functions because interfaces already handle underlying pointer semantics internally, making explicit pointer-to-interface parameters redundant and a common API design mistake.