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 · 简体中文
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;
ifandforconditions stay on one syntax line;- every predicate in a multi-condition
Whereis 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.
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/"$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.
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, nilAfter:
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, nilThe statements are the same. The blank lines make the two actions visible: grouping orders and calculating balances.
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.
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-appGo 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.
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:
- Ask for formatting and readability changes in one request.
- Ask for business logic changes separately.
- Review the diff and run focused tests before committing.
- Search for
XXX(locter-code-style)after an Agent completes a large edit.
The repository is also compatible with single-Skill plugin packaging.
If this project makes your Go code easier to review, a star is appreciated.