agentleFS
ertugrul-dmrertugrul-dmr/clean-code-skills/skills/python/clean-names/SKILL.md

clean-names

Skill193 starsChanged 7 months agoMITView on GitHub

Use when naming, renaming, or fixing names of variables, functions, classes, or modules in Python. Enforces Clean Code principles—descriptive names, appropriate length, no encodings.

2 other projects use a version of this, 1 of them edited.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Don't pick names that communicate implementation.

    line 32
  2. Distinctive:

    Use terms from the domain, design patterns, or well-known conventions.

    line 46
  3. Distinctive:

    Don't encode type or scope information into names.

    line 88
  4. Distinctive:

    If a function does something beyond what its name suggests, the name is misleading.

    line 112

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Clean Names

N1: Choose Descriptive Names

Names should reveal intent. If a name requires a comment, it doesn't reveal its intent.

# Bad - what is d?
d = 86400

# Good - obvious meaning
SECONDS_PER_DAY = 86400

# Bad - what does this function do?
def proc(lst):
    return [x for x in lst if x > 0]

# Good - intent is clear
def filter_positive_numbers(numbers):
    return [n for n in numbers if n > 0]

N2: Choose Names at the Appropriate Level of Abstraction

Don't pick names that communicate implementation; choose names that reflect the level of abstraction of the class or function.

# Bad - too implementation-specific
def get_dict_of_user_ids_to_names():
    ...

# Good - abstracts the data structure
def get_user_directory():
    ...

N3: Use Standard Nomenclature Where Possible

Use terms from the domain, design patterns, or well-known conventions.

# Good - uses pattern name
class UserFactory:
    def create(self, data): ...

# Good - uses domain term
def calculate_amortization(principal, rate, term): ...

N4: Unambiguous Names

Choose names that make the workings of a function or variable unambiguous.

# Bad - ambiguous
def rename(old, new):
    ...

# Good - clear what's being renamed
def rename_file(old_path: Path, new_path: Path):
    ...

N5: Use Longer Names for Longer Scopes

Short names are fine for tiny scopes. Longer scopes need longer, more descriptive names.

# Good - short name for tiny scope
total = sum(x for x in numbers)

# Good - longer name for module-level constant
MAX_RETRY_ATTEMPTS_BEFORE_FAILURE = 5

# Bad - short name at module level
MAX = 5

N6: Avoid Encodings

Don't encode type or scope information into names. Modern editors make this unnecessary.

# Bad - Hungarian notation
str_name = "Alice"
lst_users = []
i_count = 0

# Good - clean names
name = "Alice"
users = []
count = 0

# Bad - interface prefix
class IUserRepository:
    ...

# Good - just name it
class UserRepository:
    ...

N7: Names Should Describe Side Effects

If a function does something beyond what its name suggests, the name is misleading.

# Bad - name doesn't mention file creation
def get_config():
    if not config_path.exists():
        config_path.write_text("{}")  # Hidden side effect!
    return json.loads(config_path.read_text())

# Good - name reveals behavior
def get_or_create_config():
    if not config_path.exists():
        config_path.write_text("{}")
    return json.loads(config_path.read_text())

Quick Reference

RulePrincipleExample
N1Descriptive namesSECONDS_PER_DAY not d
N2Right abstraction levelget_user_directory() not get_dict_of_...
N3Standard nomenclatureUserFactory, calculate_amortization
N4Unambiguousrename_file(old_path, new_path)
N5Length matches scopeShort for loops, long for globals
N6No encodingsusers not lst_users
N7Describe side effectsget_or_create_config()

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.