go-writing-code

Enforces idiomatic Go standards with HTTP/gRPC API patterns and 5-step verification process.

2|1|Updated Nov 13, 2025
One-click install
npx skills add https://github.com/MolcajeteAI/plugin --skill go-writing-code
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-writing-code
Source: https://github.com/MolcajeteAI/plugin/tree/main/molcajete/skills/go-writing-code
Command: npx skills add https://github.com/MolcajeteAI/plugin --skill go-writing-code

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a comprehensive guide and best practices for writing, reviewing, and refactoring Go code, ensuring adherence to idiomatic patterns, robust error handling, and secure coding practices.

Core Features & Use Cases

  • Idiomatic Go: Covers naming conventions, error handling, concurrency patterns, and project structure.
  • API Best Practices: Details patterns for HTTP handlers, middleware, and gRPC services.
  • Security: Emphasizes input validation, SQL injection prevention, and secrets management.
  • Verification: Mandates a 5-step post-change verification process (format, lint, vet, build, test).
  • Use Case: A developer needs to implement a new API endpoint in Go. This Skill ensures they follow best practices for request handling, data validation, error reporting, and database interaction, leading to more maintainable and secure code.

Quick Start

Ensure all Go code changes adhere to the mandatory 5-step verification protocol.

Frequently Asked Questions about go-writing-code

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

FAQPage Schema
How do I handle errors in Golang to ensure idiomatic context wrapping?

Idiomatic Go error handling requires wrapping errors with context using standard library functions. This approach preserves the original error stack while adding descriptive messages, allowing callers to trace the exact failure point without losing underlying error details.

What's the best way to manage concurrency in Go using errgroup and WaitGroup?

Go concurrency patterns using errgroup and WaitGroup synchronize parallel goroutines and manage error propagation. WaitGroup blocks execution until all routines finish, while errgroup cancels remaining routines if one returns an error, ensuring robust concurrent operations.

How do I structure a Go project to follow standard idiomatic conventions?

Standard Go project structure separates code into distinct directories for cmd, internal, and pkg packages. This idiomatic layout organizes executable binaries, private application logic, and reusable public libraries, creating maintainable and scalable codebases.

Does this approach work with HTTP API patterns using the Chi router?

Yes, this approach details API patterns for HTTP handlers and middleware using the Chi router. It ensures standard request handling, data validation, and error reporting, leading to secure and maintainable HTTP service implementations in Go.

Why do I need a 5-step verification process for Go code changes?

A 5-step verification process for Go code changes ensures format, lint, vet, build, and race condition testing pass. Running gofmt, golangci-lint, go vet, go build, and go test -race prevents syntax errors, vulnerabilities, and concurrency bugs from reaching production.

How do I prevent SQL injection in Go database interactions?

Prevent SQL injection in Go by using parameterized queries and standard database drivers for input validation. This security practice escapes user inputs automatically, blocking malicious execution and ensuring safe database interactions.