1. Habit
  2. Skills
  3. Golang Code Style skill
samber · 44K installs

Golang Code Style skill
Runs by itself, PR changes Go files.

Go code stays clear, not clever.

Install the Golang Code Style skill and make it a habit: follow https://gethabit.dev/skills/samber/golang-code-style.md

  1. 1Copy
  2. 2Paste into Claude Code, Codex or Cursor
  3. 3It runs by itself

44K installs4K starsMIT licenceSource on GitHub ↗

Golang Code Style

by samber · 44K installs

The skill

The golang code style skill gives Go developers clear style rules that linters cannot judge: line breaking, variable declarations, control flow, function design, comments and file layout.

Only when you ask.

The habit

Go code stays clear, not clever.

↻ Runs by itselfPR changes Go files

How the habit works.
You don't have to.

Three questionsWhen does it start? How does it check its work? What does it remember?

One run, step by step.
Then it stops.

Stop ruleStops after one pull request per run.

  1. 01

    Read the diff

    The agent lists changed Go files and functions in the pull request.

  2. 02

    Split by concern

    On a large diff it uses up to 5 sub-agents, one per style concern.

  3. 03

    Check control flow

    It looks for deep nesting, else after return, and conditions with 3 or more operands.

  4. 04

    Check declarations

    It checks := versus var, nil slices and maps, and composite literals without field names.

  5. 05

    Check functions

    It flags more than 4 parameters, context not first and naked returns in long functions.

  6. 06

    Run linters and tests

    It runs golangci-lint and the tests, then comments findings and logs them.

What it may do.
Nothing more.

Safe by defaultIt writes only in its own folder and asks you before anything goes out.

Is it for you?
Use it when it fits.

Quick checkRead both lists. If the left one sounds like you, the Golang Code Style skill helps.

Use it when

  • ✓ You review Go code for clarity
  • ✓ You set coding standards for a Go team
  • ✓ You clean up deep nesting or long signatures

Skip it when

  • – You need naming rules
  • – You need linter configuration

Questions

Golang Code Style skill, answered.

Does it cover naming?

No. Naming lives in the golang-naming skill; this one covers clarity and structure.

What if I break a rule on purpose?

The skill asks for a comment in the code that explains why.

Do linters do this already?

Linters handle formatting. This skill covers rules that need judgment, and the loop runs both.

How do I install the Golang Code Style skill?

Copy the prompt at the top into your agent. It installs the skill from samber/cc-skills-golang and sets up the habit. Or run npx skills add samber/cc-skills-golang --skill golang-code-style.

Is the Golang Code Style skill free?

Yes. It is published under MIT. Habit is free too.

Golang Code Style. Now as a habit.

Install the Golang Code Style skill and make it a habit: follow https://gethabit.dev/skills/samber/golang-code-style.md

  • Free
  • No account
  • Undo in one line

All samber skills →More code skills →

Works in

  • Claude Code
  • Codex
  • Cursor
  • ChatGPT
  • Claude app

Made by samber, published under MIT. Habit links to the original and never changes it. Is this your skill?

Copying didn't work here. Select the line and copy it by hand.