Scroll AI Now

Agent skill

Code style

Enforce existence, reuse, mirror, and symmetry principles so new code stays minimal and consistent. Use when writing, changing, or refactoring code in an...

By tobihagemann · tobihagemann/turbo · MIT License · ★ 426 · 16 lines

New to this? An agent skill is a file of instructions your AI assistant follows for one job. The text above is written for the assistant. How to use a skill

What it does

Code style is a coding skill from tobihagemann/turbo, a GitHub repo with 428 stars.
In short, it guides your assistant through a software task with a set method.
The file is 16 lines long.
It is plain instructions, with no code to run.

When to use it

Reach for it when you are writing, reviewing or changing code with an AI assistant.
Everything it needs is in this one file.
It does not ask for special tools.

Safety check

Our checker read all 16 lines before we listed it.
It found no attack techniques, no hidden text and no steps that switch off your assistant's safety or send your data away.
It flagged nothing else to watch for.
The text links to no outside sites.
It is shared under the MIT license.
Still read it before you use it, like any instructions you give your AI.

Open in the appOriginal on GitHub

How to use it

Read the full guide to using an agent skill

Want your own? How to write an agent skill that works

The full skill

---
name: code-style
description: "Enforce existence, reuse, mirror, and symmetry principles so new code stays minimal and consistent. Use when writing, changing, or refactoring code in an existing codebase."
---

# Code Style: Exist, Reuse, Mirror, Symmetry

When writing new code in an existing codebase, work through these in order. When two pull in different directions, the earlier one wins.

1. **Establish that the code needs to exist**: Drop work the request does not need — an abstraction with one implementation, a configuration point with one caller, a branch for a state the callers cannot reach, scaffolding for an anticipated requirement. Deleting or narrowing beats adding. Before removing code that already exists, trace its callers and confirm nothing depends on the behavior. A new test must earn its place too: before adding one, name the behavior it protects and the credible regression that makes it fail, and confirm no existing test already fails on that regression. When a mutation run checks the new test, read every test that fails under it, not only the new one: if existing tests also fail, keep the new test only for a regression they miss. When an existing test covers the same contract, extend its cases instead. Drive the test through a boundary production code already uses rather than adding an export, flag, or hook that only the test calls. A test pins the behavior it is named for: when one you add or change also covers another behavior only through how it is set up, give that behavior its own test unless another test already fails when it breaks, and set the first test up the way its siblings are. Input validation at trust boundaries, error handling that prevents data loss, security controls, accessibility affordances, and anything explicitly requested outrank this rule.
2. **Reuse existing code**: Before writing a new helper, check if an existing method can be reused or generalized. If a new helper is needed, model it after its closest sibling that is not debt (as rule 3 defines it).
3. **Reuse existing patterns**: Find the closest analogous feature and replicate its structure (method decomposition, control flow, annotations, guard clauses). When an existing pattern fits, use it rather than introducing a new one. When following it would force materially more code or indirection than a different approach, take the different approach and apply it across the whole change. Treat as debt a workaround for a problem inside the codebase, a deprecated API with a usable replacement, a suppression directive with no stated reason, or a TODO marking code temporary. When the closest analog contains debt, replicate its structure without the debt; when its structure is the debt, pass over it and follow the next clean one, and when none is clean, write the clean form, marking any workaround it cannot avoid as rule 7 directs. Name each skipped analog and omitted piece of debt when you report the change.
4. **Mirror the surrounding code exactly**: Match brace style, comment style, naming conventions, blank line spacing, code density, and level of detail by reading nearby code first.
5. **Maintain symmetry**: If adding `fooB()` parallel to `fooA()`, match naming, parameter order, and structure. Symmetry covers every name the new sibling makes asymmetric: identifiers, route paths, config keys, event names, environment variables, CLI flags, and file naming schemes. Rename the existing name by default; keep it as it stands only when it is a published contract whose consumers you cannot update, or cannot update in step with the rename. Treat deployment and registration as costs the change absorbs: updating every place the name is referenced or registered is part of the change.
6. **Logical ordering**: Place new methods, switch cases, and fields in the order that mirrors the existing grouping or business lifecycle, rather than appending at the end.
7. **Default to no comment**: Write code that self-explains through naming, extraction, and structure. When you reach for a comment, first try refactoring so it becomes unnecessary. Add one only for a load-bearing constraint the code cannot express (a hidden invariant, a workaround for a defect outside the codebase, with a reference to that defect where one exists, a non-obvious performance characteristic). For a problem inside the codebase, fix the root cause rather than writing a workaround with a comment justifying it. When that fix is out of reach, mark the workaround with a TODO that names the root cause and gives no reason the workaround is acceptable, and name it as debt when you report the change. When in doubt, omit the comment.

Copyright (c) 2026 Tobias Hagemann.
Published under the MIT License, which you can read in full there.
Shown as published on GitHub, with credit and a link to the original.
Read it before you use it.

Are you the author?

This skill passed our automated safety check.
Show it in your README with the badge below.
It links readers back to this page. How the badge works

Featured on Scroll AI Now, passed its automated safety check

Markdown
[![Featured on Scroll AI Now, passed its automated safety check](https://scrollainow.com/badge/safety-checked.svg)](https://scrollainow.com/skills/code-style/)
HTML
<a href="https://scrollainow.com/skills/code-style/"><img src="https://scrollainow.com/badge/safety-checked.svg" alt="Featured on Scroll AI Now, passed its automated safety check" height="28"></a>

More skills

All agent skills

Try it in your browser

Today's AI news, one card per swipe.
Free to start.

Open the web app