What problem does it solve?
Go developers often struggle to write correct and maintainable functions and methods, suffering from inconsistent receiver choices, unclear return parameters, and unsafe defer usage. This Skill provides clear guidelines to improve correctness, readability, and maintainability of Go code.
Core Features & Use Cases
- Enforces receiver type selection rules (pointer vs value) to reflect mutability and semantics.
- Encourages named return parameters and avoids naked returns where clarity suffers.
- Promotes using io.Reader (not filenames) to keep code flexible and testable.
- Guides safe defer usage and captures semantics for closures and receivers.
- Use Case: When implementing a new Go type with methods, apply these rules to prevent subtle bugs and enable easier testing.
Quick Start
Follow these guidelines when creating or refactoring a Go type to ensure proper receiver choice, named results, and safe defer usage.