Skip to content

About

Better Go code style for Vibecoding.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

Repository files navigation

Locter Code Style

GitHub stars GitHub forks GitHub issues MIT License

Make AI-generated Go easier to read without changing what it does.
A formatting-first Agent Skill built around Locter's hand-written style.

English · 简体中文

What it is

Locter Code Style is an Agent Skill for Codex and other Agent Skills-compatible tools.

It turns dense AI-generated Go into code with a clearer reading rhythm:

  • blank lines separate complete actions;
  • calls stay attached to their immediate error checks;
  • if and for conditions stay on one syntax line;
  • every predicate in a multi-condition Where is visible on its own line;
  • compact comparison pairs remain together.

The goal is readability. The Skill is designed to preserve the existing business logic, conditions, call order, and error handling.

How to use

Install with $skill-installer (recommended)

In Codex:

$skill-installer https://github.com/Arbureva/locter-code-style/tree/main/skills/locter-code-style

Restart Codex if the Skill does not appear.

Manual installation fallback
git clone https://github.com/Arbureva/locter-code-style.git
mkdir -p "$HOME/.agents/skills"
cp -R locter-code-style/skills/locter-code-style "$HOME/.agents/skills/"

Invoke

$locter-code-style

Or include it in a normal request:

Use $locter-code-style to improve this Go code's readability.
Keep the business logic unchanged and show the final diff.

What it looks like

Separate complete actions

Before:

byStudent := map[uint][]*order_repo.Order{}
for _, o := range list {
	byStudent[o.StudentID] = append(byStudent[o.StudentID], o)
}
now := time.Now().Unix()
out := make(map[uint]orders.Balance, len(byStudent))
for sid, l := range byStudent {
	out[sid] = orders.BalanceOf(l, now, alert)
}
return out, nil

After:

byStudent := map[uint][]*order_repo.Order{}
for _, o := range list {
	byStudent[o.StudentID] = append(byStudent[o.StudentID], o)
}

now := time.Now().Unix()
out := make(map[uint]orders.Balance, len(byStudent))
for sid, l := range byStudent {
	out[sid] = orders.BalanceOf(l, now, alert)
}

return out, nil

The statements are the same. The blank lines make the two actions visible: grouping orders and calculating balances.

Make query predicates visible

Before:

ids, err := s.repos.Edu.ClassMembership.Query().
	Where(classmembership.Deleted(false), classmembership.HasClassDetailWith(class.TeacherID(teacherID), class.CampusID(campusID), class.Deleted(false))).
	Select(classmembership.FieldStudentID).Ints(ctx)

After:

ids, err := s.repos.Edu.ClassMembership.Query().Where(
	classmembership.Deleted(false),
	classmembership.HasClassDetailWith(
		class.TeacherID(teacherID),
		class.CampusID(campusID),
		class.Deleted(false),
	),
).Select(classmembership.FieldStudentID).Ints(ctx)

No predicate changed. Each filtering rule is simply easier to inspect during review.

Disclaimer

This project improves formatting and readability. It does not prove that generated code is correct.

  • Always review AI-generated code and run the relevant tests.
  • Keep business-level refactors separate from formatting requests.
  • Generated code under pkg/ent/ is outside this Skill's scope.
  • The Skill is currently focused on the teaching-assistant-app Go style and similar manually maintained business code.

Third-party Agents can still make mistakes. If an Agent accidentally changes the order of business code, the Skill directs it to leave a searchable warning. The message follows the user's language while the marker prefix remains fixed.

English:

// XXX(locter-code-style): This was unnecessary. I changed it anyway with equivalent logic; please test it.

Chinese:

// XXX(locter-code-style): 这里是多余的,我帮你改了,逻辑一样,你可以测试下

That marker is a review aid, not proof that the change is equivalent. Inspect the block and test it.

Usage suggestions

Use this Skill after AI generates Go code and before human review. It works well when the implementation is already correct and the remaining problem is that the code is hard to scan.

For best results:

  1. Ask for formatting and readability changes in one request.
  2. Ask for business logic changes separately.
  3. Review the diff and run focused tests before committing.
  4. Search for XXX(locter-code-style) after an Agent completes a large edit.

More

The repository is also compatible with single-Skill plugin packaging.

Star History

If this project makes your Go code easier to review, a star is appreciated.

Star History Chart

License

MIT

About

Better Go code style for Vibecoding.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors