bp-go

Enforce Go coding patterns for error wrapping, context, logging, and tests.

9|4|Updated May 30, 2025
One-click install
npx skills add https://github.com/Kaikei-e/Alt --skill bp-go
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bp-go
Source: https://github.com/Kaikei-e/Alt/tree/main/.claude/skills/bp-go
Command: npx skills add https://github.com/Kaikei-e/Alt --skill bp-go

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents inconsistent, fragile, and hard-to-maintain Go code by codifying a set of conventions and patterns that reduce bugs, improve readability, and streamline reviews. It centralizes expectations for error handling, concurrency, logging, testing, and project structure so teams produce predictable, maintainable services.

Core Features & Use Cases

  • Error handling: Require contextual error wrapping (e.g., fmt.Errorf with %w) to preserve causality and provide actionable messages.
  • Application structure: Keep main.go thin (config → deps → wiring → server) and place non-public code under internal/.
  • Context & concurrency: Enforce ctx context.Context as the first parameter for I/O operations and proper defer-based cleanup.
  • Logging & testing: Use structured slog logging and table-driven tests with testify/assert.
  • Use Case: Use when implementing or reviewing Go services (alt-backend, auth-hub, pre-processor, search-indexer, mq-hub, altctl) to ensure consistent, production-ready code.

Quick Start

Review the provided Go file and apply the rules from docs/best_practices/go.md to produce edits and suggestions that enforce error wrapping, context usage, structured logging, table-driven tests, and proper package placement.

Frequently Asked Questions about bp-go

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

FAQPage Schema
How do I enforce consistent error handling in Go services?

Consistent Go error handling requires contextual error wrapping using fmt.Errorf with the %w verb to preserve causality and provide actionable error messages across services.

What is the best way to structure a Go application for maintainability?

The best way to structure Go applications is keeping main.go thin for config and wiring, while placing non-public code under the internal/ directory to ensure predictable and maintainable services.

How do I write table-driven tests in Go with testify?

Table-driven tests in Go use structured test cases iterated within a single test function, combined with testify/assert validations to streamline reviews and ensure predictable testing outcomes.

Does this Go code quality tool require context as the first parameter?

Yes, this Go code quality enforcement requires ctx context.Context as the first parameter for I/O operations, coupled with proper defer-based resource cleanup to manage concurrency safely.

Why use structured slog logging in Go projects?

Structured slog logging in Go projects centralizes log expectations, replacing fragmented logging with predictable, queryable outputs that improve readability and streamline code reviews.