go-formatting

Automate Go code formatting with gofmt, goimports, and golangci-lint.

1|Updated Mar 22, 2026
One-click install
npx skills add https://github.com/caraya/agent-skills --skill go-formatting
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-formatting
Source: https://github.com/caraya/agent-skills/tree/main/skills/go-formatting
Command: npx skills add https://github.com/caraya/agent-skills --skill go-formatting

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Go development often suffers from inconsistent formatting across editors, tools, and CI. This Skill standardizes and enforces Go code formatting to reduce bikeshedding and code-wrestling.

Core Features & Use Cases

  • gofmt: format Go code to the language's standard style.
  • goimports: manage imports by adding missing ones and removing unused ones.
  • golangci-lint integration: provide a consolidated linting workflow with formatting and checks.
  • Use Case: ensure all teammates have the same formatting when committing code and during CI runs.

Quick Start

Run the formatting workflow across your Go project and apply fixes automatically.

Frequently Asked Questions about go-formatting

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

FAQPage Schema
How do I format Go code consistently across different IDEs and CI pipelines?

Format Go code consistently by applying gofmt for standard style, goimports for unused import management, and golangci-lint for consolidated checks across IDEs, pre-commit hooks, and CI pipelines.

What is the best way to manage and remove unused imports in a Go project?

Manage Go imports automatically by running goimports, which adds missing imports, removes unused ones, and formats code to standard style across your project tooling and IDE integrations.

Does golangci-lint work with gofmt for automated formatting and linting?

Yes, golangci-lint integrates with gofmt to provide a consolidated linting workflow, applying standard formatting and checks via a configurable .golangci.yml file across your Go project.

How do I configure Go formatting rules for a team using pre-commit hooks?

Configure team formatting rules by setting up a .golangci.yml file and integrating format, import management, and linting commands into pre-commit hooks and CI pipelines to enforce consistent style.

Why does my Go code formatting fail in CI when it passes locally?

CI formatting fails when local IDEs or tools lack consistent configuration. Standardize by applying gofmt and goimports via golangci-lint with a shared .golangci.yml file across all environments.