go-project-conventions

Enforce Go project conventions for error handling, imports, and linting.

Updated Jun 4, 2025
One-click install
npx skills add https://github.com/pixb/pixai --skill go-project-conventions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-project-conventions
Source: https://github.com/pixb/pixai/tree/main/skills/go-project-conventions
Command: npx skills add https://github.com/pixb/pixai --skill go-project-conventions

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a standardized set of Go project conventions to improve code quality and maintainability across Go codebases.

Core Features & Use Cases

  • Enforce consistent error handling patterns (wrap with errors.Wrap, avoid fmt.Errorf for errors)
  • Enforce standard imports grouping and formatting with goimports
  • Linting and static analysis via golangci-lint with configured rules
  • Predefined workflows for common tasks: API endpoints, migrations, and testing
  • Use Case: A team refactors a legacy Go project to ensure uniform error handling and imports, then runs lint and tests to catch regressions

Quick Start

Run golangci-lint on your project, format imports with goimports, and adopt the error-handling and import conventions described.

Frequently Asked Questions about go-project-conventions

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

FAQPage Schema
How do I standardize error handling in a Go project?

Standardize Go error handling by wrapping errors with errors.Wrap instead of using fmt.Errorf, ensuring consistent error context across your codebase for easier debugging and maintenance.

What's the best way to enforce consistent import grouping in Golang?

Enforce consistent Go import grouping by applying goimports to automatically format and separate standard library, third-party, and local imports according to predefined project conventions.

How do I set up golangci-lint for static analysis and linting rules?

Set up golangci-lint by configuring its defined linting rules within your Go project to catch regressions and enforce coding standards during static analysis before running tests.

Do I need predefined workflows to add API endpoints and database migrations in Go?

You need predefined workflows for adding API endpoints and database migrations in Go to ensure documented, repeatable processes that maintain code quality and project reliability across teams.

Can I use these Go conventions to refactor a legacy codebase?

You can use these Go conventions to refactor a legacy codebase by applying uniform error wrapping, formatting imports, and running lint to catch regressions and improve maintainability.

Why does fmt.Errorf not fit standard Go error wrapping conventions?

fmt.Errorf does not fit standard Go error wrapping conventions because it lacks the structured context provided by errors.Wrap, making it harder to trace errors back to their origin reliably.